diff --git a/.gitattributes b/.gitattributes index 422cd747..22b59158 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,3 +14,6 @@ # Shell scripts *.sh eol=lf + +# Python +*.py eol=lf diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml new file mode 100644 index 00000000..75348ff6 --- /dev/null +++ b/.github/workflows/pythonpackage.yml @@ -0,0 +1,35 @@ +name: Python package + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + max-parallel: 5 + matrix: + python-version: [2.7, 3.5, 3.6, 3.7, 3.8] + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install msrest + - name: Python compile + run: | + python -m compileall . + - name: Lint with flake8 + run: | + pip install flake8 + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + - name: Test with pytest + run: | + pip install pytest + pytest diff --git a/.gitignore b/.gitignore index 1b5d5e6d..903d30ba 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ env/** dist/ lib/ +.eggs/ # Build results [Dd]ebug/ @@ -293,3 +294,13 @@ __pycache__/ *.btm.cs *.odx.cs *.xsd.cs +.vscode/ +vsts/build/bdist.win32/ + +# don't ignore release management client +!azure-devops/azure/devops/released/release +!azure-devops/azure/devops/v5_1/release +!azure-devops/azure/devops/v6_0/release + +# ignore private folder for testing reported issues +issues/ \ No newline at end of file diff --git a/README.md b/README.md index 72f1506a..256735cf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,62 @@ +[![Python package](https://github.com/microsoft/azure-devops-python-api/workflows/Python%20package/badge.svg)](https://github.com/microsoft/azure-devops-python-api/actions) +[![Build Status](https://dev.azure.com/mseng/vsts-cli/_apis/build/status/vsts-python-api?branchName=dev)](https://dev.azure.com/mseng/vsts-cli/_build/latest?definitionId=5904&branchName=dev) +[![Python](https://img.shields.io/pypi/pyversions/azure-devops.svg)](https://pypi.python.org/pypi/azure-devops) -# Contributing +# Azure DevOps Python API + +This repository contains Python APIs for interacting with and managing Azure DevOps. These APIs power the Azure DevOps Extension for Azure CLI. To learn more about the Azure DevOps Extension for Azure CLI, visit the [Microsoft/azure-devops-cli-extension](https://github.com/Microsoft/azure-devops-cli-extension) repo. + +## Install + +``` +pip install azure-devops +``` + +## Get started + + +To use the API, establish a connection using a [personal access token](https://docs.microsoft.com/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=vsts) and the URL to your Azure DevOps organization. Then get a client from the connection and make API calls. + +```python +from azure.devops.connection import Connection +from msrest.authentication import BasicAuthentication +import pprint + +# Fill in with your personal access token and org URL +personal_access_token = 'YOURPAT' +organization_url = 'https://dev.azure.com/YOURORG' + +# Create a connection to the org +credentials = BasicAuthentication('', personal_access_token) +connection = Connection(base_url=organization_url, creds=credentials) + +# Get a client (the "core" client provides access to projects, teams, etc) +core_client = connection.clients.get_core_client() + +# Get the first page of projects +get_projects_response = core_client.get_projects() +index = 0 +while get_projects_response is not None: + for project in get_projects_response.value: + pprint.pprint("[" + str(index) + "] " + project.name) + index += 1 + if get_projects_response.continuation_token is not None and get_projects_response.continuation_token != "": + # Get the next page of projects + get_projects_response = core_client.get_projects(continuation_token=get_projects_response.continuation_token) + else: + # All projects have been retrieved + get_projects_response = None +``` + +## API documentation + +This Python library provides a thin wrapper around the Azure DevOps REST APIs. See the [Azure DevOps REST API reference](https://docs.microsoft.com/en-us/rest/api/azure/devops/?view=azure-devops-rest-5.1) for details on calling different APIs. + +## Samples + +Learn how to call different APIs by viewing the samples in the [Microsoft/azure-devops-python-samples](https://github.com/Microsoft/azure-devops-python-samples) repo. + +## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us diff --git a/vsts/LICENSE.txt b/azure-devops/LICENSE.txt similarity index 100% rename from vsts/LICENSE.txt rename to azure-devops/LICENSE.txt diff --git a/azure-devops/MANIFEST.in b/azure-devops/MANIFEST.in new file mode 100644 index 00000000..42eb4101 --- /dev/null +++ b/azure-devops/MANIFEST.in @@ -0,0 +1 @@ +include LICENSE.txt diff --git a/vsts/vsts/__init__.py b/azure-devops/azure/__init__.py similarity index 100% rename from vsts/vsts/__init__.py rename to azure-devops/azure/__init__.py diff --git a/azure-devops/azure/devops/__init__.py b/azure-devops/azure/devops/__init__.py new file mode 100644 index 00000000..73baee1e --- /dev/null +++ b/azure-devops/azure/devops/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/vsts/vsts/_file_cache.py b/azure-devops/azure/devops/_file_cache.py similarity index 79% rename from vsts/vsts/_file_cache.py rename to azure-devops/azure/devops/_file_cache.py index 4c208f4a..2415ebab 100644 --- a/vsts/vsts/_file_cache.py +++ b/azure-devops/azure/devops/_file_cache.py @@ -14,6 +14,9 @@ import collections +logger = logging.getLogger(__name__) + + class FileCache(collections.MutableMapping): """A simple dict-like class that is backed by a JSON file. @@ -32,21 +35,21 @@ def load(self): self.data = {} try: if os.path.isfile(self.file_name): - if self.max_age > 0 and os.stat(self.file_name).st_mtime + self.max_age < time.clock(): - logging.info('Cache file expired: {file}'.format(file=self.file_name)) + if self.max_age > 0 and os.stat(self.file_name).st_mtime + self.max_age < time.time(): + logger.debug('Cache file expired: %s', self.file_name) os.remove(self.file_name) else: - logging.info('Loading cache file: {file}'.format(file=self.file_name)) + logger.debug('Loading cache file: %s', self.file_name) self.data = get_file_json(self.file_name, throw_on_empty=False) or {} else: - logging.info('Cache file does not exist: {file}'.format(file=self.file_name)) - except Exception as e: - logging.exception(e) + logger.debug('Cache file does not exist: %s', self.file_name) + except Exception as ex: + logger.debug(ex, exc_info=True) # file is missing or corrupt so attempt to delete it try: os.remove(self.file_name) - except Exception as e2: - logging.exception(e2) + except Exception as ex2: + logger.debug(ex2, exc_info=True) self.initial_load_occurred = True def save(self): @@ -71,10 +74,10 @@ def save_with_retry(self, retries=5): def clear(self): if os.path.isfile(self.file_name): - logging.info("Deleting file: " + self.file_name) + logger.info("Deleting file: " + self.file_name) os.remove(self.file_name) else: - logging.info("File does not exist: " + self.file_name) + logger.info("File does not exist: " + self.file_name) def get(self, key, default=None): self._check_for_initial_load() @@ -108,11 +111,17 @@ def _check_for_initial_load(self): def get_cache_dir(): - vsts_cache_dir = os.getenv('VSTS_CACHE_DIR', None) or os.path.expanduser(os.path.join('~', '.vsts', 'python-sdk', - 'cache')) - if not os.path.exists(vsts_cache_dir): - os.makedirs(vsts_cache_dir) - return vsts_cache_dir + azure_devops_cache_dir = os.getenv('AZURE_DEVOPS_CACHE_DIR', None)\ + or os.path.expanduser(os.path.join('~', '.azure-devops', 'python-sdk', 'cache')) + if not os.path.exists(azure_devops_cache_dir): + try: + os.makedirs(azure_devops_cache_dir) + except OSError: + # https://github.com/microsoft/azure-devops-python-api/issues/354 + # FileExistsError is not available in python 2.7 + if not os.path.exists(azure_devops_cache_dir): + raise + return azure_devops_cache_dir DEFAULT_MAX_AGE = 3600 * 12 # 12 hours @@ -144,12 +153,12 @@ def read_file_content(file_path, allow_binary=False): for encoding in ['utf-8-sig', 'utf-8', 'utf-16', 'utf-16le', 'utf-16be']: try: with codecs_open(file_path, encoding=encoding) as f: - logging.debug("attempting to read file %s as %s", file_path, encoding) + logger.debug("attempting to read file %s as %s", file_path, encoding) return f.read() except UnicodeDecodeError: if allow_binary: with open(file_path, 'rb') as input_file: - logging.debug("attempting to read file %s as binary", file_path) + logger.debug("attempting to read file %s as binary", file_path) return base64.b64encode(input_file.read()).decode("utf-8") else: raise diff --git a/azure-devops/azure/devops/_models.py b/azure-devops/azure/devops/_models.py new file mode 100644 index 00000000..58f904ae --- /dev/null +++ b/azure-devops/azure/devops/_models.py @@ -0,0 +1,215 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ApiResourceLocation(Model): + """ApiResourceLocation. + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'area': {'key': 'area', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'route_template': {'key': 'routeTemplate', 'type': 'str'}, + 'resource_version': {'key': 'resourceVersion', 'type': 'int'}, + 'min_version': {'key': 'minVersion', 'type': 'float'}, + 'max_version': {'key': 'maxVersion', 'type': 'float'}, + 'released_version': {'key': 'releasedVersion', 'type': 'str'}, + } + + def __init__(self, id=None, area=None, resource_name=None, + route_template=None, resource_version=None, + min_version=None, max_version=None, + released_version=None): + super(ApiResourceLocation, self).__init__() + self.id = id + self.area = area + self.resource_name = resource_name + self.route_template = route_template + self.resource_version = resource_version + self.min_version = min_version + self.max_version = max_version + self.released_version = released_version + + +class CustomerIntelligenceEvent(Model): + """CustomerIntelligenceEvent. + + :param area: + :type area: str + :param feature: + :type feature: str + :param properties: + :type properties: dict + """ + + _attribute_map = { + 'area': {'key': 'area', 'type': 'str'}, + 'feature': {'key': 'feature', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{object}'} + } + + def __init__(self, area=None, feature=None, properties=None): + super(CustomerIntelligenceEvent, self).__init__() + self.area = area + self.feature = feature + self.properties = properties + + +class ImproperException(Model): + """ImproperException. + :param message: + :type message: str + """ + + _attribute_map = { + 'message': {'key': 'Message', 'type': 'str'} + } + + def __init__(self, message=None): + super(ImproperException, self).__init__() + self.message = message + + +class ResourceAreaInfo(Model): + """ResourceAreaInfo. + + :param id: + :type id: str + :param location_url: + :type location_url: str + :param name: + :type name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location_url': {'key': 'locationUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'} + } + + def __init__(self, id=None, location_url=None, name=None): + super(ResourceAreaInfo, self).__init__() + self.id = id + self.location_url = location_url + self.name = name + + +class SystemException(Model): + """SystemException. + :param class_name: + :type class_name: str + :param inner_exception: + :type inner_exception: :class:`SystemException` + :param message: + :type message: str + """ + + _attribute_map = { + 'class_name': {'key': 'ClassName', 'type': 'str'}, + 'message': {'key': 'Message', 'type': 'str'}, + 'inner_exception': {'key': 'InnerException', 'type': 'SystemException'} + } + + def __init__(self, class_name=None, message=None, inner_exception=None): + super(SystemException, self).__init__() + self.class_name = class_name + self.message = message + self.inner_exception = inner_exception + + +class VssJsonCollectionWrapperBase(Model): + """VssJsonCollectionWrapperBase. + + :param count: + :type count: int + """ + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'} + } + + def __init__(self, count=None): + super(VssJsonCollectionWrapperBase, self).__init__() + self.count = count + + +class VssJsonCollectionWrapper(VssJsonCollectionWrapperBase): + """VssJsonCollectionWrapper. + + :param count: + :type count: int + :param value: + :type value: object + """ + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + 'value': {'key': 'value', 'type': 'object'} + } + + def __init__(self, count=None, value=None): + super(VssJsonCollectionWrapper, self).__init__(count=count) + self.value = value + + +class WrappedException(Model): + """WrappedException. + :param exception_id: + :type exception_id: str + :param inner_exception: + :type inner_exception: :class:`WrappedException` + :param message: + :type message: str + :param type_name: + :type type_name: str + :param type_key: + :type type_key: str + :param error_code: + :type error_code: int + :param event_id: + :type event_id: int + :param custom_properties: + :type custom_properties: dict + """ + + _attribute_map = { + 'exception_id': {'key': '$id', 'type': 'str'}, + 'inner_exception': {'key': 'innerException', 'type': 'WrappedException'}, + 'message': {'key': 'message', 'type': 'str'}, + 'type_name': {'key': 'typeName', 'type': 'str'}, + 'type_key': {'key': 'typeKey', 'type': 'str'}, + 'error_code': {'key': 'errorCode', 'type': 'int'}, + 'event_id': {'key': 'eventId', 'type': 'int'}, + 'custom_properties': {'key': 'customProperties', 'type': '{object}'} + } + + def __init__(self, exception_id=None, inner_exception=None, message=None, + type_name=None, type_key=None, error_code=None, event_id=None, custom_properties=None): + super(WrappedException, self).__init__() + self.exception_id = exception_id + self.inner_exception = inner_exception + self.message = message + self.type_name = type_name + self.type_key = type_key + self.error_code = error_code + self.event_id = event_id + self.custom_properties = custom_properties + + +__all__ = [ + 'ApiResourceLocation', + 'CustomerIntelligenceEvent', + 'ImproperException', + 'ResourceAreaInfo', + 'SystemException', + 'VssJsonCollectionWrapperBase', + 'VssJsonCollectionWrapper', + 'WrappedException' +] diff --git a/azure-devops/azure/devops/client.py b/azure-devops/azure/devops/client.py new file mode 100644 index 00000000..ad71109b --- /dev/null +++ b/azure-devops/azure/devops/client.py @@ -0,0 +1,314 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from __future__ import print_function + +import logging +import os +import re +import uuid + +from msrest import Deserializer, Serializer +from msrest.exceptions import DeserializationError, SerializationError +from msrest.universal_http import ClientRequest +from msrest.service_client import ServiceClient +from .exceptions import AzureDevOpsAuthenticationError, AzureDevOpsClientRequestError, AzureDevOpsServiceError +from .client_configuration import ClientConfiguration +from . import _models +from ._file_cache import OPTIONS_CACHE as OPTIONS_FILE_CACHE + + +logger = logging.getLogger(__name__) + + +class Client(object): + """Client. + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + self.config = ClientConfiguration(base_url) + self.config.credentials = creds + self._client = ServiceClient(creds, config=self.config) + _base_client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._base_deserialize = Deserializer(_base_client_models) + self._base_serialize = Serializer(_base_client_models) + self._all_host_types_locations = {} + self._locations = {} + self._suppress_fedauth_redirect = True + self._force_msa_pass_through = True + self.normalized_url = Client._normalize_url(base_url) + + def add_user_agent(self, user_agent): + if user_agent is not None: + self.config.add_user_agent(user_agent) + + def _send_request(self, request, headers=None, content=None, media_type=None, **operation_config): + """Prepare and send request object according to configuration. + :param ClientRequest request: The request object to be sent. + :param dict headers: Any headers to add to the request. + :param content: Any body data to add to the request. + :param config: Any specific config overrides + """ + if (TRACE_ENV_VAR in os.environ and os.environ[TRACE_ENV_VAR] == 'true')\ + or (TRACE_ENV_VAR_COMPAT in os.environ and os.environ[TRACE_ENV_VAR_COMPAT] == 'true'): + print(request.method + ' ' + request.url) + logger.debug('%s %s', request.method, request.url) + if media_type is not None and media_type == 'application/json': + logger.debug('Request content: %s', content) + response = self._client.send(request=request, headers=headers, + content=content, **operation_config) + if ('Content-Type' in response.headers + and response.headers['Content-Type'].startswith('application/json')): + logger.debug('Response content: %s', response.content) + if response.status_code < 200 or response.status_code >= 300: + self._handle_error(request, response) + return response + + def _send(self, http_method, location_id, version, route_values=None, + query_parameters=None, content=None, media_type='application/json', accept_media_type='application/json', + additional_headers=None): + request = self._create_request_message(http_method=http_method, + location_id=location_id, + route_values=route_values, + query_parameters=query_parameters) + negotiated_version = self._negotiate_request_version( + self._get_resource_location(self.normalized_url, location_id), + version) + + if version != negotiated_version: + logger.info("Negotiated api version from '%s' down to '%s'. This means the client is newer than the server.", + version, + negotiated_version) + else: + logger.debug("Api version '%s'", negotiated_version) + + # Construct headers + headers = {'Content-Type': media_type + '; charset=utf-8', + 'Accept': accept_media_type + ';api-version=' + negotiated_version} + if additional_headers is not None: + for key in additional_headers: + headers[key] = str(additional_headers[key]) + if self.config.additional_headers is not None: + for key in self.config.additional_headers: + headers[key] = self.config.additional_headers[key] + if self._suppress_fedauth_redirect: + headers['X-TFS-FedAuthRedirect'] = 'Suppress' + if self._force_msa_pass_through: + headers['X-VSS-ForceMsaPassThrough'] = 'true' + if Client._session_header_key in Client._session_data and Client._session_header_key not in headers: + headers[Client._session_header_key] = Client._session_data[Client._session_header_key] + response = self._send_request(request=request, headers=headers, content=content, media_type=media_type) + if Client._session_header_key in response.headers: + Client._session_data[Client._session_header_key] = response.headers[Client._session_header_key] + return response + + def _unwrap_collection(self, response): + if response.headers.get("transfer-encoding") == 'chunked': + wrapper = self._base_deserialize.deserialize_data(response.json(), 'VssJsonCollectionWrapper') + else: + wrapper = self._base_deserialize('VssJsonCollectionWrapper', response) + collection = wrapper.value + return collection + + def _create_request_message(self, http_method, location_id, route_values=None, + query_parameters=None): + location = self._get_organization_resource_location(location_id) + deployment_level = False + deployment_url = None + if location is None: + logger.debug('API resource location ' + location_id + ' is not registered on ' + self.config.base_url + '.') + deployment_url = self._get_deployment_url() + if deployment_url is not None: + logger.debug('Checking for location at deployment level: ' + deployment_url) + location = self._get_resource_location(deployment_url, location_id) + deployment_level = True + if location is None: + raise ValueError('API resource location ' + location_id + ' is not registered on ' + + self.config.base_url + '.') + if route_values is None: + route_values = {} + route_values['area'] = location.area + route_values['resource'] = location.resource_name + route_template = self._remove_optional_route_parameters(location.route_template, + route_values) + logger.debug('Route template: %s', location.route_template) + if not deployment_level: + url = self._client.format_url(route_template, **route_values) + else: + url = self._client.format_url(deployment_url + route_template, **route_values) + request = ClientRequest(method=http_method, url=url) + if query_parameters: + request.format_parameters(query_parameters) + return request + + @staticmethod + def _remove_optional_route_parameters(route_template, route_values): + new_template = '' + route_template = route_template.replace('{*', '{') + for path_segment in route_template.split('/'): + if (len(path_segment) <= 2 or not path_segment[0] == '{' + or not path_segment[len(path_segment) - 1] == '}' + or path_segment[1:len(path_segment) - 1] in route_values): + new_template = new_template + '/' + path_segment + return new_template + + def _get_organization_resource_location(self, location_id): + return self._get_resource_location(self.normalized_url, location_id) + + def _get_deployment_url(self): + pos = self.normalized_url.rfind('/') + if pos > 0: + deployment_url = self.normalized_url[:pos] + if deployment_url.find('://') > 0: + return deployment_url + return None + + def _get_resource_location(self, url, location_id): + if url not in Client._locations_cache: + Client._locations_cache[url] = self._get_resource_locations(url, all_host_types=False) + for location in Client._locations_cache[url]: + if location.id == location_id: + return location + + def _get_resource_locations(self, url, all_host_types): + # Check local client's cached Options first + if all_host_types: + if url in self._all_host_types_locations: + return self._all_host_types_locations[url] + elif url in self._locations: + return self._locations[url] + + # Next check for options cached on disk + if not all_host_types and OPTIONS_FILE_CACHE[url]: + try: + logger.debug('File cache hit for options on: %s', url) + self._locations[url] = self._base_deserialize.deserialize_data(OPTIONS_FILE_CACHE[url], + '[ApiResourceLocation]') + return self._locations[url] + except DeserializationError as ex: + logger.debug(ex, exc_info=True) + else: + logger.debug('File cache miss for options on: %s', url) + + # Last resort, make the call to the server + options_uri = self._combine_url(url, '_apis') + request = ClientRequest(method='OPTIONS', url=self._client.format_url(options_uri)) + if all_host_types: + query_parameters = {'allHostTypes': True} + request.format_parameters(query_parameters) + headers = {'Accept': 'application/json'} + if self._suppress_fedauth_redirect: + headers['X-TFS-FedAuthRedirect'] = 'Suppress' + if self._force_msa_pass_through: + headers['X-VSS-ForceMsaPassThrough'] = 'true' + response = self._send_request(request, headers=headers) + wrapper = self._base_deserialize('VssJsonCollectionWrapper', response) + if wrapper is None: + raise AzureDevOpsClientRequestError("Failed to retrieve resource locations from: {}".format(options_uri)) + collection = wrapper.value + returned_locations = self._base_deserialize('[ApiResourceLocation]', + collection) + if all_host_types: + self._all_host_types_locations[url] = returned_locations + else: + self._locations[url] = returned_locations + try: + OPTIONS_FILE_CACHE[url] = wrapper.value + except SerializationError as ex: + logger.debug(ex, exc_info=True) + return returned_locations + + @staticmethod + def _negotiate_request_version(location, version): + if location is None or version is None: + return version + pattern = r'(\d+(\.\d)?)(-preview(.(\d+))?)?' + match = re.match(pattern, version) + requested_api_version = match.group(1) + if requested_api_version is not None: + requested_api_version = float(requested_api_version) + if location.min_version > requested_api_version: + # Client is older than the server. The server no longer supports this + # resource (deprecated). + return + elif location.max_version < requested_api_version: + # Client is newer than the server. Negotiate down to the latest version + # on the server + negotiated_version = str(location.max_version) + if float(location.released_version) < location.max_version: + negotiated_version += '-preview' + return negotiated_version + else: + # We can send at the requested api version. Make sure the resource version + # is not bigger than what the server supports + negotiated_version = match.group(1) + is_preview = match.group(3) is not None + if is_preview: + negotiated_version += '-preview' + if match.group(5) is not None: + if location.resource_version < int(match.group(5)): + negotiated_version += '.' + str(location.resource_version) + else: + negotiated_version += '.' + match.group(5) + return negotiated_version + + @staticmethod + def _combine_url(part1, part2): + return part1.rstrip('/') + '/' + part2.strip('/') + + def _handle_error(self, request, response): + content_type = response.headers.get('Content-Type') + error_message = '' + if content_type is None or content_type.find('text/plain') < 0: + try: + wrapped_exception = self._base_deserialize('WrappedException', response) + if wrapped_exception is not None and wrapped_exception.message is not None: + raise AzureDevOpsServiceError(wrapped_exception) + else: + # System exceptions from controllers are not returning wrapped exceptions. + # Following code is to handle this unusual exception json case. + # TODO: dig into this. + collection_wrapper = self._base_deserialize('VssJsonCollectionWrapper', response) + if collection_wrapper is not None and collection_wrapper.value is not None: + wrapped_exception = self._base_deserialize('ImproperException', collection_wrapper.value) + if wrapped_exception is not None and wrapped_exception.message is not None: + raise AzureDevOpsClientRequestError(wrapped_exception.message) + # if we get here we still have not raised an exception, try to deserialize as a System Exception + system_exception = self._base_deserialize('SystemException', response) + if system_exception is not None and system_exception.message is not None: + raise AzureDevOpsClientRequestError(system_exception.message) + except DeserializationError: + pass + elif response.content is not None: + error_message = response.content.decode("utf-8") + ' ' + if response.status_code == 401: + full_message_format = '{error_message}The requested resource requires user authentication: {url}' + raise AzureDevOpsAuthenticationError(full_message_format.format(error_message=error_message, + url=request.url)) + else: + full_message_format = '{error_message}Operation returned a {status_code} status code.' + raise AzureDevOpsClientRequestError(full_message_format.format(error_message=error_message, + status_code=response.status_code)) + + def _get_continuation_token(self, response): + if self._continuation_token_header_key in response.headers: + return response.headers[self._continuation_token_header_key] + else: + return None + + @staticmethod + def _normalize_url(url): + return url.rstrip('/').lower() + + _locations_cache = {} + _continuation_token_header_key = 'X-MS-ContinuationToken' + _session_header_key = 'X-TFS-Session' + _session_data = {_session_header_key: str(uuid.uuid4())} + + +TRACE_ENV_VAR_COMPAT = 'vsts_python_print_urls' +TRACE_ENV_VAR = 'azure_devops_python_print_urls' diff --git a/azure-devops/azure/devops/client_configuration.py b/azure-devops/azure/devops/client_configuration.py new file mode 100644 index 00000000..83fed802 --- /dev/null +++ b/azure-devops/azure/devops/client_configuration.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from msrest import Configuration +from .version import VERSION + + +class ClientConfiguration(Configuration): + def __init__(self, base_url=None): + if not base_url: + raise ValueError('base_url is required.') + base_url = base_url.rstrip('/') + super(ClientConfiguration, self).__init__(base_url) + self.add_user_agent('azure-devops/{}'.format(VERSION)) + self.additional_headers = {} diff --git a/azure-devops/azure/devops/connection.py b/azure-devops/azure/devops/connection.py new file mode 100644 index 00000000..78d8f9cf --- /dev/null +++ b/azure-devops/azure/devops/connection.py @@ -0,0 +1,143 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import logging + +from msrest.service_client import ServiceClient +from ._file_cache import RESOURCE_CACHE as RESOURCE_FILE_CACHE +from .client_configuration import ClientConfiguration +from .exceptions import AzureDevOpsClientRequestError +from .released.client_factory import ClientFactory +from .v5_1.location.location_client import LocationClient +from .v5_1.client_factory import ClientFactoryV5_1 +from .v6_0.client_factory import ClientFactoryV6_0 + +logger = logging.getLogger(__name__) + + +class Connection(object): + """Connection. + """ + + def __init__(self, base_url=None, creds=None, user_agent=None): + self._config = ClientConfiguration(base_url) + self._config.credentials = creds + self._addition_user_agent = user_agent + if user_agent is not None: + self._config.add_user_agent(user_agent) + self._client = ServiceClient(creds, self._config) + self._client_cache = {} + self.base_url = base_url + self._creds = creds + self._resource_areas = None + self.clients = ClientFactory(self) + self.clients_v5_1 = ClientFactoryV5_1(self) + self.clients_v6_0 = ClientFactoryV6_0(self) + self.use_fiddler = False + + def get_client(self, client_type): + """get_client. + """ + if client_type not in self._client_cache: + client_class = self._get_class(client_type) + self._client_cache[client_type] = self._get_client_instance(client_class) + return self._client_cache[client_type] + + @staticmethod + def _get_class(full_class_name): + parts = full_class_name.split('.') + module_name = ".".join(parts[:-1]) + imported = __import__(module_name) + for comp in parts[1:]: + imported = getattr(imported, comp) + return imported + + def _get_client_instance(self, client_class): + url = self._get_url_for_client_instance(client_class) + client = client_class(url, self._creds) + client.add_user_agent(self._addition_user_agent) + if self.use_fiddler: + self._configure_client_for_fiddler(client) + return client + + def _get_url_for_client_instance(self, client_class): + resource_id = client_class.resource_area_identifier + if resource_id is None: + return self.base_url + else: + resource_areas = self._get_resource_areas() + if resource_areas is None: + raise AzureDevOpsClientRequestError(('Failed to retrieve resource areas ' + + 'from server: {url}').format(url=self.base_url)) + if not resource_areas: + # For OnPrem environments we get an empty list. + return self.base_url + for resource_area in resource_areas: + if resource_area.id.lower() == resource_id.lower(): + return resource_area.location_url + + # Check SPS deployment level for the resource area + resource_area = self._get_deployment_resource_area_from_sps(resource_id) + if resource_area is not None: + return resource_area.location_url + + raise AzureDevOpsClientRequestError(('Could not find information for resource area {id} ' + + 'from server: {url}').format(id=resource_id, + url=self.base_url)) + + def _get_deployment_resource_area_from_sps(self, resource_id): + resource_id = resource_id.lower() + if resource_id in _deployment_level_resource_areas: + return _deployment_level_resource_areas[resource_id] + location_client = LocationClient(sps_url, self._creds) + if self.use_fiddler: + self._configure_client_for_fiddler(location_client) + resource_area = location_client.get_resource_area(area_id=resource_id) + _deployment_level_resource_areas[resource_id] = resource_area + return resource_area + + def authenticate(self): + self._get_resource_areas(force=True) + + def _get_resource_areas(self, force=False): + if self._resource_areas is None or force: + location_client = LocationClient(self.base_url, self._creds) + if self.use_fiddler: + self._configure_client_for_fiddler(location_client) + if not force and RESOURCE_FILE_CACHE[location_client.normalized_url]: + try: + logger.debug('File cache hit for resources on: %s', location_client.normalized_url) + self._resource_areas = location_client._base_deserialize.deserialize_data( + RESOURCE_FILE_CACHE[location_client.normalized_url], + '[ResourceAreaInfo]') + return self._resource_areas + except Exception as ex: + logger.debug(ex, exc_info=True) + elif not force: + logger.debug('File cache miss for resources on: %s', location_client.normalized_url) + self._resource_areas = location_client.get_resource_areas() + if self._resource_areas is None: + # For OnPrem environments we get an empty collection wrapper. + self._resource_areas = [] + try: + serialized = location_client._base_serialize.serialize_data(self._resource_areas, + '[ResourceAreaInfo]') + RESOURCE_FILE_CACHE[location_client.normalized_url] = serialized + except Exception as ex: + logger.debug(ex, exc_info=True) + return self._resource_areas + + @staticmethod + def _combine_url(part1, part2): + return part1.rstrip('/') + '/' + part2.strip('/') + + @staticmethod + def _configure_client_for_fiddler(client): + client.config.connection.verify = False + client.config.proxies.add(protocol='https', proxy_url='https://127.0.0.1:8888') + + +_deployment_level_resource_areas = {} +sps_url = 'https://app.vssps.visualstudio.com' diff --git a/vsts/vsts/credentials.py b/azure-devops/azure/devops/credentials.py similarity index 100% rename from vsts/vsts/credentials.py rename to azure-devops/azure/devops/credentials.py diff --git a/azure-devops/azure/devops/exceptions.py b/azure-devops/azure/devops/exceptions.py new file mode 100644 index 00000000..18a5f9ce --- /dev/null +++ b/azure-devops/azure/devops/exceptions.py @@ -0,0 +1,41 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from msrest.exceptions import ( + ClientException, + ClientRequestError, + AuthenticationError, +) + + +class AzureDevOpsClientError(ClientException): + pass + + +class AzureDevOpsAuthenticationError(AuthenticationError): + pass + + +class AzureDevOpsClientRequestError(ClientRequestError): + pass + + +class AzureDevOpsServiceError(AzureDevOpsClientRequestError): + """AzureDevOpsServiceError. + """ + + def __init__(self, wrapped_exception): + self.inner_exception = None + if wrapped_exception.inner_exception is not None: + self.inner_exception = AzureDevOpsServiceError(wrapped_exception.inner_exception) + super(AzureDevOpsServiceError, self).__init__(message=wrapped_exception.message, + inner_exception=self.inner_exception) + self.message = wrapped_exception.message + self.exception_id = wrapped_exception.exception_id + self.type_name = wrapped_exception.type_name + self.type_key = wrapped_exception.type_key + self.error_code = wrapped_exception.error_code + self.event_id = wrapped_exception.event_id + self.custom_properties = wrapped_exception.custom_properties diff --git a/azure-devops/azure/devops/issue_tests/__init__.py b/azure-devops/azure/devops/issue_tests/__init__.py new file mode 100644 index 00000000..f885a96e --- /dev/null +++ b/azure-devops/azure/devops/issue_tests/__init__.py @@ -0,0 +1,7 @@ +# -------------------------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------------------------- diff --git a/azure-devops/azure/devops/issue_tests/test_issue_268.py b/azure-devops/azure/devops/issue_tests/test_issue_268.py new file mode 100644 index 00000000..b429db0b --- /dev/null +++ b/azure-devops/azure/devops/issue_tests/test_issue_268.py @@ -0,0 +1,47 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import pprint +import unittest + +from msrest import Deserializer +from msrest.universal_http import HTTPClientResponse + + +class _TestResponse(HTTPClientResponse): + def __init__(self, text): + super(_TestResponse, self).__init__(request=None, internal_response=None) + self._text = text + + def text(self, encoding=None): + return self._text + + +class TestDeserialization(unittest.TestCase): + + # https://github.com/microsoft/azure-devops-python-api/issues/268 + def test_deserialization_issue_268_51(self): + from azure.devops.v5_1.task_agent import models + self._test_deserialization(models.__dict__.items(), _268_type, _268_json) + + # https://github.com/microsoft/azure-devops-python-api/issues/268 + def test_deserialization_issue_268_60(self): + from azure.devops.v6_0.task_agent import models + self._test_deserialization(models.__dict__.items(), _268_type, _268_json) + + @staticmethod + def _test_deserialization(models, data_type, json): + client_models = {k: v for k, v in models if isinstance(v, type)} + deserializer = Deserializer(client_models) + response = _TestResponse(json) + task_agent_response = deserializer(data_type, response) + pprint.pprint(task_agent_response.__dict__) + + +if __name__ == '__main__': + unittest.main() + +_268_type = 'TaskAgentReference' +_268_json = '{"id":0,"name":null,"version":null,"osDescription":"Foo","provisioningState":null}' diff --git a/azure-devops/azure/devops/released/__init__.py b/azure-devops/azure/devops/released/__init__.py new file mode 100644 index 00000000..f885a96e --- /dev/null +++ b/azure-devops/azure/devops/released/__init__.py @@ -0,0 +1,7 @@ +# -------------------------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------------------------- diff --git a/azure-devops/azure/devops/released/accounts/__init__.py b/azure-devops/azure/devops/released/accounts/__init__.py new file mode 100644 index 00000000..fdc7c5d3 --- /dev/null +++ b/azure-devops/azure/devops/released/accounts/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.accounts.models import * +from .accounts_client import AccountsClient + +__all__ = [ + 'Account', + 'AccountCreateInfoInternal', + 'AccountPreferencesInternal', + 'AccountsClient' +] diff --git a/azure-devops/azure/devops/released/accounts/accounts_client.py b/azure-devops/azure/devops/released/accounts/accounts_client.py new file mode 100644 index 00000000..8376bf68 --- /dev/null +++ b/azure-devops/azure/devops/released/accounts/accounts_client.py @@ -0,0 +1,48 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.accounts import models + + +class AccountsClient(Client): + """Accounts + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(AccountsClient, 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 = '0d55247a-1c47-4462-9b1f-5e2125590ee6' + + def get_accounts(self, owner_id=None, member_id=None, properties=None): + """GetAccounts. + Get a list of accounts for a specific owner or a specific member. + :param str owner_id: ID for the owner of the accounts. + :param str member_id: ID for a member of the accounts. + :param str properties: + :rtype: [Account] + """ + query_parameters = {} + if owner_id is not None: + query_parameters['ownerId'] = self._serialize.query('owner_id', owner_id, 'str') + if member_id is not None: + query_parameters['memberId'] = self._serialize.query('member_id', member_id, 'str') + if properties is not None: + query_parameters['properties'] = self._serialize.query('properties', properties, 'str') + response = self._send(http_method='GET', + location_id='229a6a53-b428-4ffb-a835-e8f36b5b4b1e', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[Account]', self._unwrap_collection(response)) + diff --git a/azure-devops/azure/devops/released/build/__init__.py b/azure-devops/azure/devops/released/build/__init__.py new file mode 100644 index 00000000..c1f92f41 --- /dev/null +++ b/azure-devops/azure/devops/released/build/__init__.py @@ -0,0 +1,90 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.build.models import * +from .build_client import BuildClient + +__all__ = [ + 'AgentPoolQueue', + 'AgentSpecification', + 'AggregatedResultsAnalysis', + 'AggregatedResultsByOutcome', + 'AggregatedResultsDifference', + 'AggregatedRunsByOutcome', + 'AggregatedRunsByState', + 'ArtifactResource', + 'AssociatedWorkItem', + 'Attachment', + 'AuthorizationHeader', + 'Build', + 'BuildArtifact', + 'BuildBadge', + 'BuildController', + 'BuildDefinition', + 'BuildDefinition3_2', + 'BuildDefinitionReference', + 'BuildDefinitionReference3_2', + 'BuildDefinitionRevision', + 'BuildDefinitionStep', + 'BuildDefinitionTemplate', + 'BuildDefinitionTemplate3_2', + 'BuildDefinitionVariable', + 'BuildLog', + 'BuildLogReference', + 'BuildMetric', + 'BuildOption', + 'BuildOptionDefinition', + 'BuildOptionDefinitionReference', + 'BuildOptionGroupDefinition', + 'BuildOptionInputDefinition', + 'BuildReportMetadata', + 'BuildRepository', + 'BuildRequestValidationResult', + 'BuildResourceUsage', + 'BuildSettings', + 'Change', + 'DataSourceBindingBase', + 'DefinitionReference', + 'DefinitionResourceReference', + 'Deployment', + 'Folder', + 'GraphSubjectBase', + 'IdentityRef', + 'Issue', + 'JsonPatchOperation', + 'ProcessParameters', + 'PullRequest', + 'ReferenceLinks', + 'ReleaseReference', + 'RepositoryWebhook', + 'ResourceRef', + 'RetentionPolicy', + 'SourceProviderAttributes', + 'SourceRepositories', + 'SourceRepository', + 'SourceRepositoryItem', + 'SupportedTrigger', + 'TaskAgentPoolReference', + 'TaskDefinitionReference', + 'TaskInputDefinitionBase', + 'TaskInputValidation', + 'TaskOrchestrationPlanReference', + 'TaskReference', + 'TaskSourceDefinitionBase', + 'TeamProjectReference', + 'TestResultsContext', + 'Timeline', + 'TimelineAttempt', + 'TimelineRecord', + 'TimelineReference', + 'VariableGroup', + 'VariableGroupReference', + 'WebApiConnectedServiceRef', + 'XamlBuildControllerReference', + 'BuildClient' +] diff --git a/azure-devops/azure/devops/released/build/build_client.py b/azure-devops/azure/devops/released/build/build_client.py new file mode 100644 index 00000000..1c2e98b8 --- /dev/null +++ b/azure-devops/azure/devops/released/build/build_client.py @@ -0,0 +1,1090 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.build import models + + +class BuildClient(Client): + """Build + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(BuildClient, 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 = '965220d5-5bb9-42cf-8d67-9b146df2a5a4' + + def create_artifact(self, artifact, project, build_id): + """CreateArtifact. + Associates an artifact with a build. + :param :class:` ` artifact: The artifact. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + content = self._serialize.body(artifact, 'BuildArtifact') + response = self._send(http_method='POST', + location_id='1db06c96-014e-44e1-ac91-90b2d4b3e984', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('BuildArtifact', response) + + def get_artifact(self, project, build_id, artifact_name): + """GetArtifact. + Gets a specific artifact for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str artifact_name: The name of the artifact. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if artifact_name is not None: + query_parameters['artifactName'] = self._serialize.query('artifact_name', artifact_name, 'str') + response = self._send(http_method='GET', + location_id='1db06c96-014e-44e1-ac91-90b2d4b3e984', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('BuildArtifact', response) + + def get_artifact_content_zip(self, project, build_id, artifact_name, **kwargs): + """GetArtifactContentZip. + Gets a specific artifact for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str artifact_name: The name of the artifact. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if artifact_name is not None: + query_parameters['artifactName'] = self._serialize.query('artifact_name', artifact_name, 'str') + response = self._send(http_method='GET', + location_id='1db06c96-014e-44e1-ac91-90b2d4b3e984', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_artifacts(self, project, build_id): + """GetArtifacts. + Gets all artifacts for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :rtype: [BuildArtifact] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + response = self._send(http_method='GET', + location_id='1db06c96-014e-44e1-ac91-90b2d4b3e984', + version='5.1', + route_values=route_values) + return self._deserialize('[BuildArtifact]', self._unwrap_collection(response)) + + def get_file(self, project, build_id, artifact_name, file_id, file_name, **kwargs): + """GetFile. + Gets a file from the build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str artifact_name: The name of the artifact. + :param str file_id: The primary key for the file. + :param str file_name: The name that the file will be set to. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if artifact_name is not None: + query_parameters['artifactName'] = self._serialize.query('artifact_name', artifact_name, 'str') + if file_id is not None: + query_parameters['fileId'] = self._serialize.query('file_id', file_id, 'str') + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + response = self._send(http_method='GET', + location_id='1db06c96-014e-44e1-ac91-90b2d4b3e984', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def delete_build(self, project, build_id): + """DeleteBuild. + Deletes a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + self._send(http_method='DELETE', + location_id='0cd358e1-9217-4d94-8269-1c1ee6f93dcf', + version='5.1', + route_values=route_values) + + def get_build(self, project, build_id, property_filters=None): + """GetBuild. + Gets a build + :param str project: Project ID or project name + :param int build_id: + :param str property_filters: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if property_filters is not None: + query_parameters['propertyFilters'] = self._serialize.query('property_filters', property_filters, 'str') + response = self._send(http_method='GET', + location_id='0cd358e1-9217-4d94-8269-1c1ee6f93dcf', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('Build', response) + + def get_builds(self, project, definitions=None, queues=None, build_number=None, min_time=None, max_time=None, requested_for=None, reason_filter=None, status_filter=None, result_filter=None, tag_filters=None, properties=None, top=None, continuation_token=None, max_builds_per_definition=None, deleted_filter=None, query_order=None, branch_name=None, build_ids=None, repository_id=None, repository_type=None): + """GetBuilds. + Gets a list of builds. + :param str project: Project ID or project name + :param [int] definitions: A comma-delimited list of definition IDs. If specified, filters to builds for these definitions. + :param [int] queues: A comma-delimited list of queue IDs. If specified, filters to builds that ran against these queues. + :param str build_number: If specified, filters to builds that match this build number. Append * to do a prefix search. + :param datetime min_time: If specified, filters to builds that finished/started/queued after this date based on the queryOrder specified. + :param datetime max_time: If specified, filters to builds that finished/started/queued before this date based on the queryOrder specified. + :param str requested_for: If specified, filters to builds requested for the specified user. + :param str reason_filter: If specified, filters to builds that match this reason. + :param str status_filter: If specified, filters to builds that match this status. + :param str result_filter: If specified, filters to builds that match this result. + :param [str] tag_filters: A comma-delimited list of tags. If specified, filters to builds that have the specified tags. + :param [str] properties: A comma-delimited list of properties to retrieve. + :param int top: The maximum number of builds to return. + :param str continuation_token: A continuation token, returned by a previous call to this method, that can be used to return the next set of builds. + :param int max_builds_per_definition: The maximum number of builds to return per definition. + :param str deleted_filter: Indicates whether to exclude, include, or only return deleted builds. + :param str query_order: The order in which builds should be returned. + :param str branch_name: If specified, filters to builds that built branches that built this branch. + :param [int] build_ids: A comma-delimited list that specifies the IDs of builds to retrieve. + :param str repository_id: If specified, filters to builds that built from this repository. + :param str repository_type: If specified, filters to builds that built from repositories of this type. + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if definitions is not None: + definitions = ",".join(map(str, definitions)) + query_parameters['definitions'] = self._serialize.query('definitions', definitions, 'str') + if queues is not None: + queues = ",".join(map(str, queues)) + query_parameters['queues'] = self._serialize.query('queues', queues, 'str') + if build_number is not None: + query_parameters['buildNumber'] = self._serialize.query('build_number', build_number, 'str') + if min_time is not None: + query_parameters['minTime'] = self._serialize.query('min_time', min_time, 'iso-8601') + if max_time is not None: + query_parameters['maxTime'] = self._serialize.query('max_time', max_time, 'iso-8601') + if requested_for is not None: + query_parameters['requestedFor'] = self._serialize.query('requested_for', requested_for, 'str') + if reason_filter is not None: + query_parameters['reasonFilter'] = self._serialize.query('reason_filter', reason_filter, 'str') + if status_filter is not None: + query_parameters['statusFilter'] = self._serialize.query('status_filter', status_filter, 'str') + if result_filter is not None: + query_parameters['resultFilter'] = self._serialize.query('result_filter', result_filter, 'str') + if tag_filters is not None: + tag_filters = ",".join(tag_filters) + query_parameters['tagFilters'] = self._serialize.query('tag_filters', tag_filters, 'str') + if properties is not None: + properties = ",".join(properties) + query_parameters['properties'] = self._serialize.query('properties', properties, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if max_builds_per_definition is not None: + query_parameters['maxBuildsPerDefinition'] = self._serialize.query('max_builds_per_definition', max_builds_per_definition, 'int') + if deleted_filter is not None: + query_parameters['deletedFilter'] = self._serialize.query('deleted_filter', deleted_filter, 'str') + if query_order is not None: + query_parameters['queryOrder'] = self._serialize.query('query_order', query_order, 'str') + if branch_name is not None: + query_parameters['branchName'] = self._serialize.query('branch_name', branch_name, 'str') + if build_ids is not None: + build_ids = ",".join(map(str, build_ids)) + query_parameters['buildIds'] = self._serialize.query('build_ids', build_ids, 'str') + if repository_id is not None: + query_parameters['repositoryId'] = self._serialize.query('repository_id', repository_id, 'str') + if repository_type is not None: + query_parameters['repositoryType'] = self._serialize.query('repository_type', repository_type, 'str') + response = self._send(http_method='GET', + location_id='0cd358e1-9217-4d94-8269-1c1ee6f93dcf', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[Build]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetBuildsResponseValue(response_value, continuation_token) + + class GetBuildsResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_builds method + + :param value: + :type value: :class:`<[Build]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def queue_build(self, build, project, ignore_warnings=None, check_in_ticket=None, source_build_id=None): + """QueueBuild. + Queues a build + :param :class:` ` build: + :param str project: Project ID or project name + :param bool ignore_warnings: + :param str check_in_ticket: + :param int source_build_id: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if ignore_warnings is not None: + query_parameters['ignoreWarnings'] = self._serialize.query('ignore_warnings', ignore_warnings, 'bool') + if check_in_ticket is not None: + query_parameters['checkInTicket'] = self._serialize.query('check_in_ticket', check_in_ticket, 'str') + if source_build_id is not None: + query_parameters['sourceBuildId'] = self._serialize.query('source_build_id', source_build_id, 'int') + content = self._serialize.body(build, 'Build') + response = self._send(http_method='POST', + location_id='0cd358e1-9217-4d94-8269-1c1ee6f93dcf', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('Build', response) + + def update_build(self, build, project, build_id, retry=None): + """UpdateBuild. + Updates a build. + :param :class:` ` build: The build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param bool retry: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if retry is not None: + query_parameters['retry'] = self._serialize.query('retry', retry, 'bool') + content = self._serialize.body(build, 'Build') + response = self._send(http_method='PATCH', + location_id='0cd358e1-9217-4d94-8269-1c1ee6f93dcf', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('Build', response) + + def update_builds(self, builds, project): + """UpdateBuilds. + Updates multiple builds. + :param [Build] builds: The builds to update. + :param str project: Project ID or project name + :rtype: [Build] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(builds, '[Build]') + response = self._send(http_method='PATCH', + location_id='0cd358e1-9217-4d94-8269-1c1ee6f93dcf', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[Build]', self._unwrap_collection(response)) + + def get_build_changes(self, project, build_id, continuation_token=None, top=None, include_source_change=None): + """GetBuildChanges. + Gets the changes associated with a build + :param str project: Project ID or project name + :param int build_id: + :param str continuation_token: + :param int top: The maximum number of changes to return + :param bool include_source_change: + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if include_source_change is not None: + query_parameters['includeSourceChange'] = self._serialize.query('include_source_change', include_source_change, 'bool') + response = self._send(http_method='GET', + location_id='54572c7b-bbd3-45d4-80dc-28be08941620', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[Change]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetBuildChangesResponseValue(response_value, continuation_token) + + class GetBuildChangesResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_build_changes method + + :param value: + :type value: :class:`<[Change]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def get_build_controller(self, controller_id): + """GetBuildController. + Gets a controller + :param int controller_id: + :rtype: :class:` ` + """ + route_values = {} + if controller_id is not None: + route_values['controllerId'] = self._serialize.url('controller_id', controller_id, 'int') + response = self._send(http_method='GET', + location_id='fcac1932-2ee1-437f-9b6f-7f696be858f6', + version='5.1', + route_values=route_values) + return self._deserialize('BuildController', response) + + def get_build_controllers(self, name=None): + """GetBuildControllers. + Gets controller, optionally filtered by name + :param str name: + :rtype: [BuildController] + """ + query_parameters = {} + if name is not None: + query_parameters['name'] = self._serialize.query('name', name, 'str') + response = self._send(http_method='GET', + location_id='fcac1932-2ee1-437f-9b6f-7f696be858f6', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[BuildController]', self._unwrap_collection(response)) + + def create_definition(self, definition, project, definition_to_clone_id=None, definition_to_clone_revision=None): + """CreateDefinition. + Creates a new definition. + :param :class:` ` definition: The definition. + :param str project: Project ID or project name + :param int definition_to_clone_id: + :param int definition_to_clone_revision: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if definition_to_clone_id is not None: + query_parameters['definitionToCloneId'] = self._serialize.query('definition_to_clone_id', definition_to_clone_id, 'int') + if definition_to_clone_revision is not None: + query_parameters['definitionToCloneRevision'] = self._serialize.query('definition_to_clone_revision', definition_to_clone_revision, 'int') + content = self._serialize.body(definition, 'BuildDefinition') + response = self._send(http_method='POST', + location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('BuildDefinition', response) + + def delete_definition(self, project, definition_id): + """DeleteDefinition. + Deletes a definition and all associated builds. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + self._send(http_method='DELETE', + location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', + version='5.1', + route_values=route_values) + + def get_definition(self, project, definition_id, revision=None, min_metrics_time=None, property_filters=None, include_latest_builds=None): + """GetDefinition. + Gets a definition, optionally at a specific revision. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + :param int revision: The revision number to retrieve. If this is not specified, the latest version will be returned. + :param datetime min_metrics_time: If specified, indicates the date from which metrics should be included. + :param [str] property_filters: A comma-delimited list of properties to include in the results. + :param bool include_latest_builds: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + query_parameters = {} + if revision is not None: + query_parameters['revision'] = self._serialize.query('revision', revision, 'int') + if min_metrics_time is not None: + query_parameters['minMetricsTime'] = self._serialize.query('min_metrics_time', min_metrics_time, 'iso-8601') + if property_filters is not None: + property_filters = ",".join(property_filters) + query_parameters['propertyFilters'] = self._serialize.query('property_filters', property_filters, 'str') + if include_latest_builds is not None: + query_parameters['includeLatestBuilds'] = self._serialize.query('include_latest_builds', include_latest_builds, 'bool') + response = self._send(http_method='GET', + location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('BuildDefinition', response) + + def get_definitions(self, project, name=None, repository_id=None, repository_type=None, query_order=None, top=None, continuation_token=None, min_metrics_time=None, definition_ids=None, path=None, built_after=None, not_built_after=None, include_all_properties=None, include_latest_builds=None, task_id_filter=None, process_type=None, yaml_filename=None): + """GetDefinitions. + Gets a list of definitions. + :param str project: Project ID or project name + :param str name: If specified, filters to definitions whose names match this pattern. + :param str repository_id: A repository ID. If specified, filters to definitions that use this repository. + :param str repository_type: If specified, filters to definitions that have a repository of this type. + :param str query_order: Indicates the order in which definitions should be returned. + :param int top: The maximum number of definitions to return. + :param str continuation_token: A continuation token, returned by a previous call to this method, that can be used to return the next set of definitions. + :param datetime min_metrics_time: If specified, indicates the date from which metrics should be included. + :param [int] definition_ids: A comma-delimited list that specifies the IDs of definitions to retrieve. + :param str path: If specified, filters to definitions under this folder. + :param datetime built_after: If specified, filters to definitions that have builds after this date. + :param datetime not_built_after: If specified, filters to definitions that do not have builds after this date. + :param bool include_all_properties: Indicates whether the full definitions should be returned. By default, shallow representations of the definitions are returned. + :param bool include_latest_builds: Indicates whether to return the latest and latest completed builds for this definition. + :param str task_id_filter: If specified, filters to definitions that use the specified task. + :param int process_type: If specified, filters to definitions with the given process type. + :param str yaml_filename: If specified, filters to YAML definitions that match the given filename. + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if name is not None: + query_parameters['name'] = self._serialize.query('name', name, 'str') + if repository_id is not None: + query_parameters['repositoryId'] = self._serialize.query('repository_id', repository_id, 'str') + if repository_type is not None: + query_parameters['repositoryType'] = self._serialize.query('repository_type', repository_type, 'str') + if query_order is not None: + query_parameters['queryOrder'] = self._serialize.query('query_order', query_order, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if min_metrics_time is not None: + query_parameters['minMetricsTime'] = self._serialize.query('min_metrics_time', min_metrics_time, 'iso-8601') + if definition_ids is not None: + definition_ids = ",".join(map(str, definition_ids)) + query_parameters['definitionIds'] = self._serialize.query('definition_ids', definition_ids, 'str') + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if built_after is not None: + query_parameters['builtAfter'] = self._serialize.query('built_after', built_after, 'iso-8601') + if not_built_after is not None: + query_parameters['notBuiltAfter'] = self._serialize.query('not_built_after', not_built_after, 'iso-8601') + if include_all_properties is not None: + query_parameters['includeAllProperties'] = self._serialize.query('include_all_properties', include_all_properties, 'bool') + if include_latest_builds is not None: + query_parameters['includeLatestBuilds'] = self._serialize.query('include_latest_builds', include_latest_builds, 'bool') + if task_id_filter is not None: + query_parameters['taskIdFilter'] = self._serialize.query('task_id_filter', task_id_filter, 'str') + if process_type is not None: + query_parameters['processType'] = self._serialize.query('process_type', process_type, 'int') + if yaml_filename is not None: + query_parameters['yamlFilename'] = self._serialize.query('yaml_filename', yaml_filename, 'str') + response = self._send(http_method='GET', + location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[BuildDefinitionReference]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetDefinitionsResponseValue(response_value, continuation_token) + + class GetDefinitionsResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_definitions method + + :param value: + :type value: :class:`<[BuildDefinitionReference]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def restore_definition(self, project, definition_id, deleted): + """RestoreDefinition. + Restores a deleted definition + :param str project: Project ID or project name + :param int definition_id: The identifier of the definition to restore. + :param bool deleted: When false, restores a deleted definition. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + query_parameters = {} + if deleted is not None: + query_parameters['deleted'] = self._serialize.query('deleted', deleted, 'bool') + response = self._send(http_method='PATCH', + location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('BuildDefinition', response) + + def update_definition(self, definition, project, definition_id, secrets_source_definition_id=None, secrets_source_definition_revision=None): + """UpdateDefinition. + Updates an existing definition. + :param :class:` ` definition: The new version of the definition. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + :param int secrets_source_definition_id: + :param int secrets_source_definition_revision: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + query_parameters = {} + if secrets_source_definition_id is not None: + query_parameters['secretsSourceDefinitionId'] = self._serialize.query('secrets_source_definition_id', secrets_source_definition_id, 'int') + if secrets_source_definition_revision is not None: + query_parameters['secretsSourceDefinitionRevision'] = self._serialize.query('secrets_source_definition_revision', secrets_source_definition_revision, 'int') + content = self._serialize.body(definition, 'BuildDefinition') + response = self._send(http_method='PUT', + location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('BuildDefinition', response) + + def get_build_log(self, project, build_id, log_id, start_line=None, end_line=None, **kwargs): + """GetBuildLog. + Gets an individual log file for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param int log_id: The ID of the log file. + :param long start_line: The start line. + :param long end_line: The end line. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if log_id is not None: + route_values['logId'] = self._serialize.url('log_id', log_id, 'int') + query_parameters = {} + if start_line is not None: + query_parameters['startLine'] = self._serialize.query('start_line', start_line, 'long') + if end_line is not None: + query_parameters['endLine'] = self._serialize.query('end_line', end_line, 'long') + response = self._send(http_method='GET', + location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_build_log_lines(self, project, build_id, log_id, start_line=None, end_line=None): + """GetBuildLogLines. + Gets an individual log file for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param int log_id: The ID of the log file. + :param long start_line: The start line. + :param long end_line: The end line. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if log_id is not None: + route_values['logId'] = self._serialize.url('log_id', log_id, 'int') + query_parameters = {} + if start_line is not None: + query_parameters['startLine'] = self._serialize.query('start_line', start_line, 'long') + if end_line is not None: + query_parameters['endLine'] = self._serialize.query('end_line', end_line, 'long') + response = self._send(http_method='GET', + location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def get_build_logs(self, project, build_id): + """GetBuildLogs. + Gets the logs for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :rtype: [BuildLog] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + response = self._send(http_method='GET', + location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', + version='5.1', + route_values=route_values) + return self._deserialize('[BuildLog]', self._unwrap_collection(response)) + + def get_build_logs_zip(self, project, build_id, **kwargs): + """GetBuildLogsZip. + Gets the logs for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + response = self._send(http_method='GET', + location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', + version='5.1', + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_build_log_zip(self, project, build_id, log_id, start_line=None, end_line=None, **kwargs): + """GetBuildLogZip. + Gets an individual log file for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param int log_id: The ID of the log file. + :param long start_line: The start line. + :param long end_line: The end line. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if log_id is not None: + route_values['logId'] = self._serialize.url('log_id', log_id, 'int') + query_parameters = {} + if start_line is not None: + query_parameters['startLine'] = self._serialize.query('start_line', start_line, 'long') + if end_line is not None: + query_parameters['endLine'] = self._serialize.query('end_line', end_line, 'long') + response = self._send(http_method='GET', + location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_build_option_definitions(self, project=None): + """GetBuildOptionDefinitions. + Gets all build definition options supported by the system. + :param str project: Project ID or project name + :rtype: [BuildOptionDefinition] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='591cb5a4-2d46-4f3a-a697-5cd42b6bd332', + version='5.1', + route_values=route_values) + return self._deserialize('[BuildOptionDefinition]', self._unwrap_collection(response)) + + def get_definition_revisions(self, project, definition_id): + """GetDefinitionRevisions. + Gets all revisions of a definition. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + :rtype: [BuildDefinitionRevision] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + response = self._send(http_method='GET', + location_id='7c116775-52e5-453e-8c5d-914d9762d8c4', + version='5.1', + route_values=route_values) + return self._deserialize('[BuildDefinitionRevision]', self._unwrap_collection(response)) + + def get_build_settings(self, project=None): + """GetBuildSettings. + Gets the build settings. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d', + version='5.1', + route_values=route_values) + return self._deserialize('BuildSettings', response) + + def update_build_settings(self, settings, project=None): + """UpdateBuildSettings. + Updates the build settings. + :param :class:` ` settings: The new settings. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(settings, 'BuildSettings') + response = self._send(http_method='PATCH', + location_id='aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('BuildSettings', response) + + def add_build_tag(self, project, build_id, tag): + """AddBuildTag. + Adds a tag to a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str tag: The tag to add. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if tag is not None: + route_values['tag'] = self._serialize.url('tag', tag, 'str') + response = self._send(http_method='PUT', + location_id='6e6114b2-8161-44c8-8f6c-c5505782427f', + version='5.1', + route_values=route_values) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def add_build_tags(self, tags, project, build_id): + """AddBuildTags. + Adds tags to a build. + :param [str] tags: The tags to add. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + content = self._serialize.body(tags, '[str]') + response = self._send(http_method='POST', + location_id='6e6114b2-8161-44c8-8f6c-c5505782427f', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def delete_build_tag(self, project, build_id, tag): + """DeleteBuildTag. + Removes a tag from a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str tag: The tag to remove. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if tag is not None: + route_values['tag'] = self._serialize.url('tag', tag, 'str') + response = self._send(http_method='DELETE', + location_id='6e6114b2-8161-44c8-8f6c-c5505782427f', + version='5.1', + route_values=route_values) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def get_build_tags(self, project, build_id): + """GetBuildTags. + Gets the tags for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + response = self._send(http_method='GET', + location_id='6e6114b2-8161-44c8-8f6c-c5505782427f', + version='5.1', + route_values=route_values) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def get_tags(self, project): + """GetTags. + Gets a list of all build and definition tags in the project. + :param str project: Project ID or project name + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='d84ac5c6-edc7-43d5-adc9-1b34be5dea09', + version='5.1', + route_values=route_values) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def delete_template(self, project, template_id): + """DeleteTemplate. + Deletes a build definition template. + :param str project: Project ID or project name + :param str template_id: The ID of the template. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if template_id is not None: + route_values['templateId'] = self._serialize.url('template_id', template_id, 'str') + self._send(http_method='DELETE', + location_id='e884571e-7f92-4d6a-9274-3f5649900835', + version='5.1', + route_values=route_values) + + def get_template(self, project, template_id): + """GetTemplate. + Gets a specific build definition template. + :param str project: Project ID or project name + :param str template_id: The ID of the requested template. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if template_id is not None: + route_values['templateId'] = self._serialize.url('template_id', template_id, 'str') + response = self._send(http_method='GET', + location_id='e884571e-7f92-4d6a-9274-3f5649900835', + version='5.1', + route_values=route_values) + return self._deserialize('BuildDefinitionTemplate', response) + + def get_templates(self, project): + """GetTemplates. + Gets all definition templates. + :param str project: Project ID or project name + :rtype: [BuildDefinitionTemplate] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='e884571e-7f92-4d6a-9274-3f5649900835', + version='5.1', + route_values=route_values) + return self._deserialize('[BuildDefinitionTemplate]', self._unwrap_collection(response)) + + def save_template(self, template, project, template_id): + """SaveTemplate. + Updates an existing build definition template. + :param :class:` ` template: The new version of the template. + :param str project: Project ID or project name + :param str template_id: The ID of the template. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if template_id is not None: + route_values['templateId'] = self._serialize.url('template_id', template_id, 'str') + content = self._serialize.body(template, 'BuildDefinitionTemplate') + response = self._send(http_method='PUT', + location_id='e884571e-7f92-4d6a-9274-3f5649900835', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('BuildDefinitionTemplate', response) + + def get_build_timeline(self, project, build_id, timeline_id=None, change_id=None, plan_id=None): + """GetBuildTimeline. + Gets details for a build + :param str project: Project ID or project name + :param int build_id: + :param str timeline_id: + :param int change_id: + :param str plan_id: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if timeline_id is not None: + route_values['timelineId'] = self._serialize.url('timeline_id', timeline_id, 'str') + query_parameters = {} + if change_id is not None: + query_parameters['changeId'] = self._serialize.query('change_id', change_id, 'int') + if plan_id is not None: + query_parameters['planId'] = self._serialize.query('plan_id', plan_id, 'str') + response = self._send(http_method='GET', + location_id='8baac422-4c6e-4de5-8532-db96d92acffa', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('Timeline', response) + + def get_build_work_items_refs(self, project, build_id, top=None): + """GetBuildWorkItemsRefs. + Gets the work items associated with a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param int top: The maximum number of work items to return. + :rtype: [ResourceRef] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + response = self._send(http_method='GET', + location_id='5a21f5d2-5642-47e4-a0bd-1356e6731bee', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[ResourceRef]', self._unwrap_collection(response)) + + def get_build_work_items_refs_from_commits(self, commit_ids, project, build_id, top=None): + """GetBuildWorkItemsRefsFromCommits. + Gets the work items associated with a build, filtered to specific commits. + :param [str] commit_ids: A comma-delimited list of commit IDs. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param int top: The maximum number of work items to return, or the number of commits to consider if no commit IDs are specified. + :rtype: [ResourceRef] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + content = self._serialize.body(commit_ids, '[str]') + response = self._send(http_method='POST', + location_id='5a21f5d2-5642-47e4-a0bd-1356e6731bee', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('[ResourceRef]', self._unwrap_collection(response)) + diff --git a/azure-devops/azure/devops/released/client_factory.py b/azure-devops/azure/devops/released/client_factory.py new file mode 100644 index 00000000..3940d35b --- /dev/null +++ b/azure-devops/azure/devops/released/client_factory.py @@ -0,0 +1,171 @@ +# -------------------------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------------------------- + + +class ClientFactory(object): + """ClientFactory. + A factory class to get the 5.1 released clients. + """ + + def __init__(self, connection): + self._connection = connection + + def get_accounts_client(self): + """get_accounts_client. + Gets the 5.1 version of the AccountsClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.accounts.accounts_client.AccountsClient') + + def get_build_client(self): + """get_build_client. + Gets the 5.1 version of the BuildClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.build.build_client.BuildClient') + + def get_cloud_load_test_client(self): + """get_cloud_load_test_client. + Gets the 5.1 version of the CloudLoadTestClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.cloud_load_test.cloud_load_test_client.CloudLoadTestClient') + + def get_core_client(self): + """get_core_client. + Gets the 5.1 version of the CoreClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.core.core_client.CoreClient') + + def get_git_client(self): + """get_git_client. + Gets the 5.1 version of the GitClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.git.git_client.GitClient') + + def get_identity_client(self): + """get_identity_client. + Gets the 5.1 version of the IdentityClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.identity.identity_client.IdentityClient') + + def get_notification_client(self): + """get_notification_client. + Gets the 5.1 version of the NotificationClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.notification.notification_client.NotificationClient') + + def get_operations_client(self): + """get_operations_client. + Gets the 5.1 version of the OperationsClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.operations.operations_client.OperationsClient') + + def get_policy_client(self): + """get_policy_client. + Gets the 5.1 version of the PolicyClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.policy.policy_client.PolicyClient') + + def get_profile_client(self): + """get_profile_client. + Gets the 5.1 version of the ProfileClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.profile.profile_client.ProfileClient') + + def get_release_client(self): + """get_release_client. + Gets the 5.1 version of the ReleaseClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.release.release_client.ReleaseClient') + + def get_security_client(self): + """get_security_client. + Gets the 5.1 version of the SecurityClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.security.security_client.SecurityClient') + + def get_service_hooks_client(self): + """get_service_hooks_client. + Gets the 5.1 version of the ServiceHooksClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.service_hooks.service_hooks_client.ServiceHooksClient') + + def get_task_client(self): + """get_task_client. + Gets the 5.1 version of the TaskClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.task.task_client.TaskClient') + + def get_task_agent_client(self): + """get_task_agent_client. + Gets the 5.1 version of the TaskAgentClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.task_agent.task_agent_client.TaskAgentClient') + + def get_test_client(self): + """get_test_client. + Gets the 5.1 version of the TestClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.test.test_client.TestClient') + + def get_test_plan_client(self): + """get_test_plan_client. + Gets the 5.1 version of the TestPlanClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.test_plan.test_plan_client.TestPlanClient') + + def get_test_results_client(self): + """get_test_results_client. + Gets the 5.1 version of the TestResultsClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.test_results.test_results_client.TestResultsClient') + + def get_tfvc_client(self): + """get_tfvc_client. + Gets the 5.1 version of the TfvcClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.tfvc.tfvc_client.TfvcClient') + + def get_wiki_client(self): + """get_wiki_client. + Gets the 5.1 version of the WikiClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.wiki.wiki_client.WikiClient') + + def get_work_client(self): + """get_work_client. + Gets the 5.1 version of the WorkClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.work.work_client.WorkClient') + + def get_work_item_tracking_client(self): + """get_work_item_tracking_client. + Gets the 5.1 version of the WorkItemTrackingClient + :rtype: :class:` ` + """ + return self._connection.get_client('azure.devops.released.work_item_tracking.work_item_tracking_client.WorkItemTrackingClient') + diff --git a/azure-devops/azure/devops/released/cloud_load_test/__init__.py b/azure-devops/azure/devops/released/cloud_load_test/__init__.py new file mode 100644 index 00000000..0f19b61e --- /dev/null +++ b/azure-devops/azure/devops/released/cloud_load_test/__init__.py @@ -0,0 +1,65 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.cloud_load_test.models import * +from .cloud_load_test_client import CloudLoadTestClient + +__all__ = [ + 'AgentGroup', + 'AgentGroupAccessData', + 'Application', + 'ApplicationCounters', + 'ApplicationType', + 'BrowserMix', + 'CltCustomerIntelligenceData', + 'CounterGroup', + 'CounterInstanceSamples', + 'CounterSample', + 'CounterSampleQueryDetails', + 'CounterSamplesResult', + 'Diagnostics', + 'DropAccessData', + 'ErrorDetails', + 'GraphSubjectBase', + 'IdentityRef', + 'LoadGenerationGeoLocation', + 'LoadTest', + 'LoadTestDefinition', + 'LoadTestErrors', + 'LoadTestRunDetails', + 'LoadTestRunSettings', + 'OverridableRunSettings', + 'PageSummary', + 'ReferenceLinks', + 'RequestSummary', + 'ScenarioSummary', + 'StaticAgentRunSetting', + 'SubType', + 'SummaryPercentileData', + 'TenantDetails', + 'TestDefinition', + 'TestDefinitionBasic', + 'TestDrop', + 'TestDropRef', + 'TestResults', + 'TestResultsSummary', + 'TestRun', + 'TestRunAbortMessage', + 'TestRunBasic', + 'TestRunCounterInstance', + 'TestRunMessage', + 'TestSettings', + 'TestSummary', + 'TransactionSummary', + 'WebApiLoadTestMachineInput', + 'WebApiSetupParamaters', + 'WebApiTestMachine', + 'WebApiUserLoadTestMachineInput', + 'WebInstanceSummaryData', + 'CloudLoadTestClient' +] diff --git a/azure-devops/azure/devops/released/cloud_load_test/cloud_load_test_client.py b/azure-devops/azure/devops/released/cloud_load_test/cloud_load_test_client.py new file mode 100644 index 00000000..d1554263 --- /dev/null +++ b/azure-devops/azure/devops/released/cloud_load_test/cloud_load_test_client.py @@ -0,0 +1,432 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.cloud_load_test import models + + +class CloudLoadTestClient(Client): + """CloudLoadTest + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(CloudLoadTestClient, 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 = '7ae6d0a6-cda5-44cf-a261-28c392bed25c' + + def create_agent_group(self, group): + """CreateAgentGroup. + :param :class:` ` group: Agent group to be created + :rtype: :class:` ` + """ + content = self._serialize.body(group, 'AgentGroup') + response = self._send(http_method='POST', + location_id='ab8d91c1-12d9-4ec5-874d-1ddb23e17720', + version='5.1', + content=content) + return self._deserialize('AgentGroup', response) + + def get_agent_groups(self, agent_group_id=None, machine_setup_input=None, machine_access_data=None, outgoing_request_urls=None, agent_group_name=None): + """GetAgentGroups. + :param str agent_group_id: The agent group identifier + :param bool machine_setup_input: + :param bool machine_access_data: + :param bool outgoing_request_urls: + :param str agent_group_name: Name of the agent group + :rtype: object + """ + route_values = {} + if agent_group_id is not None: + route_values['agentGroupId'] = self._serialize.url('agent_group_id', agent_group_id, 'str') + query_parameters = {} + if machine_setup_input is not None: + query_parameters['machineSetupInput'] = self._serialize.query('machine_setup_input', machine_setup_input, 'bool') + if machine_access_data is not None: + query_parameters['machineAccessData'] = self._serialize.query('machine_access_data', machine_access_data, 'bool') + if outgoing_request_urls is not None: + query_parameters['outgoingRequestUrls'] = self._serialize.query('outgoing_request_urls', outgoing_request_urls, 'bool') + if agent_group_name is not None: + query_parameters['agentGroupName'] = self._serialize.query('agent_group_name', agent_group_name, 'str') + response = self._send(http_method='GET', + location_id='ab8d91c1-12d9-4ec5-874d-1ddb23e17720', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('object', response) + + def delete_static_agent(self, agent_group_id, agent_name): + """DeleteStaticAgent. + :param str agent_group_id: The agent group identifier + :param str agent_name: Name of the static agent + :rtype: str + """ + route_values = {} + if agent_group_id is not None: + route_values['agentGroupId'] = self._serialize.url('agent_group_id', agent_group_id, 'str') + query_parameters = {} + if agent_name is not None: + query_parameters['agentName'] = self._serialize.query('agent_name', agent_name, 'str') + response = self._send(http_method='DELETE', + location_id='87e4b63d-7142-4b50-801e-72ba9ff8ee9b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('str', response) + + def get_static_agents(self, agent_group_id, agent_name=None): + """GetStaticAgents. + :param str agent_group_id: The agent group identifier + :param str agent_name: Name of the static agent + :rtype: object + """ + route_values = {} + if agent_group_id is not None: + route_values['agentGroupId'] = self._serialize.url('agent_group_id', agent_group_id, 'str') + query_parameters = {} + if agent_name is not None: + query_parameters['agentName'] = self._serialize.query('agent_name', agent_name, 'str') + response = self._send(http_method='GET', + location_id='87e4b63d-7142-4b50-801e-72ba9ff8ee9b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('object', response) + + def get_application(self, application_id): + """GetApplication. + :param str application_id: Filter by APM application identifier. + :rtype: :class:` ` + """ + route_values = {} + if application_id is not None: + route_values['applicationId'] = self._serialize.url('application_id', application_id, 'str') + response = self._send(http_method='GET', + location_id='2c986dce-8e8d-4142-b541-d016d5aff764', + version='5.1', + route_values=route_values) + return self._deserialize('Application', response) + + def get_applications(self, type=None): + """GetApplications. + :param str type: Filters the results based on the plugin type. + :rtype: [Application] + """ + query_parameters = {} + if type is not None: + query_parameters['type'] = self._serialize.query('type', type, 'str') + response = self._send(http_method='GET', + location_id='2c986dce-8e8d-4142-b541-d016d5aff764', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[Application]', self._unwrap_collection(response)) + + def get_counters(self, test_run_id, group_names, include_summary=None): + """GetCounters. + :param str test_run_id: The test run identifier + :param str group_names: Comma separated names of counter groups, such as 'Application', 'Performance' and 'Throughput' + :param bool include_summary: + :rtype: [TestRunCounterInstance] + """ + route_values = {} + if test_run_id is not None: + route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') + query_parameters = {} + if group_names is not None: + query_parameters['groupNames'] = self._serialize.query('group_names', group_names, 'str') + if include_summary is not None: + query_parameters['includeSummary'] = self._serialize.query('include_summary', include_summary, 'bool') + response = self._send(http_method='GET', + location_id='29265ea4-b5a5-4b2e-b054-47f5f6f00183', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TestRunCounterInstance]', self._unwrap_collection(response)) + + def get_application_counters(self, application_id=None, plugintype=None): + """GetApplicationCounters. + :param str application_id: Filter by APM application identifier. + :param str plugintype: Currently ApplicationInsights is the only available plugin type. + :rtype: [ApplicationCounters] + """ + query_parameters = {} + if application_id is not None: + query_parameters['applicationId'] = self._serialize.query('application_id', application_id, 'str') + if plugintype is not None: + query_parameters['plugintype'] = self._serialize.query('plugintype', plugintype, 'str') + response = self._send(http_method='GET', + location_id='c1275ce9-6d26-4bc6-926b-b846502e812d', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[ApplicationCounters]', self._unwrap_collection(response)) + + def get_counter_samples(self, counter_sample_query_details, test_run_id): + """GetCounterSamples. + :param :class:` ` counter_sample_query_details: + :param str test_run_id: The test run identifier + :rtype: :class:` ` + """ + route_values = {} + if test_run_id is not None: + route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') + content = self._serialize.body(counter_sample_query_details, 'VssJsonCollectionWrapper') + response = self._send(http_method='POST', + location_id='bad18480-7193-4518-992a-37289c5bb92d', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('CounterSamplesResult', response) + + def get_load_test_run_errors(self, test_run_id, type=None, sub_type=None, detailed=None): + """GetLoadTestRunErrors. + :param str test_run_id: The test run identifier + :param str type: Filter for the particular type of errors. + :param str sub_type: Filter for a particular subtype of errors. You should not provide error subtype without error type. + :param bool detailed: To include the details of test errors such as messagetext, request, stacktrace, testcasename, scenarioname, and lasterrordate. + :rtype: :class:` ` + """ + route_values = {} + if test_run_id is not None: + route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') + query_parameters = {} + if type is not None: + query_parameters['type'] = self._serialize.query('type', type, 'str') + if sub_type is not None: + query_parameters['subType'] = self._serialize.query('sub_type', sub_type, 'str') + if detailed is not None: + query_parameters['detailed'] = self._serialize.query('detailed', detailed, 'bool') + response = self._send(http_method='GET', + location_id='b52025a7-3fb4-4283-8825-7079e75bd402', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('LoadTestErrors', response) + + def get_test_run_messages(self, test_run_id): + """GetTestRunMessages. + :param str test_run_id: Id of the test run + :rtype: [TestRunMessage] + """ + route_values = {} + if test_run_id is not None: + route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') + response = self._send(http_method='GET', + location_id='2e7ba122-f522-4205-845b-2d270e59850a', + version='5.1', + route_values=route_values) + return self._deserialize('[TestRunMessage]', self._unwrap_collection(response)) + + def get_plugin(self, type): + """GetPlugin. + :param str type: Currently ApplicationInsights is the only available plugin type. + :rtype: :class:` ` + """ + route_values = {} + if type is not None: + route_values['type'] = self._serialize.url('type', type, 'str') + response = self._send(http_method='GET', + location_id='7dcb0bb2-42d5-4729-9958-c0401d5e7693', + version='5.1', + route_values=route_values) + return self._deserialize('ApplicationType', response) + + def get_plugins(self): + """GetPlugins. + :rtype: [ApplicationType] + """ + response = self._send(http_method='GET', + location_id='7dcb0bb2-42d5-4729-9958-c0401d5e7693', + version='5.1') + return self._deserialize('[ApplicationType]', self._unwrap_collection(response)) + + def get_load_test_result(self, test_run_id): + """GetLoadTestResult. + :param str test_run_id: The test run identifier + :rtype: :class:` ` + """ + route_values = {} + if test_run_id is not None: + route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') + response = self._send(http_method='GET', + location_id='5ed69bd8-4557-4cec-9b75-1ad67d0c257b', + version='5.1', + route_values=route_values) + return self._deserialize('TestResults', response) + + def create_test_definition(self, test_definition): + """CreateTestDefinition. + :param :class:` ` test_definition: Test definition to be created + :rtype: :class:` ` + """ + content = self._serialize.body(test_definition, 'TestDefinition') + response = self._send(http_method='POST', + location_id='a8f9b135-f604-41ea-9d74-d9a5fd32fcd8', + version='5.1', + content=content) + return self._deserialize('TestDefinition', response) + + def get_test_definition(self, test_definition_id): + """GetTestDefinition. + :param str test_definition_id: The test definition identifier + :rtype: :class:` ` + """ + route_values = {} + if test_definition_id is not None: + route_values['testDefinitionId'] = self._serialize.url('test_definition_id', test_definition_id, 'str') + response = self._send(http_method='GET', + location_id='a8f9b135-f604-41ea-9d74-d9a5fd32fcd8', + version='5.1', + route_values=route_values) + return self._deserialize('TestDefinition', response) + + def get_test_definitions(self, from_date=None, to_date=None, top=None): + """GetTestDefinitions. + :param str from_date: Date after which test definitions were created + :param str to_date: Date before which test definitions were crated + :param int top: + :rtype: [TestDefinitionBasic] + """ + query_parameters = {} + if from_date is not None: + query_parameters['fromDate'] = self._serialize.query('from_date', from_date, 'str') + if to_date is not None: + query_parameters['toDate'] = self._serialize.query('to_date', to_date, 'str') + if top is not None: + query_parameters['top'] = self._serialize.query('top', top, 'int') + response = self._send(http_method='GET', + location_id='a8f9b135-f604-41ea-9d74-d9a5fd32fcd8', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[TestDefinitionBasic]', self._unwrap_collection(response)) + + def update_test_definition(self, test_definition): + """UpdateTestDefinition. + :param :class:` ` test_definition: + :rtype: :class:` ` + """ + content = self._serialize.body(test_definition, 'TestDefinition') + response = self._send(http_method='PUT', + location_id='a8f9b135-f604-41ea-9d74-d9a5fd32fcd8', + version='5.1', + content=content) + return self._deserialize('TestDefinition', response) + + def create_test_drop(self, web_test_drop): + """CreateTestDrop. + :param :class:` ` web_test_drop: Test drop to be created + :rtype: :class:` ` + """ + content = self._serialize.body(web_test_drop, 'TestDrop') + response = self._send(http_method='POST', + location_id='d89d0e08-505c-4357-96f6-9729311ce8ad', + version='5.1', + content=content) + return self._deserialize('TestDrop', response) + + def get_test_drop(self, test_drop_id): + """GetTestDrop. + :param str test_drop_id: The test drop identifier + :rtype: :class:` ` + """ + route_values = {} + if test_drop_id is not None: + route_values['testDropId'] = self._serialize.url('test_drop_id', test_drop_id, 'str') + response = self._send(http_method='GET', + location_id='d89d0e08-505c-4357-96f6-9729311ce8ad', + version='5.1', + route_values=route_values) + return self._deserialize('TestDrop', response) + + def create_test_run(self, web_test_run): + """CreateTestRun. + :param :class:` ` web_test_run: + :rtype: :class:` ` + """ + content = self._serialize.body(web_test_run, 'TestRun') + response = self._send(http_method='POST', + location_id='b41a84ff-ff03-4ac1-b76e-e7ea25c92aba', + version='5.1', + content=content) + return self._deserialize('TestRun', response) + + def get_test_run(self, test_run_id): + """GetTestRun. + :param str test_run_id: Unique ID of the test run + :rtype: :class:` ` + """ + route_values = {} + if test_run_id is not None: + route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') + response = self._send(http_method='GET', + location_id='b41a84ff-ff03-4ac1-b76e-e7ea25c92aba', + version='5.1', + route_values=route_values) + return self._deserialize('TestRun', response) + + def get_test_runs(self, name=None, requested_by=None, status=None, run_type=None, from_date=None, to_date=None, detailed=None, top=None, runsourceidentifier=None, retention_state=None): + """GetTestRuns. + Returns test runs based on the filter specified. Returns all runs of the tenant if there is no filter. + :param str name: Name for the test run. Names are not unique. Test runs with same name are assigned sequential rolling numbers. + :param str requested_by: Filter by the user who requested the test run. Here requestedBy should be the display name of the user. + :param str status: Filter by the test run status. + :param str run_type: Valid values include: null, one of TestRunType, or "*" + :param str from_date: Filter by the test runs that have been modified after the fromDate timestamp. + :param str to_date: Filter by the test runs that have been modified before the toDate timestamp. + :param bool detailed: Include the detailed test run attributes. + :param int top: The maximum number of test runs to return. + :param str runsourceidentifier: + :param str retention_state: + :rtype: object + """ + query_parameters = {} + if name is not None: + query_parameters['name'] = self._serialize.query('name', name, 'str') + if requested_by is not None: + query_parameters['requestedBy'] = self._serialize.query('requested_by', requested_by, 'str') + if status is not None: + query_parameters['status'] = self._serialize.query('status', status, 'str') + if run_type is not None: + query_parameters['runType'] = self._serialize.query('run_type', run_type, 'str') + if from_date is not None: + query_parameters['fromDate'] = self._serialize.query('from_date', from_date, 'str') + if to_date is not None: + query_parameters['toDate'] = self._serialize.query('to_date', to_date, 'str') + if detailed is not None: + query_parameters['detailed'] = self._serialize.query('detailed', detailed, 'bool') + if top is not None: + query_parameters['top'] = self._serialize.query('top', top, 'int') + if runsourceidentifier is not None: + query_parameters['runsourceidentifier'] = self._serialize.query('runsourceidentifier', runsourceidentifier, 'str') + if retention_state is not None: + query_parameters['retentionState'] = self._serialize.query('retention_state', retention_state, 'str') + response = self._send(http_method='GET', + location_id='b41a84ff-ff03-4ac1-b76e-e7ea25c92aba', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('object', response) + + def update_test_run(self, web_test_run, test_run_id): + """UpdateTestRun. + :param :class:` ` web_test_run: + :param str test_run_id: + """ + route_values = {} + if test_run_id is not None: + route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') + content = self._serialize.body(web_test_run, 'TestRun') + self._send(http_method='PATCH', + location_id='b41a84ff-ff03-4ac1-b76e-e7ea25c92aba', + version='5.1', + route_values=route_values, + content=content) + diff --git a/azure-devops/azure/devops/released/core/__init__.py b/azure-devops/azure/devops/released/core/__init__.py new file mode 100644 index 00000000..193a2d3c --- /dev/null +++ b/azure-devops/azure/devops/released/core/__init__.py @@ -0,0 +1,41 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.core.models import * +from .core_client import CoreClient + +__all__ = [ + 'GraphSubjectBase', + 'Identity', + 'IdentityBase', + 'IdentityData', + 'IdentityRef', + 'JsonPatchOperation', + 'OperationReference', + 'Process', + 'ProcessReference', + 'ProjectAvatar', + 'ProjectInfo', + 'ProjectProperties', + 'ProjectProperty', + 'Proxy', + 'ProxyAuthorization', + 'PublicKey', + 'ReferenceLinks', + 'TeamMember', + 'TeamProject', + 'TeamProjectCollection', + 'TeamProjectCollectionReference', + 'TeamProjectReference', + 'WebApiConnectedService', + 'WebApiConnectedServiceDetails', + 'WebApiConnectedServiceRef', + 'WebApiTeam', + 'WebApiTeamRef', + 'CoreClient' +] diff --git a/azure-devops/azure/devops/released/core/core_client.py b/azure-devops/azure/devops/released/core/core_client.py new file mode 100644 index 00000000..d5ca0c16 --- /dev/null +++ b/azure-devops/azure/devops/released/core/core_client.py @@ -0,0 +1,329 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.core import models + + +class CoreClient(Client): + """Core + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(CoreClient, 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 = '79134c72-4a58-4b42-976c-04e7115f32bf' + + def get_team_members_with_extended_properties(self, project_id, team_id, top=None, skip=None): + """GetTeamMembersWithExtendedProperties. + Get a list of members for a specific team. + :param str project_id: The name or ID (GUID) of the team project the team belongs to. + :param str team_id: The name or ID (GUID) of the team . + :param int top: + :param int skip: + :rtype: [TeamMember] + """ + route_values = {} + if project_id is not None: + route_values['projectId'] = self._serialize.url('project_id', project_id, 'str') + if team_id is not None: + route_values['teamId'] = self._serialize.url('team_id', team_id, 'str') + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + response = self._send(http_method='GET', + location_id='294c494c-2600-4d7e-b76c-3dd50c3c95be', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TeamMember]', self._unwrap_collection(response)) + + def get_process_by_id(self, process_id): + """GetProcessById. + Get a process by ID. + :param str process_id: ID for a process. + :rtype: :class:` ` + """ + route_values = {} + if process_id is not None: + route_values['processId'] = self._serialize.url('process_id', process_id, 'str') + response = self._send(http_method='GET', + location_id='93878975-88c5-4e6a-8abb-7ddd77a8a7d8', + version='5.1', + route_values=route_values) + return self._deserialize('Process', response) + + def get_processes(self): + """GetProcesses. + Get a list of processes. + :rtype: [Process] + """ + response = self._send(http_method='GET', + location_id='93878975-88c5-4e6a-8abb-7ddd77a8a7d8', + version='5.1') + return self._deserialize('[Process]', self._unwrap_collection(response)) + + def get_project_collection(self, collection_id): + """GetProjectCollection. + Get project collection with the specified id or name. + :param str collection_id: + :rtype: :class:` ` + """ + route_values = {} + if collection_id is not None: + route_values['collectionId'] = self._serialize.url('collection_id', collection_id, 'str') + response = self._send(http_method='GET', + location_id='8031090f-ef1d-4af6-85fc-698cd75d42bf', + version='5.1', + route_values=route_values) + return self._deserialize('TeamProjectCollection', response) + + def get_project_collections(self, top=None, skip=None): + """GetProjectCollections. + Get project collection references for this application. + :param int top: + :param int skip: + :rtype: [TeamProjectCollectionReference] + """ + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + response = self._send(http_method='GET', + location_id='8031090f-ef1d-4af6-85fc-698cd75d42bf', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[TeamProjectCollectionReference]', self._unwrap_collection(response)) + + def get_project(self, project_id, include_capabilities=None, include_history=None): + """GetProject. + Get project with the specified id or name, optionally including capabilities. + :param str project_id: + :param bool include_capabilities: Include capabilities (such as source control) in the team project result (default: false). + :param bool include_history: Search within renamed projects (that had such name in the past). + :rtype: :class:` ` + """ + route_values = {} + if project_id is not None: + route_values['projectId'] = self._serialize.url('project_id', project_id, 'str') + query_parameters = {} + if include_capabilities is not None: + query_parameters['includeCapabilities'] = self._serialize.query('include_capabilities', include_capabilities, 'bool') + if include_history is not None: + query_parameters['includeHistory'] = self._serialize.query('include_history', include_history, 'bool') + response = self._send(http_method='GET', + location_id='603fe2ac-9723-48b9-88ad-09305aa6c6e1', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('TeamProject', response) + + def get_projects(self, state_filter=None, top=None, skip=None, continuation_token=None, get_default_team_image_url=None): + """GetProjects. + Get all projects in the organization that the authenticated user has access to. + :param str state_filter: Filter on team projects in a specific team project state (default: WellFormed). + :param int top: + :param int skip: + :param str continuation_token: + :param bool get_default_team_image_url: + :rtype: :class:`` + """ + query_parameters = {} + if state_filter is not None: + query_parameters['stateFilter'] = self._serialize.query('state_filter', state_filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if get_default_team_image_url is not None: + query_parameters['getDefaultTeamImageUrl'] = self._serialize.query('get_default_team_image_url', get_default_team_image_url, 'bool') + response = self._send(http_method='GET', + location_id='603fe2ac-9723-48b9-88ad-09305aa6c6e1', + version='5.1', + query_parameters=query_parameters) + response_value = self._deserialize('[TeamProjectReference]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetProjectsResponseValue(response_value, continuation_token) + + class GetProjectsResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_projects method + + :param value: + :type value: :class:`<[TeamProjectReference]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def queue_create_project(self, project_to_create): + """QueueCreateProject. + Queues a project to be created. Use the [GetOperation](../../operations/operations/get) to periodically check for create project status. + :param :class:` ` project_to_create: The project to create. + :rtype: :class:` ` + """ + content = self._serialize.body(project_to_create, 'TeamProject') + response = self._send(http_method='POST', + location_id='603fe2ac-9723-48b9-88ad-09305aa6c6e1', + version='5.1', + content=content) + return self._deserialize('OperationReference', response) + + def queue_delete_project(self, project_id): + """QueueDeleteProject. + Queues a project to be deleted. Use the [GetOperation](../../operations/operations/get) to periodically check for delete project status. + :param str project_id: The project id of the project to delete. + :rtype: :class:` ` + """ + route_values = {} + if project_id is not None: + route_values['projectId'] = self._serialize.url('project_id', project_id, 'str') + response = self._send(http_method='DELETE', + location_id='603fe2ac-9723-48b9-88ad-09305aa6c6e1', + version='5.1', + route_values=route_values) + return self._deserialize('OperationReference', response) + + def update_project(self, project_update, project_id): + """UpdateProject. + Update an existing project's name, abbreviation, description, or restore a project. + :param :class:` ` project_update: The updates for the project. The state must be set to wellFormed to restore the project. + :param str project_id: The project id of the project to update. + :rtype: :class:` ` + """ + route_values = {} + if project_id is not None: + route_values['projectId'] = self._serialize.url('project_id', project_id, 'str') + content = self._serialize.body(project_update, 'TeamProject') + response = self._send(http_method='PATCH', + location_id='603fe2ac-9723-48b9-88ad-09305aa6c6e1', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('OperationReference', response) + + def create_team(self, team, project_id): + """CreateTeam. + Create a team in a team project. + :param :class:` ` team: The team data used to create the team. + :param str project_id: The name or ID (GUID) of the team project in which to create the team. + :rtype: :class:` ` + """ + route_values = {} + if project_id is not None: + route_values['projectId'] = self._serialize.url('project_id', project_id, 'str') + content = self._serialize.body(team, 'WebApiTeam') + response = self._send(http_method='POST', + location_id='d30a3dd1-f8ba-442a-b86a-bd0c0c383e59', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('WebApiTeam', response) + + def delete_team(self, project_id, team_id): + """DeleteTeam. + Delete a team. + :param str project_id: The name or ID (GUID) of the team project containing the team to delete. + :param str team_id: The name or ID of the team to delete. + """ + route_values = {} + if project_id is not None: + route_values['projectId'] = self._serialize.url('project_id', project_id, 'str') + if team_id is not None: + route_values['teamId'] = self._serialize.url('team_id', team_id, 'str') + self._send(http_method='DELETE', + location_id='d30a3dd1-f8ba-442a-b86a-bd0c0c383e59', + version='5.1', + route_values=route_values) + + def get_team(self, project_id, team_id, expand_identity=None): + """GetTeam. + Get a specific team. + :param str project_id: The name or ID (GUID) of the team project containing the team. + :param str team_id: The name or ID (GUID) of the team. + :param bool expand_identity: A value indicating whether or not to expand Identity information in the result WebApiTeam object. + :rtype: :class:` ` + """ + route_values = {} + if project_id is not None: + route_values['projectId'] = self._serialize.url('project_id', project_id, 'str') + if team_id is not None: + route_values['teamId'] = self._serialize.url('team_id', team_id, 'str') + query_parameters = {} + if expand_identity is not None: + query_parameters['$expandIdentity'] = self._serialize.query('expand_identity', expand_identity, 'bool') + response = self._send(http_method='GET', + location_id='d30a3dd1-f8ba-442a-b86a-bd0c0c383e59', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('WebApiTeam', response) + + def get_teams(self, project_id, mine=None, top=None, skip=None, expand_identity=None): + """GetTeams. + Get a list of teams. + :param str project_id: + :param bool mine: If true return all the teams requesting user is member, otherwise return all the teams user has read access. + :param int top: Maximum number of teams to return. + :param int skip: Number of teams to skip. + :param bool expand_identity: A value indicating whether or not to expand Identity information in the result WebApiTeam object. + :rtype: [WebApiTeam] + """ + route_values = {} + if project_id is not None: + route_values['projectId'] = self._serialize.url('project_id', project_id, 'str') + query_parameters = {} + if mine is not None: + query_parameters['$mine'] = self._serialize.query('mine', mine, 'bool') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if expand_identity is not None: + query_parameters['$expandIdentity'] = self._serialize.query('expand_identity', expand_identity, 'bool') + response = self._send(http_method='GET', + location_id='d30a3dd1-f8ba-442a-b86a-bd0c0c383e59', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[WebApiTeam]', self._unwrap_collection(response)) + + def update_team(self, team_data, project_id, team_id): + """UpdateTeam. + Update a team's name and/or description. + :param :class:` ` team_data: + :param str project_id: The name or ID (GUID) of the team project containing the team to update. + :param str team_id: The name of ID of the team to update. + :rtype: :class:` ` + """ + route_values = {} + if project_id is not None: + route_values['projectId'] = self._serialize.url('project_id', project_id, 'str') + if team_id is not None: + route_values['teamId'] = self._serialize.url('team_id', team_id, 'str') + content = self._serialize.body(team_data, 'WebApiTeam') + response = self._send(http_method='PATCH', + location_id='d30a3dd1-f8ba-442a-b86a-bd0c0c383e59', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('WebApiTeam', response) + diff --git a/azure-devops/azure/devops/released/git/__init__.py b/azure-devops/azure/devops/released/git/__init__.py new file mode 100644 index 00000000..581a92e4 --- /dev/null +++ b/azure-devops/azure/devops/released/git/__init__.py @@ -0,0 +1,122 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.git.models import * +from .git_client import GitClient + +__all__ = [ + 'Attachment', + 'Change', + 'Comment', + 'CommentIterationContext', + 'CommentPosition', + 'CommentThread', + 'CommentThreadContext', + 'CommentTrackingCriteria', + 'FileContentMetadata', + 'FileDiff', + 'FileDiffParams', + 'FileDiffsCriteria', + 'GitAnnotatedTag', + 'GitAsyncRefOperation', + 'GitAsyncRefOperationDetail', + 'GitAsyncRefOperationParameters', + 'GitAsyncRefOperationSource', + 'GitBaseVersionDescriptor', + 'GitBlobRef', + 'GitBranchStats', + 'GitCherryPick', + 'GitCommit', + 'GitCommitChanges', + 'GitCommitDiffs', + 'GitCommitRef', + 'GitConflict', + 'GitConflictUpdateResult', + 'GitDeletedRepository', + 'GitFilePathsCollection', + 'GitForkOperationStatusDetail', + 'GitForkRef', + 'GitForkSyncRequest', + 'GitForkSyncRequestParameters', + 'GitImportGitSource', + 'GitImportRequest', + 'GitImportRequestParameters', + 'GitImportStatusDetail', + 'GitImportTfvcSource', + 'GitItem', + 'GitItemDescriptor', + 'GitItemRequestData', + 'GitMerge', + 'GitMergeOperationStatusDetail', + 'GitMergeOriginRef', + 'GitMergeParameters', + 'GitObject', + 'GitPolicyConfigurationResponse', + 'GitPullRequest', + 'GitPullRequestChange', + 'GitPullRequestCommentThread', + 'GitPullRequestCommentThreadContext', + 'GitPullRequestCompletionOptions', + 'GitPullRequestIteration', + 'GitPullRequestIterationChanges', + 'GitPullRequestMergeOptions', + 'GitPullRequestQuery', + 'GitPullRequestQueryInput', + 'GitPullRequestSearchCriteria', + 'GitPullRequestStatus', + 'GitPush', + 'GitPushRef', + 'GitPushSearchCriteria', + 'GitQueryBranchStatsCriteria', + 'GitQueryCommitsCriteria', + 'GitRecycleBinRepositoryDetails', + 'GitRef', + 'GitRefFavorite', + 'GitRefUpdate', + 'GitRefUpdateResult', + 'GitRepository', + 'GitRepositoryCreateOptions', + 'GitRepositoryRef', + 'GitRepositoryStats', + 'GitRevert', + 'GitStatus', + 'GitStatusContext', + 'GitSuggestion', + 'GitTargetVersionDescriptor', + 'GitTemplate', + 'GitTreeDiff', + 'GitTreeDiffEntry', + 'GitTreeDiffResponse', + 'GitTreeEntryRef', + 'GitTreeRef', + 'GitUserDate', + 'GitVersionDescriptor', + 'GlobalGitRepositoryKey', + 'GraphSubjectBase', + 'IdentityRef', + 'IdentityRefWithVote', + 'ImportRepositoryValidation', + 'ItemContent', + 'ItemModel', + 'JsonPatchOperation', + 'LineDiffBlock', + 'PolicyConfiguration', + 'PolicyConfigurationRef', + 'PolicyTypeRef', + 'ReferenceLinks', + 'ResourceRef', + 'ShareNotificationContext', + 'SourceToTargetRef', + 'TeamProjectCollectionReference', + 'TeamProjectReference', + 'VersionedPolicyConfigurationRef', + 'VstsInfo', + 'WebApiCreateTagRequestData', + 'WebApiTagDefinition', + 'GitClient' +] diff --git a/azure-devops/azure/devops/released/git/git_client.py b/azure-devops/azure/devops/released/git/git_client.py new file mode 100644 index 00000000..b2900002 --- /dev/null +++ b/azure-devops/azure/devops/released/git/git_client.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +from .git_client_base import GitClientBase + + +class GitClient(GitClientBase): + """Git + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(GitClient, self).__init__(base_url, creds) diff --git a/azure-devops/azure/devops/released/git/git_client_base.py b/azure-devops/azure/devops/released/git/git_client_base.py new file mode 100644 index 00000000..38158300 --- /dev/null +++ b/azure-devops/azure/devops/released/git/git_client_base.py @@ -0,0 +1,1995 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.git import models + + +class GitClientBase(Client): + """Git + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(GitClientBase, 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 = '4e080c62-fa21-4fbc-8fef-2a10a2b38049' + + def get_blob(self, repository_id, sha1, project=None, download=None, file_name=None, resolve_lfs=None): + """GetBlob. + Get a single blob. + :param str repository_id: The name or ID of the repository. + :param str sha1: SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint. + :param str project: Project ID or project name + :param bool download: If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip + :param str file_name: Provide a fileName to use for a download. + :param bool resolve_lfs: If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if sha1 is not None: + route_values['sha1'] = self._serialize.url('sha1', sha1, 'str') + query_parameters = {} + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + if resolve_lfs is not None: + query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool') + response = self._send(http_method='GET', + location_id='7b28e929-2c99-405d-9c5c-6167a06e6816', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('GitBlobRef', response) + + def get_blob_content(self, repository_id, sha1, project=None, download=None, file_name=None, resolve_lfs=None, **kwargs): + """GetBlobContent. + Get a single blob. + :param str repository_id: The name or ID of the repository. + :param str sha1: SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint. + :param str project: Project ID or project name + :param bool download: If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip + :param str file_name: Provide a fileName to use for a download. + :param bool resolve_lfs: If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if sha1 is not None: + route_values['sha1'] = self._serialize.url('sha1', sha1, 'str') + query_parameters = {} + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + if resolve_lfs is not None: + query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool') + response = self._send(http_method='GET', + location_id='7b28e929-2c99-405d-9c5c-6167a06e6816', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_blobs_zip(self, blob_ids, repository_id, project=None, filename=None, **kwargs): + """GetBlobsZip. + Gets one or more blobs in a zip file download. + :param [str] blob_ids: Blob IDs (SHA1 hashes) to be returned in the zip file. + :param str repository_id: The name or ID of the repository. + :param str project: Project ID or project name + :param str filename: + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if filename is not None: + query_parameters['filename'] = self._serialize.query('filename', filename, 'str') + content = self._serialize.body(blob_ids, '[str]') + response = self._send(http_method='POST', + location_id='7b28e929-2c99-405d-9c5c-6167a06e6816', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_blob_zip(self, repository_id, sha1, project=None, download=None, file_name=None, resolve_lfs=None, **kwargs): + """GetBlobZip. + Get a single blob. + :param str repository_id: The name or ID of the repository. + :param str sha1: SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint. + :param str project: Project ID or project name + :param bool download: If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip + :param str file_name: Provide a fileName to use for a download. + :param bool resolve_lfs: If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if sha1 is not None: + route_values['sha1'] = self._serialize.url('sha1', sha1, 'str') + query_parameters = {} + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + if resolve_lfs is not None: + query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool') + response = self._send(http_method='GET', + location_id='7b28e929-2c99-405d-9c5c-6167a06e6816', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_branch(self, repository_id, name, project=None, base_version_descriptor=None): + """GetBranch. + Retrieve statistics about a single branch. + :param str repository_id: The name or ID of the repository. + :param str name: Name of the branch. + :param str project: Project ID or project name + :param :class:` ` base_version_descriptor: Identifies the commit or branch to use as the base. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if name is not None: + query_parameters['name'] = self._serialize.query('name', name, 'str') + if base_version_descriptor is not None: + if base_version_descriptor.version_type is not None: + query_parameters['baseVersionDescriptor.versionType'] = base_version_descriptor.version_type + if base_version_descriptor.version is not None: + query_parameters['baseVersionDescriptor.version'] = base_version_descriptor.version + if base_version_descriptor.version_options is not None: + query_parameters['baseVersionDescriptor.versionOptions'] = base_version_descriptor.version_options + response = self._send(http_method='GET', + location_id='d5b216de-d8d5-4d32-ae76-51df755b16d3', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('GitBranchStats', response) + + def get_branches(self, repository_id, project=None, base_version_descriptor=None): + """GetBranches. + Retrieve statistics about all branches within a repository. + :param str repository_id: The name or ID of the repository. + :param str project: Project ID or project name + :param :class:` ` base_version_descriptor: Identifies the commit or branch to use as the base. + :rtype: [GitBranchStats] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if base_version_descriptor is not None: + if base_version_descriptor.version_type is not None: + query_parameters['baseVersionDescriptor.versionType'] = base_version_descriptor.version_type + if base_version_descriptor.version is not None: + query_parameters['baseVersionDescriptor.version'] = base_version_descriptor.version + if base_version_descriptor.version_options is not None: + query_parameters['baseVersionDescriptor.versionOptions'] = base_version_descriptor.version_options + response = self._send(http_method='GET', + location_id='d5b216de-d8d5-4d32-ae76-51df755b16d3', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[GitBranchStats]', self._unwrap_collection(response)) + + def get_changes(self, commit_id, repository_id, project=None, top=None, skip=None): + """GetChanges. + Retrieve changes for a particular commit. + :param str commit_id: The id of the commit. + :param str repository_id: The id or friendly name of the repository. To use the friendly name, projectId must also be specified. + :param str project: Project ID or project name + :param int top: The maximum number of changes to return. + :param int skip: The number of changes to skip. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if commit_id is not None: + route_values['commitId'] = self._serialize.url('commit_id', commit_id, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if top is not None: + query_parameters['top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['skip'] = self._serialize.query('skip', skip, 'int') + response = self._send(http_method='GET', + location_id='5bf884f5-3e07-42e9-afb8-1b872267bf16', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('GitCommitChanges', response) + + def get_commit_diffs(self, repository_id, project=None, diff_common_commit=None, top=None, skip=None, base_version_descriptor=None, target_version_descriptor=None): + """GetCommitDiffs. + Find the closest common commit (the merge base) between base and target commits, and get the diff between either the base and target commits or common and target commits. + :param str repository_id: The name or ID of the repository. + :param str project: Project ID or project name + :param bool diff_common_commit: If true, diff between common and target commits. If false, diff between base and target commits. + :param int top: Maximum number of changes to return. Defaults to 100. + :param int skip: Number of changes to skip + :param :class:` ` base_version_descriptor: Descriptor for base commit. + :param :class:` ` target_version_descriptor: Descriptor for target commit. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if diff_common_commit is not None: + query_parameters['diffCommonCommit'] = self._serialize.query('diff_common_commit', diff_common_commit, 'bool') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if base_version_descriptor is not None: + if base_version_descriptor.base_version_type is not None: + query_parameters['baseVersionType'] = base_version_descriptor.base_version_type + if base_version_descriptor.base_version is not None: + query_parameters['baseVersion'] = base_version_descriptor.base_version + if base_version_descriptor.base_version_options is not None: + query_parameters['baseVersionOptions'] = base_version_descriptor.base_version_options + if target_version_descriptor is not None: + if target_version_descriptor.target_version_type is not None: + query_parameters['targetVersionType'] = target_version_descriptor.target_version_type + if target_version_descriptor.target_version is not None: + query_parameters['targetVersion'] = target_version_descriptor.target_version + if target_version_descriptor.target_version_options is not None: + query_parameters['targetVersionOptions'] = target_version_descriptor.target_version_options + response = self._send(http_method='GET', + location_id='615588d5-c0c7-4b88-88f8-e625306446e8', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('GitCommitDiffs', response) + + def get_commit(self, commit_id, repository_id, project=None, change_count=None): + """GetCommit. + Retrieve a particular commit. + :param str commit_id: The id of the commit. + :param str repository_id: The id or friendly name of the repository. To use the friendly name, projectId must also be specified. + :param str project: Project ID or project name + :param int change_count: The number of changes to include in the result. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if commit_id is not None: + route_values['commitId'] = self._serialize.url('commit_id', commit_id, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if change_count is not None: + query_parameters['changeCount'] = self._serialize.query('change_count', change_count, 'int') + response = self._send(http_method='GET', + location_id='c2570c3b-5b3f-41b8-98bf-5407bfde8d58', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('GitCommit', response) + + def get_commits(self, repository_id, search_criteria, project=None, skip=None, top=None): + """GetCommits. + Retrieve git commits for a project + :param str repository_id: The id or friendly name of the repository. To use the friendly name, projectId must also be specified. + :param :class:` ` search_criteria: + :param str project: Project ID or project name + :param int skip: + :param int top: + :rtype: [GitCommitRef] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if search_criteria is not None: + if search_criteria.ids is not None: + query_parameters['searchCriteria.ids'] = search_criteria.ids + if search_criteria.from_date is not None: + query_parameters['searchCriteria.fromDate'] = search_criteria.from_date + if search_criteria.to_date is not None: + query_parameters['searchCriteria.toDate'] = search_criteria.to_date + if search_criteria.item_version is not None: + if search_criteria.item_version.version_type is not None: + query_parameters['searchCriteria.itemVersion.versionType'] = search_criteria.item_version.version_type + if search_criteria.item_version.version is not None: + query_parameters['searchCriteria.itemVersion.version'] = search_criteria.item_version.version + if search_criteria.item_version.version_options is not None: + query_parameters['searchCriteria.itemVersion.versionOptions'] = search_criteria.item_version.version_options + if search_criteria.compare_version is not None: + if search_criteria.compare_version.version_type is not None: + query_parameters['searchCriteria.compareVersion.versionType'] = search_criteria.compare_version.version_type + if search_criteria.compare_version.version is not None: + query_parameters['searchCriteria.compareVersion.version'] = search_criteria.compare_version.version + if search_criteria.compare_version.version_options is not None: + query_parameters['searchCriteria.compareVersion.versionOptions'] = search_criteria.compare_version.version_options + if search_criteria.from_commit_id is not None: + query_parameters['searchCriteria.fromCommitId'] = search_criteria.from_commit_id + if search_criteria.to_commit_id is not None: + query_parameters['searchCriteria.toCommitId'] = search_criteria.to_commit_id + if search_criteria.user is not None: + query_parameters['searchCriteria.user'] = search_criteria.user + if search_criteria.author is not None: + query_parameters['searchCriteria.author'] = search_criteria.author + if search_criteria.item_path is not None: + query_parameters['searchCriteria.itemPath'] = search_criteria.item_path + if search_criteria.exclude_deletes is not None: + query_parameters['searchCriteria.excludeDeletes'] = search_criteria.exclude_deletes + if search_criteria.skip is not None: + query_parameters['searchCriteria.$skip'] = search_criteria.skip + if search_criteria.top is not None: + query_parameters['searchCriteria.$top'] = search_criteria.top + if search_criteria.include_links is not None: + query_parameters['searchCriteria.includeLinks'] = search_criteria.include_links + if search_criteria.include_work_items is not None: + query_parameters['searchCriteria.includeWorkItems'] = search_criteria.include_work_items + if search_criteria.include_user_image_url is not None: + query_parameters['searchCriteria.includeUserImageUrl'] = search_criteria.include_user_image_url + if search_criteria.include_push_data is not None: + query_parameters['searchCriteria.includePushData'] = search_criteria.include_push_data + if search_criteria.history_mode is not None: + query_parameters['searchCriteria.historyMode'] = search_criteria.history_mode + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + response = self._send(http_method='GET', + location_id='c2570c3b-5b3f-41b8-98bf-5407bfde8d58', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[GitCommitRef]', self._unwrap_collection(response)) + + def get_push_commits(self, repository_id, push_id, project=None, top=None, skip=None, include_links=None): + """GetPushCommits. + Retrieve a list of commits associated with a particular push. + :param str repository_id: The id or friendly name of the repository. To use the friendly name, projectId must also be specified. + :param int push_id: The id of the push. + :param str project: Project ID or project name + :param int top: The maximum number of commits to return ("get the top x commits"). + :param int skip: The number of commits to skip. + :param bool include_links: Set to false to avoid including REST Url links for resources. Defaults to true. + :rtype: [GitCommitRef] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if push_id is not None: + query_parameters['pushId'] = self._serialize.query('push_id', push_id, 'int') + if top is not None: + query_parameters['top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['skip'] = self._serialize.query('skip', skip, 'int') + if include_links is not None: + query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool') + response = self._send(http_method='GET', + location_id='c2570c3b-5b3f-41b8-98bf-5407bfde8d58', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[GitCommitRef]', self._unwrap_collection(response)) + + def get_commits_batch(self, search_criteria, repository_id, project=None, skip=None, top=None, include_statuses=None): + """GetCommitsBatch. + Retrieve git commits for a project matching the search criteria + :param :class:` ` search_criteria: Search options + :param str repository_id: The name or ID of the repository. + :param str project: Project ID or project name + :param int skip: Number of commits to skip. + :param int top: Maximum number of commits to return. + :param bool include_statuses: True to include additional commit status information. + :rtype: [GitCommitRef] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if include_statuses is not None: + query_parameters['includeStatuses'] = self._serialize.query('include_statuses', include_statuses, 'bool') + content = self._serialize.body(search_criteria, 'GitQueryCommitsCriteria') + response = self._send(http_method='POST', + location_id='6400dfb2-0bcb-462b-b992-5a57f8f1416c', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('[GitCommitRef]', self._unwrap_collection(response)) + + def get_item(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None, resolve_lfs=None): + """GetItem. + Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. + :param str repository_id: The name or ID of the repository. + :param str path: The item path. + :param str project: Project ID or project name + :param str scope_path: The path scope. The default is null. + :param str recursion_level: The recursion level of this request. The default is 'none', no recursion. + :param bool include_content_metadata: Set to true to include content metadata. Default is false. + :param bool latest_processed_change: Set to true to include the latest changes. Default is false. + :param bool download: Set to true to download the response as a file. Default is false. + :param :class:` ` version_descriptor: Version descriptor. Default is the default branch for the repository. + :param bool include_content: Set to true to include item content when requesting json. Default is false. + :param bool resolve_lfs: Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if scope_path is not None: + query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str') + if recursion_level is not None: + query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str') + if include_content_metadata is not None: + query_parameters['includeContentMetadata'] = self._serialize.query('include_content_metadata', include_content_metadata, 'bool') + if latest_processed_change is not None: + query_parameters['latestProcessedChange'] = self._serialize.query('latest_processed_change', latest_processed_change, 'bool') + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + if version_descriptor is not None: + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if version_descriptor.version_options is not None: + query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options + if include_content is not None: + query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool') + if resolve_lfs is not None: + query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool') + response = self._send(http_method='GET', + location_id='fb93c0db-47ed-4a31-8c20-47552878fb44', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('GitItem', response) + + def get_item_content(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None, resolve_lfs=None, **kwargs): + """GetItemContent. + Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. + :param str repository_id: The name or ID of the repository. + :param str path: The item path. + :param str project: Project ID or project name + :param str scope_path: The path scope. The default is null. + :param str recursion_level: The recursion level of this request. The default is 'none', no recursion. + :param bool include_content_metadata: Set to true to include content metadata. Default is false. + :param bool latest_processed_change: Set to true to include the latest changes. Default is false. + :param bool download: Set to true to download the response as a file. Default is false. + :param :class:` ` version_descriptor: Version descriptor. Default is the default branch for the repository. + :param bool include_content: Set to true to include item content when requesting json. Default is false. + :param bool resolve_lfs: Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if scope_path is not None: + query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str') + if recursion_level is not None: + query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str') + if include_content_metadata is not None: + query_parameters['includeContentMetadata'] = self._serialize.query('include_content_metadata', include_content_metadata, 'bool') + if latest_processed_change is not None: + query_parameters['latestProcessedChange'] = self._serialize.query('latest_processed_change', latest_processed_change, 'bool') + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + if version_descriptor is not None: + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if version_descriptor.version_options is not None: + query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options + if include_content is not None: + query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool') + if resolve_lfs is not None: + query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool') + response = self._send(http_method='GET', + location_id='fb93c0db-47ed-4a31-8c20-47552878fb44', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_items(self, repository_id, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, include_links=None, version_descriptor=None): + """GetItems. + Get Item Metadata and/or Content for a collection of items. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. + :param str repository_id: The name or ID of the repository. + :param str project: Project ID or project name + :param str scope_path: The path scope. The default is null. + :param str recursion_level: The recursion level of this request. The default is 'none', no recursion. + :param bool include_content_metadata: Set to true to include content metadata. Default is false. + :param bool latest_processed_change: Set to true to include the latest changes. Default is false. + :param bool download: Set to true to download the response as a file. Default is false. + :param bool include_links: Set to true to include links to items. Default is false. + :param :class:` ` version_descriptor: Version descriptor. Default is the default branch for the repository. + :rtype: [GitItem] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if scope_path is not None: + query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str') + if recursion_level is not None: + query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str') + if include_content_metadata is not None: + query_parameters['includeContentMetadata'] = self._serialize.query('include_content_metadata', include_content_metadata, 'bool') + if latest_processed_change is not None: + query_parameters['latestProcessedChange'] = self._serialize.query('latest_processed_change', latest_processed_change, 'bool') + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + if include_links is not None: + query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool') + if version_descriptor is not None: + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if version_descriptor.version_options is not None: + query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options + response = self._send(http_method='GET', + location_id='fb93c0db-47ed-4a31-8c20-47552878fb44', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[GitItem]', self._unwrap_collection(response)) + + def get_item_text(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None, resolve_lfs=None, **kwargs): + """GetItemText. + Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. + :param str repository_id: The name or ID of the repository. + :param str path: The item path. + :param str project: Project ID or project name + :param str scope_path: The path scope. The default is null. + :param str recursion_level: The recursion level of this request. The default is 'none', no recursion. + :param bool include_content_metadata: Set to true to include content metadata. Default is false. + :param bool latest_processed_change: Set to true to include the latest changes. Default is false. + :param bool download: Set to true to download the response as a file. Default is false. + :param :class:` ` version_descriptor: Version descriptor. Default is the default branch for the repository. + :param bool include_content: Set to true to include item content when requesting json. Default is false. + :param bool resolve_lfs: Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if scope_path is not None: + query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str') + if recursion_level is not None: + query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str') + if include_content_metadata is not None: + query_parameters['includeContentMetadata'] = self._serialize.query('include_content_metadata', include_content_metadata, 'bool') + if latest_processed_change is not None: + query_parameters['latestProcessedChange'] = self._serialize.query('latest_processed_change', latest_processed_change, 'bool') + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + if version_descriptor is not None: + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if version_descriptor.version_options is not None: + query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options + if include_content is not None: + query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool') + if resolve_lfs is not None: + query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool') + response = self._send(http_method='GET', + location_id='fb93c0db-47ed-4a31-8c20-47552878fb44', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_item_zip(self, repository_id, path, project=None, scope_path=None, recursion_level=None, include_content_metadata=None, latest_processed_change=None, download=None, version_descriptor=None, include_content=None, resolve_lfs=None, **kwargs): + """GetItemZip. + Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. + :param str repository_id: The name or ID of the repository. + :param str path: The item path. + :param str project: Project ID or project name + :param str scope_path: The path scope. The default is null. + :param str recursion_level: The recursion level of this request. The default is 'none', no recursion. + :param bool include_content_metadata: Set to true to include content metadata. Default is false. + :param bool latest_processed_change: Set to true to include the latest changes. Default is false. + :param bool download: Set to true to download the response as a file. Default is false. + :param :class:` ` version_descriptor: Version descriptor. Default is the default branch for the repository. + :param bool include_content: Set to true to include item content when requesting json. Default is false. + :param bool resolve_lfs: Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if scope_path is not None: + query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str') + if recursion_level is not None: + query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str') + if include_content_metadata is not None: + query_parameters['includeContentMetadata'] = self._serialize.query('include_content_metadata', include_content_metadata, 'bool') + if latest_processed_change is not None: + query_parameters['latestProcessedChange'] = self._serialize.query('latest_processed_change', latest_processed_change, 'bool') + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + if version_descriptor is not None: + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if version_descriptor.version_options is not None: + query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options + if include_content is not None: + query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool') + if resolve_lfs is not None: + query_parameters['resolveLfs'] = self._serialize.query('resolve_lfs', resolve_lfs, 'bool') + response = self._send(http_method='GET', + location_id='fb93c0db-47ed-4a31-8c20-47552878fb44', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_items_batch(self, request_data, repository_id, project=None): + """GetItemsBatch. + Post for retrieving a creating a batch out of a set of items in a repo / project given a list of paths or a long path + :param :class:` ` request_data: Request data attributes: ItemDescriptors, IncludeContentMetadata, LatestProcessedChange, IncludeLinks. ItemDescriptors: Collection of items to fetch, including path, version, and recursion level. IncludeContentMetadata: Whether to include metadata for all items LatestProcessedChange: Whether to include shallow ref to commit that last changed each item. IncludeLinks: Whether to include the _links field on the shallow references. + :param str repository_id: The name or ID of the repository + :param str project: Project ID or project name + :rtype: [[GitItem]] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + content = self._serialize.body(request_data, 'GitItemRequestData') + response = self._send(http_method='POST', + location_id='630fd2e4-fb88-4f85-ad21-13f3fd1fbca9', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[[GitItem]]', self._unwrap_collection(response)) + + def get_pull_request_iteration_commits(self, repository_id, pull_request_id, iteration_id, project=None, top=None, skip=None): + """GetPullRequestIterationCommits. + Get the commits for the specified iteration of a pull request. + :param str repository_id: ID or name of the repository. + :param int pull_request_id: ID of the pull request. + :param int iteration_id: ID of the iteration from which to get the commits. + :param str project: Project ID or project name + :param int top: Maximum number of commits to return. The maximum number of commits that can be returned per batch is 500. + :param int skip: Number of commits to skip. + :rtype: [GitCommitRef] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + if iteration_id is not None: + route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int') + query_parameters = {} + if top is not None: + query_parameters['top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['skip'] = self._serialize.query('skip', skip, 'int') + response = self._send(http_method='GET', + location_id='e7ea0883-095f-4926-b5fb-f24691c26fb9', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[GitCommitRef]', self._unwrap_collection(response)) + + def get_pull_request_commits(self, repository_id, pull_request_id, project=None, top=None, continuation_token=None): + """GetPullRequestCommits. + Get the commits for the specified pull request. + :param str repository_id: ID or name of the repository. + :param int pull_request_id: ID of the pull request. + :param str project: Project ID or project name + :param int top: Maximum number of commits to return. + :param str continuation_token: The continuation token used for pagination. + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + response = self._send(http_method='GET', + location_id='52823034-34a8-4576-922c-8d8b77e9e4c4', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[GitCommitRef]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetPullRequestCommitsResponseValue(response_value, continuation_token) + + class GetPullRequestCommitsResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_pull_request_commits method + + :param value: + :type value: :class:`<[GitCommitRef]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def get_pull_request_iteration_changes(self, repository_id, pull_request_id, iteration_id, project=None, top=None, skip=None, compare_to=None): + """GetPullRequestIterationChanges. + Retrieve the changes made in a pull request between two iterations. + :param str repository_id: The repository ID of the pull request's target branch. + :param int pull_request_id: ID of the pull request. + :param int iteration_id: ID of the pull request iteration.
Iteration IDs are zero-based with zero indicating the common commit between the source and target branches. Iteration one is the head of the source branch at the time the pull request is created and subsequent iterations are created when there are pushes to the source branch. + :param str project: Project ID or project name + :param int top: Optional. The number of changes to retrieve. The default value is 100 and the maximum value is 2000. + :param int skip: Optional. The number of changes to ignore. For example, to retrieve changes 101-150, set top 50 and skip to 100. + :param int compare_to: ID of the pull request iteration to compare against. The default value is zero which indicates the comparison is made against the common commit between the source and target branches + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + if iteration_id is not None: + route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int') + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if compare_to is not None: + query_parameters['$compareTo'] = self._serialize.query('compare_to', compare_to, 'int') + response = self._send(http_method='GET', + location_id='4216bdcf-b6b1-4d59-8b82-c34cc183fc8b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('GitPullRequestIterationChanges', response) + + def get_pull_request_iteration(self, repository_id, pull_request_id, iteration_id, project=None): + """GetPullRequestIteration. + Get the specified iteration for a pull request. + :param str repository_id: ID or name of the repository. + :param int pull_request_id: ID of the pull request. + :param int iteration_id: ID of the pull request iteration to return. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + if iteration_id is not None: + route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int') + response = self._send(http_method='GET', + location_id='d43911ee-6958-46b0-a42b-8445b8a0d004', + version='5.1', + route_values=route_values) + return self._deserialize('GitPullRequestIteration', response) + + def get_pull_request_iterations(self, repository_id, pull_request_id, project=None, include_commits=None): + """GetPullRequestIterations. + Get the list of iterations for the specified pull request. + :param str repository_id: ID or name of the repository. + :param int pull_request_id: ID of the pull request. + :param str project: Project ID or project name + :param bool include_commits: If true, include the commits associated with each iteration in the response. + :rtype: [GitPullRequestIteration] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + query_parameters = {} + if include_commits is not None: + query_parameters['includeCommits'] = self._serialize.query('include_commits', include_commits, 'bool') + response = self._send(http_method='GET', + location_id='d43911ee-6958-46b0-a42b-8445b8a0d004', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[GitPullRequestIteration]', self._unwrap_collection(response)) + + def get_pull_request_query(self, queries, repository_id, project=None): + """GetPullRequestQuery. + This API is used to find what pull requests are related to a given commit. It can be used to either find the pull request that created a particular merge commit or it can be used to find all pull requests that have ever merged a particular commit. The input is a list of queries which each contain a list of commits. For each commit that you search against, you will get back a dictionary of commit -> pull requests. + :param :class:` ` queries: The list of queries to perform. + :param str repository_id: ID of the repository. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + content = self._serialize.body(queries, 'GitPullRequestQuery') + response = self._send(http_method='POST', + location_id='b3a6eebe-9cf0-49ea-b6cb-1a4c5f5007b0', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('GitPullRequestQuery', response) + + def create_pull_request_reviewer(self, reviewer, repository_id, pull_request_id, reviewer_id, project=None): + """CreatePullRequestReviewer. + Add a reviewer to a pull request or cast a vote. + :param :class:` ` reviewer: Reviewer's vote.
If the reviewer's ID is included here, it must match the reviewerID parameter.
Reviewers can set their own vote with this method. When adding other reviewers, vote must be set to zero. + :param str repository_id: The repository ID of the pull request’s target branch. + :param int pull_request_id: ID of the pull request. + :param str reviewer_id: ID of the reviewer. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + if reviewer_id is not None: + route_values['reviewerId'] = self._serialize.url('reviewer_id', reviewer_id, 'str') + content = self._serialize.body(reviewer, 'IdentityRefWithVote') + response = self._send(http_method='PUT', + location_id='4b6702c7-aa35-4b89-9c96-b9abf6d3e540', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('IdentityRefWithVote', response) + + def create_pull_request_reviewers(self, reviewers, repository_id, pull_request_id, project=None): + """CreatePullRequestReviewers. + Add reviewers to a pull request. + :param [IdentityRef] reviewers: Reviewers to add to the pull request. + :param str repository_id: The repository ID of the pull request’s target branch. + :param int pull_request_id: ID of the pull request. + :param str project: Project ID or project name + :rtype: [IdentityRefWithVote] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + content = self._serialize.body(reviewers, '[IdentityRef]') + response = self._send(http_method='POST', + location_id='4b6702c7-aa35-4b89-9c96-b9abf6d3e540', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[IdentityRefWithVote]', self._unwrap_collection(response)) + + def delete_pull_request_reviewer(self, repository_id, pull_request_id, reviewer_id, project=None): + """DeletePullRequestReviewer. + Remove a reviewer from a pull request. + :param str repository_id: The repository ID of the pull request’s target branch. + :param int pull_request_id: ID of the pull request. + :param str reviewer_id: ID of the reviewer to remove. + :param str project: Project ID or project name + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + if reviewer_id is not None: + route_values['reviewerId'] = self._serialize.url('reviewer_id', reviewer_id, 'str') + self._send(http_method='DELETE', + location_id='4b6702c7-aa35-4b89-9c96-b9abf6d3e540', + version='5.1', + route_values=route_values) + + def get_pull_request_reviewer(self, repository_id, pull_request_id, reviewer_id, project=None): + """GetPullRequestReviewer. + Retrieve information about a particular reviewer on a pull request + :param str repository_id: The repository ID of the pull request’s target branch. + :param int pull_request_id: ID of the pull request. + :param str reviewer_id: ID of the reviewer. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + if reviewer_id is not None: + route_values['reviewerId'] = self._serialize.url('reviewer_id', reviewer_id, 'str') + response = self._send(http_method='GET', + location_id='4b6702c7-aa35-4b89-9c96-b9abf6d3e540', + version='5.1', + route_values=route_values) + return self._deserialize('IdentityRefWithVote', response) + + def get_pull_request_reviewers(self, repository_id, pull_request_id, project=None): + """GetPullRequestReviewers. + Retrieve the reviewers for a pull request + :param str repository_id: The repository ID of the pull request’s target branch. + :param int pull_request_id: ID of the pull request. + :param str project: Project ID or project name + :rtype: [IdentityRefWithVote] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + response = self._send(http_method='GET', + location_id='4b6702c7-aa35-4b89-9c96-b9abf6d3e540', + version='5.1', + route_values=route_values) + return self._deserialize('[IdentityRefWithVote]', self._unwrap_collection(response)) + + def update_pull_request_reviewers(self, patch_votes, repository_id, pull_request_id, project=None): + """UpdatePullRequestReviewers. + Reset the votes of multiple reviewers on a pull request. NOTE: This endpoint only supports updating votes, but does not support updating required reviewers (use policy) or display names. + :param [IdentityRefWithVote] patch_votes: IDs of the reviewers whose votes will be reset to zero + :param str repository_id: The repository ID of the pull request’s target branch. + :param int pull_request_id: ID of the pull request + :param str project: Project ID or project name + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + content = self._serialize.body(patch_votes, '[IdentityRefWithVote]') + self._send(http_method='PATCH', + location_id='4b6702c7-aa35-4b89-9c96-b9abf6d3e540', + version='5.1', + route_values=route_values, + content=content) + + def get_pull_request_by_id(self, pull_request_id, project=None): + """GetPullRequestById. + Retrieve a pull request. + :param int pull_request_id: The ID of the pull request to retrieve. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + response = self._send(http_method='GET', + location_id='01a46dea-7d46-4d40-bc84-319e7c260d99', + version='5.1', + route_values=route_values) + return self._deserialize('GitPullRequest', response) + + def get_pull_requests_by_project(self, project, search_criteria, max_comment_length=None, skip=None, top=None): + """GetPullRequestsByProject. + Retrieve all pull requests matching a specified criteria. + :param str project: Project ID or project name + :param :class:` ` search_criteria: Pull requests will be returned that match this search criteria. + :param int max_comment_length: Not used. + :param int skip: The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100. + :param int top: The number of pull requests to retrieve. + :rtype: [GitPullRequest] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if search_criteria is not None: + if search_criteria.repository_id is not None: + query_parameters['searchCriteria.repositoryId'] = search_criteria.repository_id + if search_criteria.creator_id is not None: + query_parameters['searchCriteria.creatorId'] = search_criteria.creator_id + if search_criteria.reviewer_id is not None: + query_parameters['searchCriteria.reviewerId'] = search_criteria.reviewer_id + if search_criteria.status is not None: + query_parameters['searchCriteria.status'] = search_criteria.status + if search_criteria.target_ref_name is not None: + query_parameters['searchCriteria.targetRefName'] = search_criteria.target_ref_name + if search_criteria.source_repository_id is not None: + query_parameters['searchCriteria.sourceRepositoryId'] = search_criteria.source_repository_id + if search_criteria.source_ref_name is not None: + query_parameters['searchCriteria.sourceRefName'] = search_criteria.source_ref_name + if search_criteria.include_links is not None: + query_parameters['searchCriteria.includeLinks'] = search_criteria.include_links + if max_comment_length is not None: + query_parameters['maxCommentLength'] = self._serialize.query('max_comment_length', max_comment_length, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + response = self._send(http_method='GET', + location_id='a5d28130-9cd2-40fa-9f08-902e7daa9efb', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[GitPullRequest]', self._unwrap_collection(response)) + + def create_pull_request(self, git_pull_request_to_create, repository_id, project=None, supports_iterations=None): + """CreatePullRequest. + Create a pull request. + :param :class:` ` git_pull_request_to_create: The pull request to create. + :param str repository_id: The repository ID of the pull request's target branch. + :param str project: Project ID or project name + :param bool supports_iterations: If true, subsequent pushes to the pull request will be individually reviewable. Set this to false for large pull requests for performance reasons if this functionality is not needed. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if supports_iterations is not None: + query_parameters['supportsIterations'] = self._serialize.query('supports_iterations', supports_iterations, 'bool') + content = self._serialize.body(git_pull_request_to_create, 'GitPullRequest') + response = self._send(http_method='POST', + location_id='9946fd70-0d40-406e-b686-b4744cbbcc37', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('GitPullRequest', response) + + def get_pull_request(self, repository_id, pull_request_id, project=None, max_comment_length=None, skip=None, top=None, include_commits=None, include_work_item_refs=None): + """GetPullRequest. + Retrieve a pull request. + :param str repository_id: The repository ID of the pull request's target branch. + :param int pull_request_id: The ID of the pull request to retrieve. + :param str project: Project ID or project name + :param int max_comment_length: Not used. + :param int skip: Not used. + :param int top: Not used. + :param bool include_commits: If true, the pull request will be returned with the associated commits. + :param bool include_work_item_refs: If true, the pull request will be returned with the associated work item references. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + query_parameters = {} + if max_comment_length is not None: + query_parameters['maxCommentLength'] = self._serialize.query('max_comment_length', max_comment_length, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if include_commits is not None: + query_parameters['includeCommits'] = self._serialize.query('include_commits', include_commits, 'bool') + if include_work_item_refs is not None: + query_parameters['includeWorkItemRefs'] = self._serialize.query('include_work_item_refs', include_work_item_refs, 'bool') + response = self._send(http_method='GET', + location_id='9946fd70-0d40-406e-b686-b4744cbbcc37', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('GitPullRequest', response) + + def get_pull_requests(self, repository_id, search_criteria, project=None, max_comment_length=None, skip=None, top=None): + """GetPullRequests. + Retrieve all pull requests matching a specified criteria. + :param str repository_id: The repository ID of the pull request's target branch. + :param :class:` ` search_criteria: Pull requests will be returned that match this search criteria. + :param str project: Project ID or project name + :param int max_comment_length: Not used. + :param int skip: The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100. + :param int top: The number of pull requests to retrieve. + :rtype: [GitPullRequest] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if search_criteria is not None: + if search_criteria.repository_id is not None: + query_parameters['searchCriteria.repositoryId'] = search_criteria.repository_id + if search_criteria.creator_id is not None: + query_parameters['searchCriteria.creatorId'] = search_criteria.creator_id + if search_criteria.reviewer_id is not None: + query_parameters['searchCriteria.reviewerId'] = search_criteria.reviewer_id + if search_criteria.status is not None: + query_parameters['searchCriteria.status'] = search_criteria.status + if search_criteria.target_ref_name is not None: + query_parameters['searchCriteria.targetRefName'] = search_criteria.target_ref_name + if search_criteria.source_repository_id is not None: + query_parameters['searchCriteria.sourceRepositoryId'] = search_criteria.source_repository_id + if search_criteria.source_ref_name is not None: + query_parameters['searchCriteria.sourceRefName'] = search_criteria.source_ref_name + if search_criteria.include_links is not None: + query_parameters['searchCriteria.includeLinks'] = search_criteria.include_links + if max_comment_length is not None: + query_parameters['maxCommentLength'] = self._serialize.query('max_comment_length', max_comment_length, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + response = self._send(http_method='GET', + location_id='9946fd70-0d40-406e-b686-b4744cbbcc37', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[GitPullRequest]', self._unwrap_collection(response)) + + def update_pull_request(self, git_pull_request_to_update, repository_id, pull_request_id, project=None): + """UpdatePullRequest. + Update a pull request + :param :class:` ` git_pull_request_to_update: The pull request content that should be updated. + :param str repository_id: The repository ID of the pull request's target branch. + :param int pull_request_id: ID of the pull request to update. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + content = self._serialize.body(git_pull_request_to_update, 'GitPullRequest') + response = self._send(http_method='PATCH', + location_id='9946fd70-0d40-406e-b686-b4744cbbcc37', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('GitPullRequest', response) + + def create_comment(self, comment, repository_id, pull_request_id, thread_id, project=None): + """CreateComment. + Create a comment on a specific thread in a pull request (up to 500 comments can be created per thread). + :param :class:` ` comment: The comment to create. Comments can be up to 150,000 characters. + :param str repository_id: The repository ID of the pull request's target branch. + :param int pull_request_id: ID of the pull request. + :param int thread_id: ID of the thread that the desired comment is in. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + if thread_id is not None: + route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int') + content = self._serialize.body(comment, 'Comment') + response = self._send(http_method='POST', + location_id='965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('Comment', response) + + def delete_comment(self, repository_id, pull_request_id, thread_id, comment_id, project=None): + """DeleteComment. + Delete a comment associated with a specific thread in a pull request. + :param str repository_id: The repository ID of the pull request's target branch. + :param int pull_request_id: ID of the pull request. + :param int thread_id: ID of the thread that the desired comment is in. + :param int comment_id: ID of the comment. + :param str project: Project ID or project name + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + if thread_id is not None: + route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int') + if comment_id is not None: + route_values['commentId'] = self._serialize.url('comment_id', comment_id, 'int') + self._send(http_method='DELETE', + location_id='965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b', + version='5.1', + route_values=route_values) + + def get_comment(self, repository_id, pull_request_id, thread_id, comment_id, project=None): + """GetComment. + Retrieve a comment associated with a specific thread in a pull request. + :param str repository_id: The repository ID of the pull request's target branch. + :param int pull_request_id: ID of the pull request. + :param int thread_id: ID of the thread that the desired comment is in. + :param int comment_id: ID of the comment. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + if thread_id is not None: + route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int') + if comment_id is not None: + route_values['commentId'] = self._serialize.url('comment_id', comment_id, 'int') + response = self._send(http_method='GET', + location_id='965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b', + version='5.1', + route_values=route_values) + return self._deserialize('Comment', response) + + def get_comments(self, repository_id, pull_request_id, thread_id, project=None): + """GetComments. + Retrieve all comments associated with a specific thread in a pull request. + :param str repository_id: The repository ID of the pull request's target branch. + :param int pull_request_id: ID of the pull request. + :param int thread_id: ID of the thread. + :param str project: Project ID or project name + :rtype: [Comment] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + if thread_id is not None: + route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int') + response = self._send(http_method='GET', + location_id='965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b', + version='5.1', + route_values=route_values) + return self._deserialize('[Comment]', self._unwrap_collection(response)) + + def update_comment(self, comment, repository_id, pull_request_id, thread_id, comment_id, project=None): + """UpdateComment. + Update a comment associated with a specific thread in a pull request. + :param :class:` ` comment: The comment content that should be updated. Comments can be up to 150,000 characters. + :param str repository_id: The repository ID of the pull request's target branch. + :param int pull_request_id: ID of the pull request. + :param int thread_id: ID of the thread that the desired comment is in. + :param int comment_id: ID of the comment to update. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + if thread_id is not None: + route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int') + if comment_id is not None: + route_values['commentId'] = self._serialize.url('comment_id', comment_id, 'int') + content = self._serialize.body(comment, 'Comment') + response = self._send(http_method='PATCH', + location_id='965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('Comment', response) + + def create_thread(self, comment_thread, repository_id, pull_request_id, project=None): + """CreateThread. + Create a thread in a pull request. + :param :class:` ` comment_thread: The thread to create. Thread must contain at least one comment. + :param str repository_id: Repository ID of the pull request's target branch. + :param int pull_request_id: ID of the pull request. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + content = self._serialize.body(comment_thread, 'GitPullRequestCommentThread') + response = self._send(http_method='POST', + location_id='ab6e2e5d-a0b7-4153-b64a-a4efe0d49449', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('GitPullRequestCommentThread', response) + + def get_pull_request_thread(self, repository_id, pull_request_id, thread_id, project=None, iteration=None, base_iteration=None): + """GetPullRequestThread. + Retrieve a thread in a pull request. + :param str repository_id: The repository ID of the pull request's target branch. + :param int pull_request_id: ID of the pull request. + :param int thread_id: ID of the thread. + :param str project: Project ID or project name + :param int iteration: If specified, thread position will be tracked using this iteration as the right side of the diff. + :param int base_iteration: If specified, thread position will be tracked using this iteration as the left side of the diff. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + if thread_id is not None: + route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int') + query_parameters = {} + if iteration is not None: + query_parameters['$iteration'] = self._serialize.query('iteration', iteration, 'int') + if base_iteration is not None: + query_parameters['$baseIteration'] = self._serialize.query('base_iteration', base_iteration, 'int') + response = self._send(http_method='GET', + location_id='ab6e2e5d-a0b7-4153-b64a-a4efe0d49449', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('GitPullRequestCommentThread', response) + + def get_threads(self, repository_id, pull_request_id, project=None, iteration=None, base_iteration=None): + """GetThreads. + Retrieve all threads in a pull request. + :param str repository_id: The repository ID of the pull request's target branch. + :param int pull_request_id: ID of the pull request. + :param str project: Project ID or project name + :param int iteration: If specified, thread positions will be tracked using this iteration as the right side of the diff. + :param int base_iteration: If specified, thread positions will be tracked using this iteration as the left side of the diff. + :rtype: [GitPullRequestCommentThread] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + query_parameters = {} + if iteration is not None: + query_parameters['$iteration'] = self._serialize.query('iteration', iteration, 'int') + if base_iteration is not None: + query_parameters['$baseIteration'] = self._serialize.query('base_iteration', base_iteration, 'int') + response = self._send(http_method='GET', + location_id='ab6e2e5d-a0b7-4153-b64a-a4efe0d49449', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[GitPullRequestCommentThread]', self._unwrap_collection(response)) + + def update_thread(self, comment_thread, repository_id, pull_request_id, thread_id, project=None): + """UpdateThread. + Update a thread in a pull request. + :param :class:` ` comment_thread: The thread content that should be updated. + :param str repository_id: The repository ID of the pull request's target branch. + :param int pull_request_id: ID of the pull request. + :param int thread_id: ID of the thread to update. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + if thread_id is not None: + route_values['threadId'] = self._serialize.url('thread_id', thread_id, 'int') + content = self._serialize.body(comment_thread, 'GitPullRequestCommentThread') + response = self._send(http_method='PATCH', + location_id='ab6e2e5d-a0b7-4153-b64a-a4efe0d49449', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('GitPullRequestCommentThread', response) + + def get_pull_request_work_item_refs(self, repository_id, pull_request_id, project=None): + """GetPullRequestWorkItemRefs. + Retrieve a list of work items associated with a pull request. + :param str repository_id: ID or name of the repository. + :param int pull_request_id: ID of the pull request. + :param str project: Project ID or project name + :rtype: [ResourceRef] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'int') + response = self._send(http_method='GET', + location_id='0a637fcc-5370-4ce8-b0e8-98091f5f9482', + version='5.1', + route_values=route_values) + return self._deserialize('[ResourceRef]', self._unwrap_collection(response)) + + def create_push(self, push, repository_id, project=None): + """CreatePush. + Push changes to the repository. + :param :class:` ` push: + :param str repository_id: The name or ID of the repository. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + content = self._serialize.body(push, 'GitPush') + response = self._send(http_method='POST', + location_id='ea98d07b-3c87-4971-8ede-a613694ffb55', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('GitPush', response) + + def get_push(self, repository_id, push_id, project=None, include_commits=None, include_ref_updates=None): + """GetPush. + Retrieves a particular push. + :param str repository_id: The name or ID of the repository. + :param int push_id: ID of the push. + :param str project: Project ID or project name + :param int include_commits: The number of commits to include in the result. + :param bool include_ref_updates: If true, include the list of refs that were updated by the push. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if push_id is not None: + route_values['pushId'] = self._serialize.url('push_id', push_id, 'int') + query_parameters = {} + if include_commits is not None: + query_parameters['includeCommits'] = self._serialize.query('include_commits', include_commits, 'int') + if include_ref_updates is not None: + query_parameters['includeRefUpdates'] = self._serialize.query('include_ref_updates', include_ref_updates, 'bool') + response = self._send(http_method='GET', + location_id='ea98d07b-3c87-4971-8ede-a613694ffb55', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('GitPush', response) + + def get_pushes(self, repository_id, project=None, skip=None, top=None, search_criteria=None): + """GetPushes. + Retrieves pushes associated with the specified repository. + :param str repository_id: The name or ID of the repository. + :param str project: Project ID or project name + :param int skip: Number of pushes to skip. + :param int top: Number of pushes to return. + :param :class:` ` search_criteria: Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references. + :rtype: [GitPush] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if search_criteria is not None: + if search_criteria.from_date is not None: + query_parameters['searchCriteria.fromDate'] = search_criteria.from_date + if search_criteria.to_date is not None: + query_parameters['searchCriteria.toDate'] = search_criteria.to_date + if search_criteria.pusher_id is not None: + query_parameters['searchCriteria.pusherId'] = search_criteria.pusher_id + if search_criteria.ref_name is not None: + query_parameters['searchCriteria.refName'] = search_criteria.ref_name + if search_criteria.include_ref_updates is not None: + query_parameters['searchCriteria.includeRefUpdates'] = search_criteria.include_ref_updates + if search_criteria.include_links is not None: + query_parameters['searchCriteria.includeLinks'] = search_criteria.include_links + response = self._send(http_method='GET', + location_id='ea98d07b-3c87-4971-8ede-a613694ffb55', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[GitPush]', self._unwrap_collection(response)) + + def get_refs(self, repository_id, project=None, filter=None, include_links=None, include_statuses=None, include_my_branches=None, latest_statuses_only=None, peel_tags=None, filter_contains=None, top=None, continuation_token=None): + """GetRefs. + Queries the provided repository for its refs and returns them. + :param str repository_id: The name or ID of the repository. + :param str project: Project ID or project name + :param str filter: [optional] A filter to apply to the refs (starts with). + :param bool include_links: [optional] Specifies if referenceLinks should be included in the result. default is false. + :param bool include_statuses: [optional] Includes up to the first 1000 commit statuses for each ref. The default value is false. + :param bool include_my_branches: [optional] Includes only branches that the user owns, the branches the user favorites, and the default branch. The default value is false. Cannot be combined with the filter parameter. + :param bool latest_statuses_only: [optional] True to include only the tip commit status for each ref. This option requires `includeStatuses` to be true. The default value is false. + :param bool peel_tags: [optional] Annotated tags will populate the PeeledObjectId property. default is false. + :param str filter_contains: [optional] A filter to apply to the refs (contains). + :param int top: [optional] Maximum number of refs to return. It cannot be bigger than 1000. If it is not provided but continuationToken is, top will default to 100. + :param str continuation_token: The continuation token used for pagination. + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if filter is not None: + query_parameters['filter'] = self._serialize.query('filter', filter, 'str') + if include_links is not None: + query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool') + if include_statuses is not None: + query_parameters['includeStatuses'] = self._serialize.query('include_statuses', include_statuses, 'bool') + if include_my_branches is not None: + query_parameters['includeMyBranches'] = self._serialize.query('include_my_branches', include_my_branches, 'bool') + if latest_statuses_only is not None: + query_parameters['latestStatusesOnly'] = self._serialize.query('latest_statuses_only', latest_statuses_only, 'bool') + if peel_tags is not None: + query_parameters['peelTags'] = self._serialize.query('peel_tags', peel_tags, 'bool') + if filter_contains is not None: + query_parameters['filterContains'] = self._serialize.query('filter_contains', filter_contains, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + response = self._send(http_method='GET', + location_id='2d874a60-a811-4f62-9c9f-963a6ea0a55b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[GitRef]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetRefsResponseValue(response_value, continuation_token) + + class GetRefsResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_refs method + + :param value: + :type value: :class:`<[GitRef]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def update_ref(self, new_ref_info, repository_id, filter, project=None, project_id=None): + """UpdateRef. + Lock or Unlock a branch. + :param :class:` ` new_ref_info: The ref update action (lock/unlock) to perform + :param str repository_id: The name or ID of the repository. + :param str filter: The name of the branch to lock/unlock + :param str project: Project ID or project name + :param str project_id: ID or name of the team project. Optional if specifying an ID for repository. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if filter is not None: + query_parameters['filter'] = self._serialize.query('filter', filter, 'str') + if project_id is not None: + query_parameters['projectId'] = self._serialize.query('project_id', project_id, 'str') + content = self._serialize.body(new_ref_info, 'GitRefUpdate') + response = self._send(http_method='PATCH', + location_id='2d874a60-a811-4f62-9c9f-963a6ea0a55b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('GitRef', response) + + def update_refs(self, ref_updates, repository_id, project=None, project_id=None): + """UpdateRefs. + Creating, updating, or deleting refs(branches). + :param [GitRefUpdate] ref_updates: List of ref updates to attempt to perform + :param str repository_id: The name or ID of the repository. + :param str project: Project ID or project name + :param str project_id: ID or name of the team project. Optional if specifying an ID for repository. + :rtype: [GitRefUpdateResult] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if project_id is not None: + query_parameters['projectId'] = self._serialize.query('project_id', project_id, 'str') + content = self._serialize.body(ref_updates, '[GitRefUpdate]') + response = self._send(http_method='POST', + location_id='2d874a60-a811-4f62-9c9f-963a6ea0a55b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('[GitRefUpdateResult]', self._unwrap_collection(response)) + + def create_repository(self, git_repository_to_create, project=None, source_ref=None): + """CreateRepository. + Create a git repository in a team project. + :param :class:` ` git_repository_to_create: Specify the repo name, team project and/or parent repository. Team project information can be omitted from gitRepositoryToCreate if the request is project-scoped (i.e., includes project Id). + :param str project: Project ID or project name + :param str source_ref: [optional] Specify the source refs to use while creating a fork repo + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if source_ref is not None: + query_parameters['sourceRef'] = self._serialize.query('source_ref', source_ref, 'str') + content = self._serialize.body(git_repository_to_create, 'GitRepositoryCreateOptions') + response = self._send(http_method='POST', + location_id='225f7195-f9c7-4d14-ab28-a83f7ff77e1f', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('GitRepository', response) + + def delete_repository(self, repository_id, project=None): + """DeleteRepository. + Delete a git repository + :param str repository_id: The name or ID of the repository. + :param str project: Project ID or project name + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + self._send(http_method='DELETE', + location_id='225f7195-f9c7-4d14-ab28-a83f7ff77e1f', + version='5.1', + route_values=route_values) + + def get_repositories(self, project=None, include_links=None, include_all_urls=None, include_hidden=None): + """GetRepositories. + Retrieve git repositories. + :param str project: Project ID or project name + :param bool include_links: [optional] True to include reference links. The default value is false. + :param bool include_all_urls: [optional] True to include all remote URLs. The default value is false. + :param bool include_hidden: [optional] True to include hidden repositories. The default value is false. + :rtype: [GitRepository] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if include_links is not None: + query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool') + if include_all_urls is not None: + query_parameters['includeAllUrls'] = self._serialize.query('include_all_urls', include_all_urls, 'bool') + if include_hidden is not None: + query_parameters['includeHidden'] = self._serialize.query('include_hidden', include_hidden, 'bool') + response = self._send(http_method='GET', + location_id='225f7195-f9c7-4d14-ab28-a83f7ff77e1f', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[GitRepository]', self._unwrap_collection(response)) + + def get_repository(self, repository_id, project=None): + """GetRepository. + Retrieve a git repository. + :param str repository_id: The name or ID of the repository. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + response = self._send(http_method='GET', + location_id='225f7195-f9c7-4d14-ab28-a83f7ff77e1f', + version='5.1', + route_values=route_values) + return self._deserialize('GitRepository', response) + + def get_repository_with_parent(self, repository_id, include_parent, project=None): + """GetRepositoryWithParent. + Retrieve a git repository. + :param str repository_id: The name or ID of the repository. + :param bool include_parent: True to include parent repository. Only available in authenticated calls. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if include_parent is not None: + query_parameters['includeParent'] = self._serialize.query('include_parent', include_parent, 'bool') + response = self._send(http_method='GET', + location_id='225f7195-f9c7-4d14-ab28-a83f7ff77e1f', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('GitRepository', response) + + def update_repository(self, new_repository_info, repository_id, project=None): + """UpdateRepository. + Updates the Git repository with either a new repo name or a new default branch. + :param :class:` ` new_repository_info: Specify a new repo name or a new default branch of the repository + :param str repository_id: The name or ID of the repository. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + content = self._serialize.body(new_repository_info, 'GitRepository') + response = self._send(http_method='PATCH', + location_id='225f7195-f9c7-4d14-ab28-a83f7ff77e1f', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('GitRepository', response) + + def create_commit_status(self, git_commit_status_to_create, commit_id, repository_id, project=None): + """CreateCommitStatus. + Create Git commit status. + :param :class:` ` git_commit_status_to_create: Git commit status object to create. + :param str commit_id: ID of the Git commit. + :param str repository_id: ID of the repository. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if commit_id is not None: + route_values['commitId'] = self._serialize.url('commit_id', commit_id, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + content = self._serialize.body(git_commit_status_to_create, 'GitStatus') + response = self._send(http_method='POST', + location_id='428dd4fb-fda5-4722-af02-9313b80305da', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('GitStatus', response) + + def get_statuses(self, commit_id, repository_id, project=None, top=None, skip=None, latest_only=None): + """GetStatuses. + Get statuses associated with the Git commit. + :param str commit_id: ID of the Git commit. + :param str repository_id: ID of the repository. + :param str project: Project ID or project name + :param int top: Optional. The number of statuses to retrieve. Default is 1000. + :param int skip: Optional. The number of statuses to ignore. Default is 0. For example, to retrieve results 101-150, set top to 50 and skip to 100. + :param bool latest_only: The flag indicates whether to get only latest statuses grouped by `Context.Name` and `Context.Genre`. + :rtype: [GitStatus] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if commit_id is not None: + route_values['commitId'] = self._serialize.url('commit_id', commit_id, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + query_parameters = {} + if top is not None: + query_parameters['top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['skip'] = self._serialize.query('skip', skip, 'int') + if latest_only is not None: + query_parameters['latestOnly'] = self._serialize.query('latest_only', latest_only, 'bool') + response = self._send(http_method='GET', + location_id='428dd4fb-fda5-4722-af02-9313b80305da', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[GitStatus]', self._unwrap_collection(response)) + + def get_tree(self, repository_id, sha1, project=None, project_id=None, recursive=None, file_name=None): + """GetTree. + The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository. + :param str repository_id: Repository Id. + :param str sha1: SHA1 hash of the tree object. + :param str project: Project ID or project name + :param str project_id: Project Id. + :param bool recursive: Search recursively. Include trees underneath this tree. Default is false. + :param str file_name: Name to use if a .zip file is returned. Default is the object ID. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if sha1 is not None: + route_values['sha1'] = self._serialize.url('sha1', sha1, 'str') + query_parameters = {} + if project_id is not None: + query_parameters['projectId'] = self._serialize.query('project_id', project_id, 'str') + if recursive is not None: + query_parameters['recursive'] = self._serialize.query('recursive', recursive, 'bool') + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + response = self._send(http_method='GET', + location_id='729f6437-6f92-44ec-8bee-273a7111063c', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('GitTreeRef', response) + + def get_tree_zip(self, repository_id, sha1, project=None, project_id=None, recursive=None, file_name=None, **kwargs): + """GetTreeZip. + The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository. + :param str repository_id: Repository Id. + :param str sha1: SHA1 hash of the tree object. + :param str project: Project ID or project name + :param str project_id: Project Id. + :param bool recursive: Search recursively. Include trees underneath this tree. Default is false. + :param str file_name: Name to use if a .zip file is returned. Default is the object ID. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repository_id is not None: + route_values['repositoryId'] = self._serialize.url('repository_id', repository_id, 'str') + if sha1 is not None: + route_values['sha1'] = self._serialize.url('sha1', sha1, 'str') + query_parameters = {} + if project_id is not None: + query_parameters['projectId'] = self._serialize.query('project_id', project_id, 'str') + if recursive is not None: + query_parameters['recursive'] = self._serialize.query('recursive', recursive, 'bool') + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + response = self._send(http_method='GET', + location_id='729f6437-6f92-44ec-8bee-273a7111063c', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + diff --git a/azure-devops/azure/devops/released/identity/__init__.py b/azure-devops/azure/devops/released/identity/__init__.py new file mode 100644 index 00000000..5cedcefb --- /dev/null +++ b/azure-devops/azure/devops/released/identity/__init__.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.identity.models import * +from .identity_client import IdentityClient + +__all__ = [ + 'AccessTokenResult', + 'AuthorizationGrant', + 'ChangedIdentities', + 'ChangedIdentitiesContext', + 'CreateScopeInfo', + 'FrameworkIdentityInfo', + 'GroupMembership', + 'Identity', + 'IdentityBase', + 'IdentityBatchInfo', + 'IdentityScope', + 'IdentitySelf', + 'IdentitySnapshot', + 'IdentityUpdateData', + 'JsonPatchOperation', + 'JsonWebToken', + 'RefreshTokenGrant', + 'SwapIdentityInfo', + 'TenantInfo', + 'IdentityClient' +] diff --git a/azure-devops/azure/devops/released/identity/identity_client.py b/azure-devops/azure/devops/released/identity/identity_client.py new file mode 100644 index 00000000..fe0745b1 --- /dev/null +++ b/azure-devops/azure/devops/released/identity/identity_client.py @@ -0,0 +1,256 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.identity import models + + +class IdentityClient(Client): + """Identity + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(IdentityClient, 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 = '8a3d49b8-91f0-46ef-b33d-dda338c25db3' + + def create_groups(self, container): + """CreateGroups. + :param :class:` ` container: + :rtype: [Identity] + """ + content = self._serialize.body(container, 'object') + response = self._send(http_method='POST', + location_id='5966283b-4196-4d57-9211-1b68f41ec1c2', + version='5.1', + content=content) + return self._deserialize('[Identity]', self._unwrap_collection(response)) + + def delete_group(self, group_id): + """DeleteGroup. + :param str group_id: + """ + route_values = {} + if group_id is not None: + route_values['groupId'] = self._serialize.url('group_id', group_id, 'str') + self._send(http_method='DELETE', + location_id='5966283b-4196-4d57-9211-1b68f41ec1c2', + version='5.1', + route_values=route_values) + + def list_groups(self, scope_ids=None, recurse=None, deleted=None, properties=None): + """ListGroups. + :param str scope_ids: + :param bool recurse: + :param bool deleted: + :param str properties: + :rtype: [Identity] + """ + query_parameters = {} + if scope_ids is not None: + query_parameters['scopeIds'] = self._serialize.query('scope_ids', scope_ids, 'str') + if recurse is not None: + query_parameters['recurse'] = self._serialize.query('recurse', recurse, 'bool') + if deleted is not None: + query_parameters['deleted'] = self._serialize.query('deleted', deleted, 'bool') + if properties is not None: + query_parameters['properties'] = self._serialize.query('properties', properties, 'str') + response = self._send(http_method='GET', + location_id='5966283b-4196-4d57-9211-1b68f41ec1c2', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[Identity]', self._unwrap_collection(response)) + + def get_identity_changes(self, identity_sequence_id, group_sequence_id, organization_identity_sequence_id=None, page_size=None, scope_id=None): + """GetIdentityChanges. + :param int identity_sequence_id: + :param int group_sequence_id: + :param int organization_identity_sequence_id: + :param int page_size: + :param str scope_id: + :rtype: :class:` ` + """ + query_parameters = {} + if identity_sequence_id is not None: + query_parameters['identitySequenceId'] = self._serialize.query('identity_sequence_id', identity_sequence_id, 'int') + if group_sequence_id is not None: + query_parameters['groupSequenceId'] = self._serialize.query('group_sequence_id', group_sequence_id, 'int') + if organization_identity_sequence_id is not None: + query_parameters['organizationIdentitySequenceId'] = self._serialize.query('organization_identity_sequence_id', organization_identity_sequence_id, 'int') + if page_size is not None: + query_parameters['pageSize'] = self._serialize.query('page_size', page_size, 'int') + if scope_id is not None: + query_parameters['scopeId'] = self._serialize.query('scope_id', scope_id, 'str') + response = self._send(http_method='GET', + location_id='28010c54-d0c0-4c89-a5b0-1c9e188b9fb7', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('ChangedIdentities', response) + + def get_user_identity_ids_by_domain_id(self, domain_id): + """GetUserIdentityIdsByDomainId. + :param str domain_id: + :rtype: [str] + """ + query_parameters = {} + if domain_id is not None: + query_parameters['domainId'] = self._serialize.query('domain_id', domain_id, 'str') + response = self._send(http_method='GET', + location_id='28010c54-d0c0-4c89-a5b0-1c9e188b9fb7', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def read_identities(self, descriptors=None, identity_ids=None, subject_descriptors=None, social_descriptors=None, search_filter=None, filter_value=None, query_membership=None, properties=None, include_restricted_visibility=None, options=None): + """ReadIdentities. + :param str descriptors: + :param str identity_ids: + :param str subject_descriptors: + :param str social_descriptors: + :param str search_filter: + :param str filter_value: + :param str query_membership: + :param str properties: + :param bool include_restricted_visibility: + :param str options: + :rtype: [Identity] + """ + query_parameters = {} + if descriptors is not None: + query_parameters['descriptors'] = self._serialize.query('descriptors', descriptors, 'str') + if identity_ids is not None: + query_parameters['identityIds'] = self._serialize.query('identity_ids', identity_ids, 'str') + if subject_descriptors is not None: + query_parameters['subjectDescriptors'] = self._serialize.query('subject_descriptors', subject_descriptors, 'str') + if social_descriptors is not None: + query_parameters['socialDescriptors'] = self._serialize.query('social_descriptors', social_descriptors, 'str') + if search_filter is not None: + query_parameters['searchFilter'] = self._serialize.query('search_filter', search_filter, 'str') + if filter_value is not None: + query_parameters['filterValue'] = self._serialize.query('filter_value', filter_value, 'str') + if query_membership is not None: + query_parameters['queryMembership'] = self._serialize.query('query_membership', query_membership, 'str') + if properties is not None: + query_parameters['properties'] = self._serialize.query('properties', properties, 'str') + if include_restricted_visibility is not None: + query_parameters['includeRestrictedVisibility'] = self._serialize.query('include_restricted_visibility', include_restricted_visibility, 'bool') + if options is not None: + query_parameters['options'] = self._serialize.query('options', options, 'str') + response = self._send(http_method='GET', + location_id='28010c54-d0c0-4c89-a5b0-1c9e188b9fb7', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[Identity]', self._unwrap_collection(response)) + + def read_identities_by_scope(self, scope_id, query_membership=None, properties=None): + """ReadIdentitiesByScope. + :param str scope_id: + :param str query_membership: + :param str properties: + :rtype: [Identity] + """ + query_parameters = {} + if scope_id is not None: + query_parameters['scopeId'] = self._serialize.query('scope_id', scope_id, 'str') + if query_membership is not None: + query_parameters['queryMembership'] = self._serialize.query('query_membership', query_membership, 'str') + if properties is not None: + query_parameters['properties'] = self._serialize.query('properties', properties, 'str') + response = self._send(http_method='GET', + location_id='28010c54-d0c0-4c89-a5b0-1c9e188b9fb7', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[Identity]', self._unwrap_collection(response)) + + def read_identity(self, identity_id, query_membership=None, properties=None): + """ReadIdentity. + :param str identity_id: + :param str query_membership: + :param str properties: + :rtype: :class:` ` + """ + route_values = {} + if identity_id is not None: + route_values['identityId'] = self._serialize.url('identity_id', identity_id, 'str') + query_parameters = {} + if query_membership is not None: + query_parameters['queryMembership'] = self._serialize.query('query_membership', query_membership, 'str') + if properties is not None: + query_parameters['properties'] = self._serialize.query('properties', properties, 'str') + response = self._send(http_method='GET', + location_id='28010c54-d0c0-4c89-a5b0-1c9e188b9fb7', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('Identity', response) + + def update_identities(self, identities): + """UpdateIdentities. + :param :class:` ` identities: + :rtype: [IdentityUpdateData] + """ + content = self._serialize.body(identities, 'VssJsonCollectionWrapper') + response = self._send(http_method='PUT', + location_id='28010c54-d0c0-4c89-a5b0-1c9e188b9fb7', + version='5.1', + content=content) + return self._deserialize('[IdentityUpdateData]', self._unwrap_collection(response)) + + def update_identity(self, identity, identity_id): + """UpdateIdentity. + :param :class:` ` identity: + :param str identity_id: + """ + route_values = {} + if identity_id is not None: + route_values['identityId'] = self._serialize.url('identity_id', identity_id, 'str') + content = self._serialize.body(identity, 'Identity') + self._send(http_method='PUT', + location_id='28010c54-d0c0-4c89-a5b0-1c9e188b9fb7', + version='5.1', + route_values=route_values, + content=content) + + def create_identity(self, framework_identity_info): + """CreateIdentity. + :param :class:` ` framework_identity_info: + :rtype: :class:` ` + """ + content = self._serialize.body(framework_identity_info, 'FrameworkIdentityInfo') + response = self._send(http_method='PUT', + location_id='dd55f0eb-6ea2-4fe4-9ebe-919e7dd1dfb4', + version='5.1', + content=content) + return self._deserialize('Identity', response) + + def get_max_sequence_id(self): + """GetMaxSequenceId. + Read the max sequence id of all the identities. + :rtype: long + """ + response = self._send(http_method='GET', + location_id='e4a70778-cb2c-4e85-b7cc-3f3c7ae2d408', + version='5.1') + return self._deserialize('long', response) + + def get_self(self): + """GetSelf. + Read identity of the home tenant request user. + :rtype: :class:` ` + """ + response = self._send(http_method='GET', + location_id='4bb02b5b-c120-4be2-b68e-21f7c50a4b82', + version='5.1') + return self._deserialize('IdentitySelf', response) + diff --git a/azure-devops/azure/devops/released/notification/__init__.py b/azure-devops/azure/devops/released/notification/__init__.py new file mode 100644 index 00000000..a6a19d06 --- /dev/null +++ b/azure-devops/azure/devops/released/notification/__init__.py @@ -0,0 +1,76 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.notification.models import * +from .notification_client import NotificationClient + +__all__ = [ + 'ArtifactFilter', + 'BaseSubscriptionFilter', + 'BatchNotificationOperation', + 'EventActor', + 'EventScope', + 'EventsEvaluationResult', + 'EventTransformRequest', + 'EventTransformResult', + 'ExpressionFilterClause', + 'ExpressionFilterGroup', + 'ExpressionFilterModel', + 'FieldInputValues', + 'FieldValuesQuery', + 'GraphSubjectBase', + 'IdentityRef', + 'INotificationDiagnosticLog', + 'InputValue', + 'InputValues', + 'InputValuesError', + 'InputValuesQuery', + 'ISubscriptionChannel', + 'ISubscriptionFilter', + 'NotificationAdminSettings', + 'NotificationAdminSettingsUpdateParameters', + 'NotificationDiagnosticLogMessage', + 'NotificationEventField', + 'NotificationEventFieldOperator', + 'NotificationEventFieldType', + 'NotificationEventPublisher', + 'NotificationEventRole', + 'NotificationEventType', + 'NotificationEventTypeCategory', + 'NotificationQueryCondition', + 'NotificationReason', + 'NotificationsEvaluationResult', + 'NotificationStatistic', + 'NotificationStatisticsQuery', + 'NotificationStatisticsQueryConditions', + 'NotificationSubscriber', + 'NotificationSubscriberUpdateParameters', + 'NotificationSubscription', + 'NotificationSubscriptionCreateParameters', + 'NotificationSubscriptionTemplate', + 'NotificationSubscriptionUpdateParameters', + 'OperatorConstraint', + 'ReferenceLinks', + 'SubscriptionAdminSettings', + 'SubscriptionChannelWithAddress', + 'SubscriptionDiagnostics', + 'SubscriptionEvaluationRequest', + 'SubscriptionEvaluationResult', + 'SubscriptionEvaluationSettings', + 'SubscriptionManagement', + 'SubscriptionQuery', + 'SubscriptionQueryCondition', + 'SubscriptionScope', + 'SubscriptionTracing', + 'SubscriptionUserSettings', + 'UpdateSubscripitonDiagnosticsParameters', + 'UpdateSubscripitonTracingParameters', + 'ValueDefinition', + 'VssNotificationEvent', + 'NotificationClient' +] diff --git a/azure-devops/azure/devops/released/notification/notification_client.py b/azure-devops/azure/devops/released/notification/notification_client.py new file mode 100644 index 00000000..12a2656f --- /dev/null +++ b/azure-devops/azure/devops/released/notification/notification_client.py @@ -0,0 +1,300 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.notification import models + + +class NotificationClient(Client): + """Notification + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(NotificationClient, 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 = None + + def list_logs(self, source, entry_id=None, start_time=None, end_time=None): + """ListLogs. + Get a list of diagnostic logs for this service. + :param str source: ID specifying which type of logs to check diagnostics for. + :param str entry_id: The ID of the specific log to query for. + :param datetime start_time: Start time for the time range to query in. + :param datetime end_time: End time for the time range to query in. + :rtype: [INotificationDiagnosticLog] + """ + route_values = {} + if source is not None: + route_values['source'] = self._serialize.url('source', source, 'str') + if entry_id is not None: + route_values['entryId'] = self._serialize.url('entry_id', entry_id, 'str') + query_parameters = {} + if start_time is not None: + query_parameters['startTime'] = self._serialize.query('start_time', start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query('end_time', end_time, 'iso-8601') + response = self._send(http_method='GET', + location_id='991842f3-eb16-4aea-ac81-81353ef2b75c', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[INotificationDiagnosticLog]', self._unwrap_collection(response)) + + def get_subscription_diagnostics(self, subscription_id): + """GetSubscriptionDiagnostics. + Get the diagnostics settings for a subscription. + :param str subscription_id: The id of the notifications subscription. + :rtype: :class:` ` + """ + route_values = {} + if subscription_id is not None: + route_values['subscriptionId'] = self._serialize.url('subscription_id', subscription_id, 'str') + response = self._send(http_method='GET', + location_id='20f1929d-4be7-4c2e-a74e-d47640ff3418', + version='5.1', + route_values=route_values) + return self._deserialize('SubscriptionDiagnostics', response) + + def update_subscription_diagnostics(self, update_parameters, subscription_id): + """UpdateSubscriptionDiagnostics. + Update the diagnostics settings for a subscription. + :param :class:` ` update_parameters: + :param str subscription_id: The id of the notifications subscription. + :rtype: :class:` ` + """ + route_values = {} + if subscription_id is not None: + route_values['subscriptionId'] = self._serialize.url('subscription_id', subscription_id, 'str') + content = self._serialize.body(update_parameters, 'UpdateSubscripitonDiagnosticsParameters') + response = self._send(http_method='PUT', + location_id='20f1929d-4be7-4c2e-a74e-d47640ff3418', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('SubscriptionDiagnostics', response) + + def get_event_type(self, event_type): + """GetEventType. + Get a specific event type. + :param str event_type: The ID of the event type. + :rtype: :class:` ` + """ + route_values = {} + if event_type is not None: + route_values['eventType'] = self._serialize.url('event_type', event_type, 'str') + response = self._send(http_method='GET', + location_id='cc84fb5f-6247-4c7a-aeae-e5a3c3fddb21', + version='5.1', + route_values=route_values) + return self._deserialize('NotificationEventType', response) + + def list_event_types(self, publisher_id=None): + """ListEventTypes. + List available event types for this service. Optionally filter by only event types for the specified publisher. + :param str publisher_id: Limit to event types for this publisher + :rtype: [NotificationEventType] + """ + query_parameters = {} + if publisher_id is not None: + query_parameters['publisherId'] = self._serialize.query('publisher_id', publisher_id, 'str') + response = self._send(http_method='GET', + location_id='cc84fb5f-6247-4c7a-aeae-e5a3c3fddb21', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[NotificationEventType]', self._unwrap_collection(response)) + + def get_settings(self): + """GetSettings. + :rtype: :class:` ` + """ + response = self._send(http_method='GET', + location_id='cbe076d8-2803-45ff-8d8d-44653686ea2a', + version='5.1') + return self._deserialize('NotificationAdminSettings', response) + + def update_settings(self, update_parameters): + """UpdateSettings. + :param :class:` ` update_parameters: + :rtype: :class:` ` + """ + content = self._serialize.body(update_parameters, 'NotificationAdminSettingsUpdateParameters') + response = self._send(http_method='PATCH', + location_id='cbe076d8-2803-45ff-8d8d-44653686ea2a', + version='5.1', + content=content) + return self._deserialize('NotificationAdminSettings', response) + + def get_subscriber(self, subscriber_id): + """GetSubscriber. + Get delivery preferences of a notifications subscriber. + :param str subscriber_id: ID of the user or group. + :rtype: :class:` ` + """ + route_values = {} + if subscriber_id is not None: + route_values['subscriberId'] = self._serialize.url('subscriber_id', subscriber_id, 'str') + response = self._send(http_method='GET', + location_id='4d5caff1-25ba-430b-b808-7a1f352cc197', + version='5.1', + route_values=route_values) + return self._deserialize('NotificationSubscriber', response) + + def update_subscriber(self, update_parameters, subscriber_id): + """UpdateSubscriber. + Update delivery preferences of a notifications subscriber. + :param :class:` ` update_parameters: + :param str subscriber_id: ID of the user or group. + :rtype: :class:` ` + """ + route_values = {} + if subscriber_id is not None: + route_values['subscriberId'] = self._serialize.url('subscriber_id', subscriber_id, 'str') + content = self._serialize.body(update_parameters, 'NotificationSubscriberUpdateParameters') + response = self._send(http_method='PATCH', + location_id='4d5caff1-25ba-430b-b808-7a1f352cc197', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('NotificationSubscriber', response) + + def query_subscriptions(self, subscription_query): + """QuerySubscriptions. + Query for subscriptions. A subscription is returned if it matches one or more of the specified conditions. + :param :class:` ` subscription_query: + :rtype: [NotificationSubscription] + """ + content = self._serialize.body(subscription_query, 'SubscriptionQuery') + response = self._send(http_method='POST', + location_id='6864db85-08c0-4006-8e8e-cc1bebe31675', + version='5.1', + content=content) + return self._deserialize('[NotificationSubscription]', self._unwrap_collection(response)) + + def create_subscription(self, create_parameters): + """CreateSubscription. + Create a new subscription. + :param :class:` ` create_parameters: + :rtype: :class:` ` + """ + content = self._serialize.body(create_parameters, 'NotificationSubscriptionCreateParameters') + response = self._send(http_method='POST', + location_id='70f911d6-abac-488c-85b3-a206bf57e165', + version='5.1', + content=content) + return self._deserialize('NotificationSubscription', response) + + def delete_subscription(self, subscription_id): + """DeleteSubscription. + Delete a subscription. + :param str subscription_id: + """ + route_values = {} + if subscription_id is not None: + route_values['subscriptionId'] = self._serialize.url('subscription_id', subscription_id, 'str') + self._send(http_method='DELETE', + location_id='70f911d6-abac-488c-85b3-a206bf57e165', + version='5.1', + route_values=route_values) + + def get_subscription(self, subscription_id, query_flags=None): + """GetSubscription. + Get a notification subscription by its ID. + :param str subscription_id: + :param str query_flags: + :rtype: :class:` ` + """ + route_values = {} + if subscription_id is not None: + route_values['subscriptionId'] = self._serialize.url('subscription_id', subscription_id, 'str') + query_parameters = {} + if query_flags is not None: + query_parameters['queryFlags'] = self._serialize.query('query_flags', query_flags, 'str') + response = self._send(http_method='GET', + location_id='70f911d6-abac-488c-85b3-a206bf57e165', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('NotificationSubscription', response) + + def list_subscriptions(self, target_id=None, ids=None, query_flags=None): + """ListSubscriptions. + Get a list of notification subscriptions, either by subscription IDs or by all subscriptions for a given user or group. + :param str target_id: User or Group ID + :param [str] ids: List of subscription IDs + :param str query_flags: + :rtype: [NotificationSubscription] + """ + query_parameters = {} + if target_id is not None: + query_parameters['targetId'] = self._serialize.query('target_id', target_id, 'str') + if ids is not None: + ids = ",".join(ids) + query_parameters['ids'] = self._serialize.query('ids', ids, 'str') + if query_flags is not None: + query_parameters['queryFlags'] = self._serialize.query('query_flags', query_flags, 'str') + response = self._send(http_method='GET', + location_id='70f911d6-abac-488c-85b3-a206bf57e165', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[NotificationSubscription]', self._unwrap_collection(response)) + + def update_subscription(self, update_parameters, subscription_id): + """UpdateSubscription. + Update an existing subscription. Depending on the type of subscription and permissions, the caller can update the description, filter settings, channel (delivery) settings and more. + :param :class:` ` update_parameters: + :param str subscription_id: + :rtype: :class:` ` + """ + route_values = {} + if subscription_id is not None: + route_values['subscriptionId'] = self._serialize.url('subscription_id', subscription_id, 'str') + content = self._serialize.body(update_parameters, 'NotificationSubscriptionUpdateParameters') + response = self._send(http_method='PATCH', + location_id='70f911d6-abac-488c-85b3-a206bf57e165', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('NotificationSubscription', response) + + def get_subscription_templates(self): + """GetSubscriptionTemplates. + Get available subscription templates. + :rtype: [NotificationSubscriptionTemplate] + """ + response = self._send(http_method='GET', + location_id='fa5d24ba-7484-4f3d-888d-4ec6b1974082', + version='5.1') + return self._deserialize('[NotificationSubscriptionTemplate]', self._unwrap_collection(response)) + + def update_subscription_user_settings(self, user_settings, subscription_id, user_id): + """UpdateSubscriptionUserSettings. + Update the specified user's settings for the specified subscription. This API is typically used to opt in or out of a shared subscription. User settings can only be applied to shared subscriptions, like team subscriptions or default subscriptions. + :param :class:` ` user_settings: + :param str subscription_id: + :param str user_id: ID of the user + :rtype: :class:` ` + """ + route_values = {} + if subscription_id is not None: + route_values['subscriptionId'] = self._serialize.url('subscription_id', subscription_id, 'str') + if user_id is not None: + route_values['userId'] = self._serialize.url('user_id', user_id, 'str') + content = self._serialize.body(user_settings, 'SubscriptionUserSettings') + response = self._send(http_method='PUT', + location_id='ed5a3dff-aeb5-41b1-b4f7-89e66e58b62e', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('SubscriptionUserSettings', response) + diff --git a/azure-devops/azure/devops/released/operations/__init__.py b/azure-devops/azure/devops/released/operations/__init__.py new file mode 100644 index 00000000..3f90db75 --- /dev/null +++ b/azure-devops/azure/devops/released/operations/__init__.py @@ -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 ...v5_1.operations.models import * +from .operations_client import OperationsClient + +__all__ = [ + 'Operation', + 'OperationReference', + 'OperationResultReference', + 'ReferenceLinks', + 'OperationsClient' +] diff --git a/azure-devops/azure/devops/released/operations/operations_client.py b/azure-devops/azure/devops/released/operations/operations_client.py new file mode 100644 index 00000000..257a8de2 --- /dev/null +++ b/azure-devops/azure/devops/released/operations/operations_client.py @@ -0,0 +1,47 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.operations import models + + +class OperationsClient(Client): + """Operations + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(OperationsClient, 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 = None + + def get_operation(self, operation_id, plugin_id=None): + """GetOperation. + Gets an operation from the the operationId using the given pluginId. + :param str operation_id: The ID for the operation. + :param str plugin_id: The ID for the plugin. + :rtype: :class:` ` + """ + route_values = {} + if operation_id is not None: + route_values['operationId'] = self._serialize.url('operation_id', operation_id, 'str') + query_parameters = {} + if plugin_id is not None: + query_parameters['pluginId'] = self._serialize.query('plugin_id', plugin_id, 'str') + response = self._send(http_method='GET', + location_id='9a1b74b4-2ca8-4a9f-8470-c2f2e6fdc949', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('Operation', response) + diff --git a/azure-devops/azure/devops/released/policy/__init__.py b/azure-devops/azure/devops/released/policy/__init__.py new file mode 100644 index 00000000..4e5b9b52 --- /dev/null +++ b/azure-devops/azure/devops/released/policy/__init__.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.policy.models import * +from .policy_client import PolicyClient + +__all__ = [ + 'GraphSubjectBase', + 'IdentityRef', + 'PolicyConfiguration', + 'PolicyConfigurationRef', + 'PolicyEvaluationRecord', + 'PolicyType', + 'PolicyTypeRef', + 'ReferenceLinks', + 'VersionedPolicyConfigurationRef', + 'PolicyClient' +] diff --git a/azure-devops/azure/devops/released/policy/policy_client.py b/azure-devops/azure/devops/released/policy/policy_client.py new file mode 100644 index 00000000..31feca13 --- /dev/null +++ b/azure-devops/azure/devops/released/policy/policy_client.py @@ -0,0 +1,227 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.policy import models + + +class PolicyClient(Client): + """Policy + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(PolicyClient, 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 = 'fb13a388-40dd-4a04-b530-013a739c72ef' + + def create_policy_configuration(self, configuration, project, configuration_id=None): + """CreatePolicyConfiguration. + Create a policy configuration of a given policy type. + :param :class:` ` configuration: The policy configuration to create. + :param str project: Project ID or project name + :param int configuration_id: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if configuration_id is not None: + route_values['configurationId'] = self._serialize.url('configuration_id', configuration_id, 'int') + content = self._serialize.body(configuration, 'PolicyConfiguration') + response = self._send(http_method='POST', + location_id='dad91cbe-d183-45f8-9c6e-9c1164472121', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('PolicyConfiguration', response) + + def delete_policy_configuration(self, project, configuration_id): + """DeletePolicyConfiguration. + Delete a policy configuration by its ID. + :param str project: Project ID or project name + :param int configuration_id: ID of the policy configuration to delete. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if configuration_id is not None: + route_values['configurationId'] = self._serialize.url('configuration_id', configuration_id, 'int') + self._send(http_method='DELETE', + location_id='dad91cbe-d183-45f8-9c6e-9c1164472121', + version='5.1', + route_values=route_values) + + def get_policy_configuration(self, project, configuration_id): + """GetPolicyConfiguration. + Get a policy configuration by its ID. + :param str project: Project ID or project name + :param int configuration_id: ID of the policy configuration + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if configuration_id is not None: + route_values['configurationId'] = self._serialize.url('configuration_id', configuration_id, 'int') + response = self._send(http_method='GET', + location_id='dad91cbe-d183-45f8-9c6e-9c1164472121', + version='5.1', + route_values=route_values) + return self._deserialize('PolicyConfiguration', response) + + def get_policy_configurations(self, project, scope=None, top=None, continuation_token=None, policy_type=None): + """GetPolicyConfigurations. + Get a list of policy configurations in a project. + :param str project: Project ID or project name + :param str scope: [Provided for legacy reasons] The scope on which a subset of policies is defined. + :param int top: Maximum number of policies to return. + :param str continuation_token: The continuation token used for pagination. + :param str policy_type: Filter returned policies to only this type + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if scope is not None: + query_parameters['scope'] = self._serialize.query('scope', scope, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if policy_type is not None: + query_parameters['policyType'] = self._serialize.query('policy_type', policy_type, 'str') + response = self._send(http_method='GET', + location_id='dad91cbe-d183-45f8-9c6e-9c1164472121', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[PolicyConfiguration]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetPolicyConfigurationsResponseValue(response_value, continuation_token) + + class GetPolicyConfigurationsResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_policy_configurations method + + :param value: + :type value: :class:`<[PolicyConfiguration]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def update_policy_configuration(self, configuration, project, configuration_id): + """UpdatePolicyConfiguration. + Update a policy configuration by its ID. + :param :class:` ` configuration: The policy configuration to update. + :param str project: Project ID or project name + :param int configuration_id: ID of the existing policy configuration to be updated. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if configuration_id is not None: + route_values['configurationId'] = self._serialize.url('configuration_id', configuration_id, 'int') + content = self._serialize.body(configuration, 'PolicyConfiguration') + response = self._send(http_method='PUT', + location_id='dad91cbe-d183-45f8-9c6e-9c1164472121', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('PolicyConfiguration', response) + + def get_policy_configuration_revision(self, project, configuration_id, revision_id): + """GetPolicyConfigurationRevision. + Retrieve a specific revision of a given policy by ID. + :param str project: Project ID or project name + :param int configuration_id: The policy configuration ID. + :param int revision_id: The revision ID. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if configuration_id is not None: + route_values['configurationId'] = self._serialize.url('configuration_id', configuration_id, 'int') + if revision_id is not None: + route_values['revisionId'] = self._serialize.url('revision_id', revision_id, 'int') + response = self._send(http_method='GET', + location_id='fe1e68a2-60d3-43cb-855b-85e41ae97c95', + version='5.1', + route_values=route_values) + return self._deserialize('PolicyConfiguration', response) + + def get_policy_configuration_revisions(self, project, configuration_id, top=None, skip=None): + """GetPolicyConfigurationRevisions. + Retrieve all revisions for a given policy. + :param str project: Project ID or project name + :param int configuration_id: The policy configuration ID. + :param int top: The number of revisions to retrieve. + :param int skip: The number of revisions to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100. + :rtype: [PolicyConfiguration] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if configuration_id is not None: + route_values['configurationId'] = self._serialize.url('configuration_id', configuration_id, 'int') + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + response = self._send(http_method='GET', + location_id='fe1e68a2-60d3-43cb-855b-85e41ae97c95', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[PolicyConfiguration]', self._unwrap_collection(response)) + + def get_policy_type(self, project, type_id): + """GetPolicyType. + Retrieve a specific policy type by ID. + :param str project: Project ID or project name + :param str type_id: The policy ID. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if type_id is not None: + route_values['typeId'] = self._serialize.url('type_id', type_id, 'str') + response = self._send(http_method='GET', + location_id='44096322-2d3d-466a-bb30-d1b7de69f61f', + version='5.1', + route_values=route_values) + return self._deserialize('PolicyType', response) + + def get_policy_types(self, project): + """GetPolicyTypes. + Retrieve all available policy types. + :param str project: Project ID or project name + :rtype: [PolicyType] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='44096322-2d3d-466a-bb30-d1b7de69f61f', + version='5.1', + route_values=route_values) + return self._deserialize('[PolicyType]', self._unwrap_collection(response)) + diff --git a/azure-devops/azure/devops/released/profile/__init__.py b/azure-devops/azure/devops/released/profile/__init__.py new file mode 100644 index 00000000..fc3a3f65 --- /dev/null +++ b/azure-devops/azure/devops/released/profile/__init__.py @@ -0,0 +1,25 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.profile.models import * +from .profile_client import ProfileClient + +__all__ = [ + 'AttributeDescriptor', + 'AttributesContainer', + 'Avatar', + 'CoreProfileAttribute', + 'CreateProfileContext', + 'GeoRegion', + 'Profile', + 'ProfileAttribute', + 'ProfileAttributeBase', + 'ProfileRegion', + 'ProfileRegions', + 'ProfileClient' +] diff --git a/azure-devops/azure/devops/released/profile/profile_client.py b/azure-devops/azure/devops/released/profile/profile_client.py new file mode 100644 index 00000000..40c7e3f0 --- /dev/null +++ b/azure-devops/azure/devops/released/profile/profile_client.py @@ -0,0 +1,59 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.profile import models + + +class ProfileClient(Client): + """Profile + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(ProfileClient, 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 = '8ccfef3d-2b87-4e99-8ccb-66e343d2daa8' + + def get_profile(self, id, details=None, with_attributes=None, partition=None, core_attributes=None, force_refresh=None): + """GetProfile. + Gets a user profile. + :param str id: The ID of the target user profile within the same organization, or 'me' to get the profile of the current authenticated user. + :param bool details: Return public profile information such as display name, email address, country, etc. If false, the withAttributes parameter is ignored. + :param bool with_attributes: If true, gets the attributes (named key-value pairs of arbitrary data) associated with the profile. The partition parameter must also have a value. + :param str partition: The partition (named group) of attributes to return. + :param str core_attributes: A comma-delimited list of core profile attributes to return. Valid values are Email, Avatar, DisplayName, and ContactWithOffers. + :param bool force_refresh: Not used in this version of the API. + :rtype: :class:` ` + """ + route_values = {} + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'str') + query_parameters = {} + if details is not None: + query_parameters['details'] = self._serialize.query('details', details, 'bool') + if with_attributes is not None: + query_parameters['withAttributes'] = self._serialize.query('with_attributes', with_attributes, 'bool') + if partition is not None: + query_parameters['partition'] = self._serialize.query('partition', partition, 'str') + if core_attributes is not None: + query_parameters['coreAttributes'] = self._serialize.query('core_attributes', core_attributes, 'str') + if force_refresh is not None: + query_parameters['forceRefresh'] = self._serialize.query('force_refresh', force_refresh, 'bool') + response = self._send(http_method='GET', + location_id='f83735dc-483f-4238-a291-d45f6080a9af', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('Profile', response) + diff --git a/azure-devops/azure/devops/released/release/__init__.py b/azure-devops/azure/devops/released/release/__init__.py new file mode 100644 index 00000000..24436a3f --- /dev/null +++ b/azure-devops/azure/devops/released/release/__init__.py @@ -0,0 +1,110 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.release.models import * +from .release_client import ReleaseClient + +__all__ = [ + 'AgentArtifactDefinition', + 'ApprovalOptions', + 'Artifact', + 'ArtifactMetadata', + 'ArtifactSourceReference', + 'ArtifactTriggerConfiguration', + 'ArtifactTypeDefinition', + 'ArtifactVersion', + 'ArtifactVersionQueryResult', + 'AuthorizationHeader', + 'AutoTriggerIssue', + 'BuildVersion', + 'Change', + 'ComplianceSettings', + 'Condition', + 'ConfigurationVariableValue', + 'DataSourceBindingBase', + 'DefinitionEnvironmentReference', + 'Deployment', + 'DeploymentAttempt', + 'DeploymentJob', + 'DeploymentQueryParameters', + 'EmailRecipients', + 'EnvironmentExecutionPolicy', + 'EnvironmentOptions', + 'EnvironmentRetentionPolicy', + 'EnvironmentTrigger', + 'FavoriteItem', + 'Folder', + 'GateUpdateMetadata', + 'GraphSubjectBase', + 'IdentityRef', + 'IgnoredGate', + 'InputDescriptor', + 'InputValidation', + 'InputValue', + 'InputValues', + 'InputValuesError', + 'InputValuesQuery', + 'Issue', + 'MailMessage', + 'ManualIntervention', + 'ManualInterventionUpdateMetadata', + 'Metric', + 'PipelineProcess', + 'ProcessParameters', + 'ProjectReference', + 'QueuedReleaseData', + 'ReferenceLinks', + 'Release', + 'ReleaseApproval', + 'ReleaseApprovalHistory', + 'ReleaseCondition', + 'ReleaseDefinition', + 'ReleaseDefinitionApprovals', + 'ReleaseDefinitionApprovalStep', + 'ReleaseDefinitionDeployStep', + 'ReleaseDefinitionEnvironment', + 'ReleaseDefinitionEnvironmentStep', + 'ReleaseDefinitionEnvironmentSummary', + 'ReleaseDefinitionEnvironmentTemplate', + 'ReleaseDefinitionGate', + 'ReleaseDefinitionGatesOptions', + 'ReleaseDefinitionGatesStep', + 'ReleaseDefinitionRevision', + 'ReleaseDefinitionShallowReference', + 'ReleaseDefinitionSummary', + 'ReleaseDefinitionUndeleteParameter', + 'ReleaseDeployPhase', + 'ReleaseEnvironment', + 'ReleaseEnvironmentShallowReference', + 'ReleaseEnvironmentUpdateMetadata', + 'ReleaseGates', + 'ReleaseReference', + 'ReleaseRevision', + 'ReleaseSchedule', + 'ReleaseSettings', + 'ReleaseShallowReference', + 'ReleaseStartEnvironmentMetadata', + 'ReleaseStartMetadata', + 'ReleaseTask', + 'ReleaseTaskAttachment', + 'ReleaseUpdateMetadata', + 'ReleaseWorkItemRef', + 'RetentionPolicy', + 'RetentionSettings', + 'SourcePullRequestVersion', + 'SummaryMailSection', + 'TaskInputDefinitionBase', + 'TaskInputValidation', + 'TaskSourceDefinitionBase', + 'VariableGroup', + 'VariableGroupProviderData', + 'VariableValue', + 'WorkflowTask', + 'WorkflowTaskReference', + 'ReleaseClient' +] diff --git a/azure-devops/azure/devops/released/release/release_client.py b/azure-devops/azure/devops/released/release/release_client.py new file mode 100644 index 00000000..bf611a2d --- /dev/null +++ b/azure-devops/azure/devops/released/release/release_client.py @@ -0,0 +1,624 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.release import models + + +class ReleaseClient(Client): + """Release + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(ReleaseClient, 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 = 'efc2f575-36ef-48e9-b672-0c6fb4a48ac5' + + def get_approvals(self, project, assigned_to_filter=None, status_filter=None, release_ids_filter=None, type_filter=None, top=None, continuation_token=None, query_order=None, include_my_group_approvals=None): + """GetApprovals. + Get a list of approvals + :param str project: Project ID or project name + :param str assigned_to_filter: Approvals assigned to this user. + :param str status_filter: Approvals with this status. Default is 'pending'. + :param [int] release_ids_filter: Approvals for release id(s) mentioned in the filter. Multiple releases can be mentioned by separating them with ',' e.g. releaseIdsFilter=1,2,3,4. + :param str type_filter: Approval with this type. + :param int top: Number of approvals to get. Default is 50. + :param int continuation_token: Gets the approvals after the continuation token provided. + :param str query_order: Gets the results in the defined order of created approvals. Default is 'descending'. + :param bool include_my_group_approvals: 'true' to include my group approvals. Default is 'false'. + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if assigned_to_filter is not None: + query_parameters['assignedToFilter'] = self._serialize.query('assigned_to_filter', assigned_to_filter, 'str') + if status_filter is not None: + query_parameters['statusFilter'] = self._serialize.query('status_filter', status_filter, 'str') + if release_ids_filter is not None: + release_ids_filter = ",".join(map(str, release_ids_filter)) + query_parameters['releaseIdsFilter'] = self._serialize.query('release_ids_filter', release_ids_filter, 'str') + if type_filter is not None: + query_parameters['typeFilter'] = self._serialize.query('type_filter', type_filter, 'str') + if top is not None: + query_parameters['top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'int') + if query_order is not None: + query_parameters['queryOrder'] = self._serialize.query('query_order', query_order, 'str') + if include_my_group_approvals is not None: + query_parameters['includeMyGroupApprovals'] = self._serialize.query('include_my_group_approvals', include_my_group_approvals, 'bool') + response = self._send(http_method='GET', + location_id='b47c6458-e73b-47cb-a770-4df1e8813a91', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[ReleaseApproval]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetApprovalsResponseValue(response_value, continuation_token) + + class GetApprovalsResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_approvals method + + :param value: + :type value: :class:`<[ReleaseApproval]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def update_release_approval(self, approval, project, approval_id): + """UpdateReleaseApproval. + Update status of an approval + :param :class:` ` approval: ReleaseApproval object having status, approver and comments. + :param str project: Project ID or project name + :param int approval_id: Id of the approval. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if approval_id is not None: + route_values['approvalId'] = self._serialize.url('approval_id', approval_id, 'int') + content = self._serialize.body(approval, 'ReleaseApproval') + response = self._send(http_method='PATCH', + location_id='9328e074-59fb-465a-89d9-b09c82ee5109', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('ReleaseApproval', response) + + def create_release_definition(self, release_definition, project): + """CreateReleaseDefinition. + Create a release definition + :param :class:` ` release_definition: release definition object to create. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(release_definition, 'ReleaseDefinition') + response = self._send(http_method='POST', + location_id='d8f96f24-8ea7-4cb6-baab-2df8fc515665', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('ReleaseDefinition', response) + + def delete_release_definition(self, project, definition_id, comment=None, force_delete=None): + """DeleteReleaseDefinition. + Delete a release definition. + :param str project: Project ID or project name + :param int definition_id: Id of the release definition. + :param str comment: Comment for deleting a release definition. + :param bool force_delete: 'true' to automatically cancel any in-progress release deployments and proceed with release definition deletion . Default is 'false'. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + query_parameters = {} + if comment is not None: + query_parameters['comment'] = self._serialize.query('comment', comment, 'str') + if force_delete is not None: + query_parameters['forceDelete'] = self._serialize.query('force_delete', force_delete, 'bool') + self._send(http_method='DELETE', + location_id='d8f96f24-8ea7-4cb6-baab-2df8fc515665', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + + def get_release_definition(self, project, definition_id, property_filters=None): + """GetReleaseDefinition. + Get a release definition. + :param str project: Project ID or project name + :param int definition_id: Id of the release definition. + :param [str] property_filters: A comma-delimited list of extended properties to be retrieved. If set, the returned Release Definition will contain values for the specified property Ids (if they exist). If not set, properties will not be included. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + query_parameters = {} + if property_filters is not None: + property_filters = ",".join(property_filters) + query_parameters['propertyFilters'] = self._serialize.query('property_filters', property_filters, 'str') + response = self._send(http_method='GET', + location_id='d8f96f24-8ea7-4cb6-baab-2df8fc515665', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('ReleaseDefinition', response) + + def get_release_definitions(self, project, search_text=None, expand=None, artifact_type=None, artifact_source_id=None, top=None, continuation_token=None, query_order=None, path=None, is_exact_name_match=None, tag_filter=None, property_filters=None, definition_id_filter=None, is_deleted=None, search_text_contains_folder_name=None): + """GetReleaseDefinitions. + Get a list of release definitions. + :param str project: Project ID or project name + :param str search_text: Get release definitions with names containing searchText. + :param str expand: The properties that should be expanded in the list of Release definitions. + :param str artifact_type: Release definitions with given artifactType will be returned. Values can be Build, Jenkins, GitHub, Nuget, Team Build (external), ExternalTFSBuild, Git, TFVC, ExternalTfsXamlBuild. + :param str artifact_source_id: Release definitions with given artifactSourceId will be returned. e.g. For build it would be {projectGuid}:{BuildDefinitionId}, for Jenkins it would be {JenkinsConnectionId}:{JenkinsDefinitionId}, for TfsOnPrem it would be {TfsOnPremConnectionId}:{ProjectName}:{TfsOnPremDefinitionId}. For third-party artifacts e.g. TeamCity, BitBucket you may refer 'uniqueSourceIdentifier' inside vss-extension.json at https://github.com/Microsoft/vsts-rm-extensions/blob/master/Extensions. + :param int top: Number of release definitions to get. + :param str continuation_token: Gets the release definitions after the continuation token provided. + :param str query_order: Gets the results in the defined order. Default is 'IdAscending'. + :param str path: Gets the release definitions under the specified path. + :param bool is_exact_name_match: 'true'to gets the release definitions with exact match as specified in searchText. Default is 'false'. + :param [str] tag_filter: A comma-delimited list of tags. Only release definitions with these tags will be returned. + :param [str] property_filters: A comma-delimited list of extended properties to be retrieved. If set, the returned Release Definitions will contain values for the specified property Ids (if they exist). If not set, properties will not be included. Note that this will not filter out any Release Definition from results irrespective of whether it has property set or not. + :param [str] definition_id_filter: A comma-delimited list of release definitions to retrieve. + :param bool is_deleted: 'true' to get release definitions that has been deleted. Default is 'false' + :param bool search_text_contains_folder_name: 'true' to get the release definitions under the folder with name as specified in searchText. Default is 'false'. + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if search_text is not None: + query_parameters['searchText'] = self._serialize.query('search_text', search_text, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + if artifact_type is not None: + query_parameters['artifactType'] = self._serialize.query('artifact_type', artifact_type, 'str') + if artifact_source_id is not None: + query_parameters['artifactSourceId'] = self._serialize.query('artifact_source_id', artifact_source_id, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if query_order is not None: + query_parameters['queryOrder'] = self._serialize.query('query_order', query_order, 'str') + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if is_exact_name_match is not None: + query_parameters['isExactNameMatch'] = self._serialize.query('is_exact_name_match', is_exact_name_match, 'bool') + if tag_filter is not None: + tag_filter = ",".join(tag_filter) + query_parameters['tagFilter'] = self._serialize.query('tag_filter', tag_filter, 'str') + if property_filters is not None: + property_filters = ",".join(property_filters) + query_parameters['propertyFilters'] = self._serialize.query('property_filters', property_filters, 'str') + if definition_id_filter is not None: + definition_id_filter = ",".join(definition_id_filter) + query_parameters['definitionIdFilter'] = self._serialize.query('definition_id_filter', definition_id_filter, 'str') + if is_deleted is not None: + query_parameters['isDeleted'] = self._serialize.query('is_deleted', is_deleted, 'bool') + if search_text_contains_folder_name is not None: + query_parameters['searchTextContainsFolderName'] = self._serialize.query('search_text_contains_folder_name', search_text_contains_folder_name, 'bool') + response = self._send(http_method='GET', + location_id='d8f96f24-8ea7-4cb6-baab-2df8fc515665', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[ReleaseDefinition]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetReleaseDefinitionsResponseValue(response_value, continuation_token) + + class GetReleaseDefinitionsResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_release_definitions method + + :param value: + :type value: :class:`<[ReleaseDefinition]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def update_release_definition(self, release_definition, project): + """UpdateReleaseDefinition. + Update a release definition. + :param :class:` ` release_definition: Release definition object to update. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(release_definition, 'ReleaseDefinition') + response = self._send(http_method='PUT', + location_id='d8f96f24-8ea7-4cb6-baab-2df8fc515665', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('ReleaseDefinition', response) + + def get_deployments(self, project, definition_id=None, definition_environment_id=None, created_by=None, min_modified_time=None, max_modified_time=None, deployment_status=None, operation_status=None, latest_attempts_only=None, query_order=None, top=None, continuation_token=None, created_for=None, min_started_time=None, max_started_time=None, source_branch=None): + """GetDeployments. + :param str project: Project ID or project name + :param int definition_id: + :param int definition_environment_id: + :param str created_by: + :param datetime min_modified_time: + :param datetime max_modified_time: + :param str deployment_status: + :param str operation_status: + :param bool latest_attempts_only: + :param str query_order: + :param int top: + :param int continuation_token: + :param str created_for: + :param datetime min_started_time: + :param datetime max_started_time: + :param str source_branch: + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if definition_id is not None: + query_parameters['definitionId'] = self._serialize.query('definition_id', definition_id, 'int') + if definition_environment_id is not None: + query_parameters['definitionEnvironmentId'] = self._serialize.query('definition_environment_id', definition_environment_id, 'int') + if created_by is not None: + query_parameters['createdBy'] = self._serialize.query('created_by', created_by, 'str') + if min_modified_time is not None: + query_parameters['minModifiedTime'] = self._serialize.query('min_modified_time', min_modified_time, 'iso-8601') + if max_modified_time is not None: + query_parameters['maxModifiedTime'] = self._serialize.query('max_modified_time', max_modified_time, 'iso-8601') + if deployment_status is not None: + query_parameters['deploymentStatus'] = self._serialize.query('deployment_status', deployment_status, 'str') + if operation_status is not None: + query_parameters['operationStatus'] = self._serialize.query('operation_status', operation_status, 'str') + if latest_attempts_only is not None: + query_parameters['latestAttemptsOnly'] = self._serialize.query('latest_attempts_only', latest_attempts_only, 'bool') + if query_order is not None: + query_parameters['queryOrder'] = self._serialize.query('query_order', query_order, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'int') + if created_for is not None: + query_parameters['createdFor'] = self._serialize.query('created_for', created_for, 'str') + if min_started_time is not None: + query_parameters['minStartedTime'] = self._serialize.query('min_started_time', min_started_time, 'iso-8601') + if max_started_time is not None: + query_parameters['maxStartedTime'] = self._serialize.query('max_started_time', max_started_time, 'iso-8601') + if source_branch is not None: + query_parameters['sourceBranch'] = self._serialize.query('source_branch', source_branch, 'str') + response = self._send(http_method='GET', + location_id='b005ef73-cddc-448e-9ba2-5193bf36b19f', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[Deployment]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetDeploymentsResponseValue(response_value, continuation_token) + + class GetDeploymentsResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_deployments method + + :param value: + :type value: :class:`<[Deployment]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def get_manual_intervention(self, project, release_id, manual_intervention_id): + """GetManualIntervention. + Get manual intervention for a given release and manual intervention id. + :param str project: Project ID or project name + :param int release_id: Id of the release. + :param int manual_intervention_id: Id of the manual intervention. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if release_id is not None: + route_values['releaseId'] = self._serialize.url('release_id', release_id, 'int') + if manual_intervention_id is not None: + route_values['manualInterventionId'] = self._serialize.url('manual_intervention_id', manual_intervention_id, 'int') + response = self._send(http_method='GET', + location_id='616c46e4-f370-4456-adaa-fbaf79c7b79e', + version='5.1', + route_values=route_values) + return self._deserialize('ManualIntervention', response) + + def get_manual_interventions(self, project, release_id): + """GetManualInterventions. + List all manual interventions for a given release. + :param str project: Project ID or project name + :param int release_id: Id of the release. + :rtype: [ManualIntervention] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if release_id is not None: + route_values['releaseId'] = self._serialize.url('release_id', release_id, 'int') + response = self._send(http_method='GET', + location_id='616c46e4-f370-4456-adaa-fbaf79c7b79e', + version='5.1', + route_values=route_values) + return self._deserialize('[ManualIntervention]', self._unwrap_collection(response)) + + def update_manual_intervention(self, manual_intervention_update_metadata, project, release_id, manual_intervention_id): + """UpdateManualIntervention. + Update manual intervention. + :param :class:` ` manual_intervention_update_metadata: Meta data to update manual intervention. + :param str project: Project ID or project name + :param int release_id: Id of the release. + :param int manual_intervention_id: Id of the manual intervention. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if release_id is not None: + route_values['releaseId'] = self._serialize.url('release_id', release_id, 'int') + if manual_intervention_id is not None: + route_values['manualInterventionId'] = self._serialize.url('manual_intervention_id', manual_intervention_id, 'int') + content = self._serialize.body(manual_intervention_update_metadata, 'ManualInterventionUpdateMetadata') + response = self._send(http_method='PATCH', + location_id='616c46e4-f370-4456-adaa-fbaf79c7b79e', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('ManualIntervention', response) + + def get_releases(self, project=None, definition_id=None, definition_environment_id=None, search_text=None, created_by=None, status_filter=None, environment_status_filter=None, min_created_time=None, max_created_time=None, query_order=None, top=None, continuation_token=None, expand=None, artifact_type_id=None, source_id=None, artifact_version_id=None, source_branch_filter=None, is_deleted=None, tag_filter=None, property_filters=None, release_id_filter=None, path=None): + """GetReleases. + Get a list of releases + :param str project: Project ID or project name + :param int definition_id: Releases from this release definition Id. + :param int definition_environment_id: + :param str search_text: Releases with names containing searchText. + :param str created_by: Releases created by this user. + :param str status_filter: Releases that have this status. + :param int environment_status_filter: + :param datetime min_created_time: Releases that were created after this time. + :param datetime max_created_time: Releases that were created before this time. + :param str query_order: Gets the results in the defined order of created date for releases. Default is descending. + :param int top: Number of releases to get. Default is 50. + :param int continuation_token: Gets the releases after the continuation token provided. + :param str expand: The property that should be expanded in the list of releases. + :param str artifact_type_id: Releases with given artifactTypeId will be returned. Values can be Build, Jenkins, GitHub, Nuget, Team Build (external), ExternalTFSBuild, Git, TFVC, ExternalTfsXamlBuild. + :param str source_id: Unique identifier of the artifact used. e.g. For build it would be {projectGuid}:{BuildDefinitionId}, for Jenkins it would be {JenkinsConnectionId}:{JenkinsDefinitionId}, for TfsOnPrem it would be {TfsOnPremConnectionId}:{ProjectName}:{TfsOnPremDefinitionId}. For third-party artifacts e.g. TeamCity, BitBucket you may refer 'uniqueSourceIdentifier' inside vss-extension.json https://github.com/Microsoft/vsts-rm-extensions/blob/master/Extensions. + :param str artifact_version_id: Releases with given artifactVersionId will be returned. E.g. in case of Build artifactType, it is buildId. + :param str source_branch_filter: Releases with given sourceBranchFilter will be returned. + :param bool is_deleted: Gets the soft deleted releases, if true. + :param [str] tag_filter: A comma-delimited list of tags. Only releases with these tags will be returned. + :param [str] property_filters: A comma-delimited list of extended properties to be retrieved. If set, the returned Releases will contain values for the specified property Ids (if they exist). If not set, properties will not be included. Note that this will not filter out any Release from results irrespective of whether it has property set or not. + :param [int] release_id_filter: A comma-delimited list of releases Ids. Only releases with these Ids will be returned. + :param str path: Releases under this folder path will be returned + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if definition_id is not None: + query_parameters['definitionId'] = self._serialize.query('definition_id', definition_id, 'int') + if definition_environment_id is not None: + query_parameters['definitionEnvironmentId'] = self._serialize.query('definition_environment_id', definition_environment_id, 'int') + if search_text is not None: + query_parameters['searchText'] = self._serialize.query('search_text', search_text, 'str') + if created_by is not None: + query_parameters['createdBy'] = self._serialize.query('created_by', created_by, 'str') + if status_filter is not None: + query_parameters['statusFilter'] = self._serialize.query('status_filter', status_filter, 'str') + if environment_status_filter is not None: + query_parameters['environmentStatusFilter'] = self._serialize.query('environment_status_filter', environment_status_filter, 'int') + if min_created_time is not None: + query_parameters['minCreatedTime'] = self._serialize.query('min_created_time', min_created_time, 'iso-8601') + if max_created_time is not None: + query_parameters['maxCreatedTime'] = self._serialize.query('max_created_time', max_created_time, 'iso-8601') + if query_order is not None: + query_parameters['queryOrder'] = self._serialize.query('query_order', query_order, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + if artifact_type_id is not None: + query_parameters['artifactTypeId'] = self._serialize.query('artifact_type_id', artifact_type_id, 'str') + if source_id is not None: + query_parameters['sourceId'] = self._serialize.query('source_id', source_id, 'str') + if artifact_version_id is not None: + query_parameters['artifactVersionId'] = self._serialize.query('artifact_version_id', artifact_version_id, 'str') + if source_branch_filter is not None: + query_parameters['sourceBranchFilter'] = self._serialize.query('source_branch_filter', source_branch_filter, 'str') + if is_deleted is not None: + query_parameters['isDeleted'] = self._serialize.query('is_deleted', is_deleted, 'bool') + if tag_filter is not None: + tag_filter = ",".join(tag_filter) + query_parameters['tagFilter'] = self._serialize.query('tag_filter', tag_filter, 'str') + if property_filters is not None: + property_filters = ",".join(property_filters) + query_parameters['propertyFilters'] = self._serialize.query('property_filters', property_filters, 'str') + if release_id_filter is not None: + release_id_filter = ",".join(map(str, release_id_filter)) + query_parameters['releaseIdFilter'] = self._serialize.query('release_id_filter', release_id_filter, 'str') + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + response = self._send(http_method='GET', + location_id='a166fde7-27ad-408e-ba75-703c2cc9d500', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[Release]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetReleasesResponseValue(response_value, continuation_token) + + class GetReleasesResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_releases method + + :param value: + :type value: :class:`<[Release]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def create_release(self, release_start_metadata, project): + """CreateRelease. + Create a release. + :param :class:` ` release_start_metadata: Metadata to create a release. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(release_start_metadata, 'ReleaseStartMetadata') + response = self._send(http_method='POST', + location_id='a166fde7-27ad-408e-ba75-703c2cc9d500', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('Release', response) + + def get_release(self, project, release_id, approval_filters=None, property_filters=None, expand=None, top_gate_records=None): + """GetRelease. + Get a Release + :param str project: Project ID or project name + :param int release_id: Id of the release. + :param str approval_filters: A filter which would allow fetching approval steps selectively based on whether it is automated, or manual. This would also decide whether we should fetch pre and post approval snapshots. Assumes All by default + :param [str] property_filters: A comma-delimited list of extended properties to be retrieved. If set, the returned Release will contain values for the specified property Ids (if they exist). If not set, properties will not be included. + :param str expand: A property that should be expanded in the release. + :param int top_gate_records: Number of release gate records to get. Default is 5. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if release_id is not None: + route_values['releaseId'] = self._serialize.url('release_id', release_id, 'int') + query_parameters = {} + if approval_filters is not None: + query_parameters['approvalFilters'] = self._serialize.query('approval_filters', approval_filters, 'str') + if property_filters is not None: + property_filters = ",".join(property_filters) + query_parameters['propertyFilters'] = self._serialize.query('property_filters', property_filters, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + if top_gate_records is not None: + query_parameters['$topGateRecords'] = self._serialize.query('top_gate_records', top_gate_records, 'int') + response = self._send(http_method='GET', + location_id='a166fde7-27ad-408e-ba75-703c2cc9d500', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('Release', response) + + def get_release_revision(self, project, release_id, definition_snapshot_revision, **kwargs): + """GetReleaseRevision. + Get release for a given revision number. + :param str project: Project ID or project name + :param int release_id: Id of the release. + :param int definition_snapshot_revision: Definition snapshot revision number. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if release_id is not None: + route_values['releaseId'] = self._serialize.url('release_id', release_id, 'int') + query_parameters = {} + if definition_snapshot_revision is not None: + query_parameters['definitionSnapshotRevision'] = self._serialize.query('definition_snapshot_revision', definition_snapshot_revision, 'int') + response = self._send(http_method='GET', + location_id='a166fde7-27ad-408e-ba75-703c2cc9d500', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def update_release(self, release, project, release_id): + """UpdateRelease. + Update a complete release object. + :param :class:` ` release: Release object for update. + :param str project: Project ID or project name + :param int release_id: Id of the release to update. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if release_id is not None: + route_values['releaseId'] = self._serialize.url('release_id', release_id, 'int') + content = self._serialize.body(release, 'Release') + response = self._send(http_method='PUT', + location_id='a166fde7-27ad-408e-ba75-703c2cc9d500', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('Release', response) + + def update_release_resource(self, release_update_metadata, project, release_id): + """UpdateReleaseResource. + Update few properties of a release. + :param :class:` ` release_update_metadata: Properties of release to update. + :param str project: Project ID or project name + :param int release_id: Id of the release to update. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if release_id is not None: + route_values['releaseId'] = self._serialize.url('release_id', release_id, 'int') + content = self._serialize.body(release_update_metadata, 'ReleaseUpdateMetadata') + response = self._send(http_method='PATCH', + location_id='a166fde7-27ad-408e-ba75-703c2cc9d500', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('Release', response) + diff --git a/azure-devops/azure/devops/released/security/__init__.py b/azure-devops/azure/devops/released/security/__init__.py new file mode 100644 index 00000000..90e045e2 --- /dev/null +++ b/azure-devops/azure/devops/released/security/__init__.py @@ -0,0 +1,22 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.security.models import * +from .security_client import SecurityClient + +__all__ = [ + 'AccessControlEntry', + 'AccessControlList', + 'AccessControlListsCollection', + 'AceExtendedInformation', + 'ActionDefinition', + 'PermissionEvaluation', + 'PermissionEvaluationBatch', + 'SecurityNamespaceDescription', + 'SecurityClient' +] diff --git a/azure-devops/azure/devops/released/security/security_client.py b/azure-devops/azure/devops/released/security/security_client.py new file mode 100644 index 00000000..e380a4ba --- /dev/null +++ b/azure-devops/azure/devops/released/security/security_client.py @@ -0,0 +1,224 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.security import models + + +class SecurityClient(Client): + """Security + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(SecurityClient, 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 = None + + def remove_access_control_entries(self, security_namespace_id, token=None, descriptors=None): + """RemoveAccessControlEntries. + Remove the specified ACEs from the ACL belonging to the specified token. + :param str security_namespace_id: Security namespace identifier. + :param str token: The token whose ACL should be modified. + :param str descriptors: String containing a list of identity descriptors separated by ',' whose entries should be removed. + :rtype: bool + """ + route_values = {} + if security_namespace_id is not None: + route_values['securityNamespaceId'] = self._serialize.url('security_namespace_id', security_namespace_id, 'str') + query_parameters = {} + if token is not None: + query_parameters['token'] = self._serialize.query('token', token, 'str') + if descriptors is not None: + query_parameters['descriptors'] = self._serialize.query('descriptors', descriptors, 'str') + response = self._send(http_method='DELETE', + location_id='ac08c8ff-4323-4b08-af90-bcd018d380ce', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('bool', response) + + def set_access_control_entries(self, container, security_namespace_id): + """SetAccessControlEntries. + Add or update ACEs in the ACL for the provided token. The request body contains the target token, a list of [ACEs](https://docs.microsoft.com/en-us/rest/api/azure/devops/security/access%20control%20entries/set%20access%20control%20entries?#accesscontrolentry) and a optional merge parameter. In the case of a collision (by identity descriptor) with an existing ACE in the ACL, the "merge" parameter determines the behavior. If set, the existing ACE has its allow and deny merged with the incoming ACE's allow and deny. If unset, the existing ACE is displaced. + :param :class:` ` container: + :param str security_namespace_id: Security namespace identifier. + :rtype: [AccessControlEntry] + """ + route_values = {} + if security_namespace_id is not None: + route_values['securityNamespaceId'] = self._serialize.url('security_namespace_id', security_namespace_id, 'str') + content = self._serialize.body(container, 'object') + response = self._send(http_method='POST', + location_id='ac08c8ff-4323-4b08-af90-bcd018d380ce', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[AccessControlEntry]', self._unwrap_collection(response)) + + def query_access_control_lists(self, security_namespace_id, token=None, descriptors=None, include_extended_info=None, recurse=None): + """QueryAccessControlLists. + Return a list of access control lists for the specified security namespace and token. All ACLs in the security namespace will be retrieved if no optional parameters are provided. + :param str security_namespace_id: Security namespace identifier. + :param str token: Security token + :param str descriptors: An optional filter string containing a list of identity descriptors separated by ',' whose ACEs should be retrieved. If this is left null, entire ACLs will be returned. + :param bool include_extended_info: If true, populate the extended information properties for the access control entries contained in the returned lists. + :param bool recurse: If true and this is a hierarchical namespace, return child ACLs of the specified token. + :rtype: [AccessControlList] + """ + route_values = {} + if security_namespace_id is not None: + route_values['securityNamespaceId'] = self._serialize.url('security_namespace_id', security_namespace_id, 'str') + query_parameters = {} + if token is not None: + query_parameters['token'] = self._serialize.query('token', token, 'str') + if descriptors is not None: + query_parameters['descriptors'] = self._serialize.query('descriptors', descriptors, 'str') + if include_extended_info is not None: + query_parameters['includeExtendedInfo'] = self._serialize.query('include_extended_info', include_extended_info, 'bool') + if recurse is not None: + query_parameters['recurse'] = self._serialize.query('recurse', recurse, 'bool') + response = self._send(http_method='GET', + location_id='18a2ad18-7571-46ae-bec7-0c7da1495885', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[AccessControlList]', self._unwrap_collection(response)) + + def remove_access_control_lists(self, security_namespace_id, tokens=None, recurse=None): + """RemoveAccessControlLists. + Remove access control lists under the specfied security namespace. + :param str security_namespace_id: Security namespace identifier. + :param str tokens: One or more comma-separated security tokens + :param bool recurse: If true and this is a hierarchical namespace, also remove child ACLs of the specified tokens. + :rtype: bool + """ + route_values = {} + if security_namespace_id is not None: + route_values['securityNamespaceId'] = self._serialize.url('security_namespace_id', security_namespace_id, 'str') + query_parameters = {} + if tokens is not None: + query_parameters['tokens'] = self._serialize.query('tokens', tokens, 'str') + if recurse is not None: + query_parameters['recurse'] = self._serialize.query('recurse', recurse, 'bool') + response = self._send(http_method='DELETE', + location_id='18a2ad18-7571-46ae-bec7-0c7da1495885', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('bool', response) + + def set_access_control_lists(self, access_control_lists, security_namespace_id): + """SetAccessControlLists. + Create or update one or more access control lists. All data that currently exists for the ACLs supplied will be overwritten. + :param :class:` ` access_control_lists: A list of ACLs to create or update. + :param str security_namespace_id: Security namespace identifier. + """ + route_values = {} + if security_namespace_id is not None: + route_values['securityNamespaceId'] = self._serialize.url('security_namespace_id', security_namespace_id, 'str') + content = self._serialize.body(access_control_lists, 'VssJsonCollectionWrapper') + self._send(http_method='POST', + location_id='18a2ad18-7571-46ae-bec7-0c7da1495885', + version='5.1', + route_values=route_values, + content=content) + + def has_permissions_batch(self, eval_batch): + """HasPermissionsBatch. + Evaluates multiple permissions for the calling user. Note: This method does not aggregate the results, nor does it short-circuit if one of the permissions evaluates to false. + :param :class:` ` eval_batch: The set of evaluation requests. + :rtype: :class:` ` + """ + content = self._serialize.body(eval_batch, 'PermissionEvaluationBatch') + response = self._send(http_method='POST', + location_id='cf1faa59-1b63-4448-bf04-13d981a46f5d', + version='5.1', + content=content) + return self._deserialize('PermissionEvaluationBatch', response) + + def has_permissions(self, security_namespace_id, permissions=None, tokens=None, always_allow_administrators=None, delimiter=None): + """HasPermissions. + Evaluates whether the caller has the specified permissions on the specified set of security tokens. + :param str security_namespace_id: Security namespace identifier. + :param int permissions: Permissions to evaluate. + :param str tokens: One or more security tokens to evaluate. + :param bool always_allow_administrators: If true and if the caller is an administrator, always return true. + :param str delimiter: Optional security token separator. Defaults to ",". + :rtype: [bool] + """ + route_values = {} + if security_namespace_id is not None: + route_values['securityNamespaceId'] = self._serialize.url('security_namespace_id', security_namespace_id, 'str') + if permissions is not None: + route_values['permissions'] = self._serialize.url('permissions', permissions, 'int') + query_parameters = {} + if tokens is not None: + query_parameters['tokens'] = self._serialize.query('tokens', tokens, 'str') + if always_allow_administrators is not None: + query_parameters['alwaysAllowAdministrators'] = self._serialize.query('always_allow_administrators', always_allow_administrators, 'bool') + if delimiter is not None: + query_parameters['delimiter'] = self._serialize.query('delimiter', delimiter, 'str') + response = self._send(http_method='GET', + location_id='dd3b8bd6-c7fc-4cbd-929a-933d9c011c9d', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[bool]', self._unwrap_collection(response)) + + def remove_permission(self, security_namespace_id, descriptor, permissions=None, token=None): + """RemovePermission. + Removes the specified permissions on a security token for a user or group. + :param str security_namespace_id: Security namespace identifier. + :param str descriptor: Identity descriptor of the user to remove permissions for. + :param int permissions: Permissions to remove. + :param str token: Security token to remove permissions for. + :rtype: :class:` ` + """ + route_values = {} + if security_namespace_id is not None: + route_values['securityNamespaceId'] = self._serialize.url('security_namespace_id', security_namespace_id, 'str') + if permissions is not None: + route_values['permissions'] = self._serialize.url('permissions', permissions, 'int') + query_parameters = {} + if descriptor is not None: + query_parameters['descriptor'] = self._serialize.query('descriptor', descriptor, 'str') + if token is not None: + query_parameters['token'] = self._serialize.query('token', token, 'str') + response = self._send(http_method='DELETE', + location_id='dd3b8bd6-c7fc-4cbd-929a-933d9c011c9d', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('AccessControlEntry', response) + + def query_security_namespaces(self, security_namespace_id=None, local_only=None): + """QuerySecurityNamespaces. + List all security namespaces or just the specified namespace. + :param str security_namespace_id: Security namespace identifier. + :param bool local_only: If true, retrieve only local security namespaces. + :rtype: [SecurityNamespaceDescription] + """ + route_values = {} + if security_namespace_id is not None: + route_values['securityNamespaceId'] = self._serialize.url('security_namespace_id', security_namespace_id, 'str') + query_parameters = {} + if local_only is not None: + query_parameters['localOnly'] = self._serialize.query('local_only', local_only, 'bool') + response = self._send(http_method='GET', + location_id='ce7b9f95-fde9-4be8-a86d-83b366f0b87a', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[SecurityNamespaceDescription]', self._unwrap_collection(response)) + diff --git a/azure-devops/azure/devops/released/service_hooks/__init__.py b/azure-devops/azure/devops/released/service_hooks/__init__.py new file mode 100644 index 00000000..043375c0 --- /dev/null +++ b/azure-devops/azure/devops/released/service_hooks/__init__.py @@ -0,0 +1,49 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.service_hooks.models import * +from .service_hooks_client import ServiceHooksClient + +__all__ = [ + 'Consumer', + 'ConsumerAction', + 'Event', + 'EventTypeDescriptor', + 'ExternalConfigurationDescriptor', + 'FormattedEventMessage', + 'GraphSubjectBase', + 'IdentityRef', + 'InputDescriptor', + 'InputFilter', + 'InputFilterCondition', + 'InputValidation', + 'InputValue', + 'InputValues', + 'InputValuesError', + 'InputValuesQuery', + 'Notification', + 'NotificationDetails', + 'NotificationResultsSummaryDetail', + 'NotificationsQuery', + 'NotificationSummary', + 'Publisher', + 'PublisherEvent', + 'PublishersQuery', + 'ReferenceLinks', + 'ResourceContainer', + 'SessionToken', + 'Subscription', + 'SubscriptionDiagnostics', + 'SubscriptionInputValuesQuery', + 'SubscriptionsQuery', + 'SubscriptionTracing', + 'UpdateSubscripitonDiagnosticsParameters', + 'UpdateSubscripitonTracingParameters', + 'VersionedResource', + 'ServiceHooksClient' +] diff --git a/azure-devops/azure/devops/released/service_hooks/service_hooks_client.py b/azure-devops/azure/devops/released/service_hooks/service_hooks_client.py new file mode 100644 index 00000000..b6849b6c --- /dev/null +++ b/azure-devops/azure/devops/released/service_hooks/service_hooks_client.py @@ -0,0 +1,364 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.service_hooks import models + + +class ServiceHooksClient(Client): + """ServiceHooks + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(ServiceHooksClient, 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 = None + + def get_consumer_action(self, consumer_id, consumer_action_id, publisher_id=None): + """GetConsumerAction. + Get details about a specific consumer action. + :param str consumer_id: ID for a consumer. + :param str consumer_action_id: ID for a consumerActionId. + :param str publisher_id: + :rtype: :class:` ` + """ + route_values = {} + if consumer_id is not None: + route_values['consumerId'] = self._serialize.url('consumer_id', consumer_id, 'str') + if consumer_action_id is not None: + route_values['consumerActionId'] = self._serialize.url('consumer_action_id', consumer_action_id, 'str') + query_parameters = {} + if publisher_id is not None: + query_parameters['publisherId'] = self._serialize.query('publisher_id', publisher_id, 'str') + response = self._send(http_method='GET', + location_id='c3428e90-7a69-4194-8ed8-0f153185ee0d', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('ConsumerAction', response) + + def list_consumer_actions(self, consumer_id, publisher_id=None): + """ListConsumerActions. + Get a list of consumer actions for a specific consumer. + :param str consumer_id: ID for a consumer. + :param str publisher_id: + :rtype: [ConsumerAction] + """ + route_values = {} + if consumer_id is not None: + route_values['consumerId'] = self._serialize.url('consumer_id', consumer_id, 'str') + query_parameters = {} + if publisher_id is not None: + query_parameters['publisherId'] = self._serialize.query('publisher_id', publisher_id, 'str') + response = self._send(http_method='GET', + location_id='c3428e90-7a69-4194-8ed8-0f153185ee0d', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[ConsumerAction]', self._unwrap_collection(response)) + + def get_consumer(self, consumer_id, publisher_id=None): + """GetConsumer. + Get a specific consumer service. Optionally filter out consumer actions that do not support any event types for the specified publisher. + :param str consumer_id: ID for a consumer. + :param str publisher_id: + :rtype: :class:` ` + """ + route_values = {} + if consumer_id is not None: + route_values['consumerId'] = self._serialize.url('consumer_id', consumer_id, 'str') + query_parameters = {} + if publisher_id is not None: + query_parameters['publisherId'] = self._serialize.query('publisher_id', publisher_id, 'str') + response = self._send(http_method='GET', + location_id='4301c514-5f34-4f5d-a145-f0ea7b5b7d19', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('Consumer', response) + + def list_consumers(self, publisher_id=None): + """ListConsumers. + Get a list of available service hook consumer services. Optionally filter by consumers that support at least one event type from the specific publisher. + :param str publisher_id: + :rtype: [Consumer] + """ + query_parameters = {} + if publisher_id is not None: + query_parameters['publisherId'] = self._serialize.query('publisher_id', publisher_id, 'str') + response = self._send(http_method='GET', + location_id='4301c514-5f34-4f5d-a145-f0ea7b5b7d19', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[Consumer]', self._unwrap_collection(response)) + + def get_event_type(self, publisher_id, event_type_id): + """GetEventType. + Get a specific event type. + :param str publisher_id: ID for a publisher. + :param str event_type_id: + :rtype: :class:` ` + """ + route_values = {} + if publisher_id is not None: + route_values['publisherId'] = self._serialize.url('publisher_id', publisher_id, 'str') + if event_type_id is not None: + route_values['eventTypeId'] = self._serialize.url('event_type_id', event_type_id, 'str') + response = self._send(http_method='GET', + location_id='db4777cd-8e08-4a84-8ba3-c974ea033718', + version='5.1', + route_values=route_values) + return self._deserialize('EventTypeDescriptor', response) + + def list_event_types(self, publisher_id): + """ListEventTypes. + Get the event types for a specific publisher. + :param str publisher_id: ID for a publisher. + :rtype: [EventTypeDescriptor] + """ + route_values = {} + if publisher_id is not None: + route_values['publisherId'] = self._serialize.url('publisher_id', publisher_id, 'str') + response = self._send(http_method='GET', + location_id='db4777cd-8e08-4a84-8ba3-c974ea033718', + version='5.1', + route_values=route_values) + return self._deserialize('[EventTypeDescriptor]', self._unwrap_collection(response)) + + def get_notification(self, subscription_id, notification_id): + """GetNotification. + Get a specific notification for a subscription. + :param str subscription_id: ID for a subscription. + :param int notification_id: + :rtype: :class:` ` + """ + route_values = {} + if subscription_id is not None: + route_values['subscriptionId'] = self._serialize.url('subscription_id', subscription_id, 'str') + if notification_id is not None: + route_values['notificationId'] = self._serialize.url('notification_id', notification_id, 'int') + response = self._send(http_method='GET', + location_id='0c62d343-21b0-4732-997b-017fde84dc28', + version='5.1', + route_values=route_values) + return self._deserialize('Notification', response) + + def get_notifications(self, subscription_id, max_results=None, status=None, result=None): + """GetNotifications. + Get a list of notifications for a specific subscription. A notification includes details about the event, the request to and the response from the consumer service. + :param str subscription_id: ID for a subscription. + :param int max_results: Maximum number of notifications to return. Default is **100**. + :param str status: Get only notifications with this status. + :param str result: Get only notifications with this result type. + :rtype: [Notification] + """ + route_values = {} + if subscription_id is not None: + route_values['subscriptionId'] = self._serialize.url('subscription_id', subscription_id, 'str') + query_parameters = {} + if max_results is not None: + query_parameters['maxResults'] = self._serialize.query('max_results', max_results, 'int') + if status is not None: + query_parameters['status'] = self._serialize.query('status', status, 'str') + if result is not None: + query_parameters['result'] = self._serialize.query('result', result, 'str') + response = self._send(http_method='GET', + location_id='0c62d343-21b0-4732-997b-017fde84dc28', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[Notification]', self._unwrap_collection(response)) + + def query_notifications(self, query): + """QueryNotifications. + Query for notifications. A notification includes details about the event, the request to and the response from the consumer service. + :param :class:` ` query: + :rtype: :class:` ` + """ + content = self._serialize.body(query, 'NotificationsQuery') + response = self._send(http_method='POST', + location_id='1a57562f-160a-4b5c-9185-905e95b39d36', + version='5.1', + content=content) + return self._deserialize('NotificationsQuery', response) + + def query_input_values(self, input_values_query, publisher_id): + """QueryInputValues. + :param :class:` ` input_values_query: + :param str publisher_id: + :rtype: :class:` ` + """ + route_values = {} + if publisher_id is not None: + route_values['publisherId'] = self._serialize.url('publisher_id', publisher_id, 'str') + content = self._serialize.body(input_values_query, 'InputValuesQuery') + response = self._send(http_method='POST', + location_id='d815d352-a566-4dc1-a3e3-fd245acf688c', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('InputValuesQuery', response) + + def get_publisher(self, publisher_id): + """GetPublisher. + Get a specific service hooks publisher. + :param str publisher_id: ID for a publisher. + :rtype: :class:` ` + """ + route_values = {} + if publisher_id is not None: + route_values['publisherId'] = self._serialize.url('publisher_id', publisher_id, 'str') + response = self._send(http_method='GET', + location_id='1e83a210-5b53-43bc-90f0-d476a4e5d731', + version='5.1', + route_values=route_values) + return self._deserialize('Publisher', response) + + def list_publishers(self): + """ListPublishers. + Get a list of publishers. + :rtype: [Publisher] + """ + response = self._send(http_method='GET', + location_id='1e83a210-5b53-43bc-90f0-d476a4e5d731', + version='5.1') + return self._deserialize('[Publisher]', self._unwrap_collection(response)) + + def query_publishers(self, query): + """QueryPublishers. + Query for service hook publishers. + :param :class:` ` query: + :rtype: :class:` ` + """ + content = self._serialize.body(query, 'PublishersQuery') + response = self._send(http_method='POST', + location_id='99b44a8a-65a8-4670-8f3e-e7f7842cce64', + version='5.1', + content=content) + return self._deserialize('PublishersQuery', response) + + def create_subscription(self, subscription): + """CreateSubscription. + Create a subscription. + :param :class:` ` subscription: Subscription to be created. + :rtype: :class:` ` + """ + content = self._serialize.body(subscription, 'Subscription') + response = self._send(http_method='POST', + location_id='fc50d02a-849f-41fb-8af1-0a5216103269', + version='5.1', + content=content) + return self._deserialize('Subscription', response) + + def delete_subscription(self, subscription_id): + """DeleteSubscription. + Delete a specific service hooks subscription. + :param str subscription_id: ID for a subscription. + """ + route_values = {} + if subscription_id is not None: + route_values['subscriptionId'] = self._serialize.url('subscription_id', subscription_id, 'str') + self._send(http_method='DELETE', + location_id='fc50d02a-849f-41fb-8af1-0a5216103269', + version='5.1', + route_values=route_values) + + def get_subscription(self, subscription_id): + """GetSubscription. + Get a specific service hooks subscription. + :param str subscription_id: ID for a subscription. + :rtype: :class:` ` + """ + route_values = {} + if subscription_id is not None: + route_values['subscriptionId'] = self._serialize.url('subscription_id', subscription_id, 'str') + response = self._send(http_method='GET', + location_id='fc50d02a-849f-41fb-8af1-0a5216103269', + version='5.1', + route_values=route_values) + return self._deserialize('Subscription', response) + + def list_subscriptions(self, publisher_id=None, event_type=None, consumer_id=None, consumer_action_id=None): + """ListSubscriptions. + Get a list of subscriptions. + :param str publisher_id: ID for a subscription. + :param str event_type: The event type to filter on (if any). + :param str consumer_id: ID for a consumer. + :param str consumer_action_id: ID for a consumerActionId. + :rtype: [Subscription] + """ + query_parameters = {} + if publisher_id is not None: + query_parameters['publisherId'] = self._serialize.query('publisher_id', publisher_id, 'str') + if event_type is not None: + query_parameters['eventType'] = self._serialize.query('event_type', event_type, 'str') + if consumer_id is not None: + query_parameters['consumerId'] = self._serialize.query('consumer_id', consumer_id, 'str') + if consumer_action_id is not None: + query_parameters['consumerActionId'] = self._serialize.query('consumer_action_id', consumer_action_id, 'str') + response = self._send(http_method='GET', + location_id='fc50d02a-849f-41fb-8af1-0a5216103269', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[Subscription]', self._unwrap_collection(response)) + + def replace_subscription(self, subscription, subscription_id=None): + """ReplaceSubscription. + Update a subscription. ID for a subscription that you wish to update. + :param :class:` ` subscription: + :param str subscription_id: + :rtype: :class:` ` + """ + route_values = {} + if subscription_id is not None: + route_values['subscriptionId'] = self._serialize.url('subscription_id', subscription_id, 'str') + content = self._serialize.body(subscription, 'Subscription') + response = self._send(http_method='PUT', + location_id='fc50d02a-849f-41fb-8af1-0a5216103269', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('Subscription', response) + + def create_subscriptions_query(self, query): + """CreateSubscriptionsQuery. + Query for service hook subscriptions. + :param :class:` ` query: + :rtype: :class:` ` + """ + content = self._serialize.body(query, 'SubscriptionsQuery') + response = self._send(http_method='POST', + location_id='c7c3c1cf-9e05-4c0d-a425-a0f922c2c6ed', + version='5.1', + content=content) + return self._deserialize('SubscriptionsQuery', response) + + def create_test_notification(self, test_notification, use_real_data=None): + """CreateTestNotification. + Sends a test notification. This is useful for verifying the configuration of an updated or new service hooks subscription. + :param :class:` ` test_notification: + :param bool use_real_data: Only allow testing with real data in existing subscriptions. + :rtype: :class:` ` + """ + query_parameters = {} + if use_real_data is not None: + query_parameters['useRealData'] = self._serialize.query('use_real_data', use_real_data, 'bool') + content = self._serialize.body(test_notification, 'Notification') + response = self._send(http_method='POST', + location_id='1139462c-7e27-4524-a997-31b9b73551fe', + version='5.1', + query_parameters=query_parameters, + content=content) + return self._deserialize('Notification', response) + diff --git a/azure-devops/azure/devops/released/task/__init__.py b/azure-devops/azure/devops/released/task/__init__.py new file mode 100644 index 00000000..5c3ad971 --- /dev/null +++ b/azure-devops/azure/devops/released/task/__init__.py @@ -0,0 +1,42 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.task.models import * +from .task_client import TaskClient + +__all__ = [ + 'Issue', + 'JobOption', + 'MaskHint', + 'PlanEnvironment', + 'ProjectReference', + 'ReferenceLinks', + 'TaskAgentJob', + 'TaskAgentJobStep', + 'TaskAgentJobTask', + 'TaskAgentJobVariable', + 'TaskAttachment', + 'TaskLog', + 'TaskLogReference', + 'TaskOrchestrationContainer', + 'TaskOrchestrationItem', + 'TaskOrchestrationOwner', + 'TaskOrchestrationPlan', + 'TaskOrchestrationPlanGroupsQueueMetrics', + 'TaskOrchestrationPlanReference', + 'TaskOrchestrationQueuedPlan', + 'TaskOrchestrationQueuedPlanGroup', + 'TaskReference', + 'Timeline', + 'TimelineAttempt', + 'TimelineRecord', + 'TimelineRecordFeedLinesWrapper', + 'TimelineReference', + 'VariableValue', + 'TaskClient' +] diff --git a/azure-devops/azure/devops/released/task/task_client.py b/azure-devops/azure/devops/released/task/task_client.py new file mode 100644 index 00000000..000ea769 --- /dev/null +++ b/azure-devops/azure/devops/released/task/task_client.py @@ -0,0 +1,281 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.task import models + + +class TaskClient(Client): + """Task + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(TaskClient, 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 = None + + def append_log_content(self, upload_stream, scope_identifier, hub_name, plan_id, log_id, **kwargs): + """AppendLogContent. + :param object upload_stream: Stream to upload + :param str scope_identifier: The project GUID to scope the request + :param str hub_name: The name of the server hub: "build" for the Build server or "rm" for the Release Management server + :param str plan_id: + :param int log_id: + :rtype: :class:` ` + """ + route_values = {} + if scope_identifier is not None: + route_values['scopeIdentifier'] = self._serialize.url('scope_identifier', scope_identifier, 'str') + if hub_name is not None: + route_values['hubName'] = self._serialize.url('hub_name', hub_name, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'str') + if log_id is not None: + route_values['logId'] = self._serialize.url('log_id', log_id, 'int') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + content = self._client.stream_upload(upload_stream, callback=callback) + response = self._send(http_method='POST', + location_id='46f5667d-263a-4684-91b1-dff7fdcf64e2', + version='5.1', + route_values=route_values, + content=content, + media_type='application/octet-stream') + return self._deserialize('TaskLog', response) + + def create_log(self, log, scope_identifier, hub_name, plan_id): + """CreateLog. + :param :class:` ` log: + :param str scope_identifier: The project GUID to scope the request + :param str hub_name: The name of the server hub: "build" for the Build server or "rm" for the Release Management server + :param str plan_id: + :rtype: :class:` ` + """ + route_values = {} + if scope_identifier is not None: + route_values['scopeIdentifier'] = self._serialize.url('scope_identifier', scope_identifier, 'str') + if hub_name is not None: + route_values['hubName'] = self._serialize.url('hub_name', hub_name, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'str') + content = self._serialize.body(log, 'TaskLog') + response = self._send(http_method='POST', + location_id='46f5667d-263a-4684-91b1-dff7fdcf64e2', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('TaskLog', response) + + def get_log(self, scope_identifier, hub_name, plan_id, log_id, start_line=None, end_line=None): + """GetLog. + :param str scope_identifier: The project GUID to scope the request + :param str hub_name: The name of the server hub: "build" for the Build server or "rm" for the Release Management server + :param str plan_id: + :param int log_id: + :param long start_line: + :param long end_line: + :rtype: [str] + """ + route_values = {} + if scope_identifier is not None: + route_values['scopeIdentifier'] = self._serialize.url('scope_identifier', scope_identifier, 'str') + if hub_name is not None: + route_values['hubName'] = self._serialize.url('hub_name', hub_name, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'str') + if log_id is not None: + route_values['logId'] = self._serialize.url('log_id', log_id, 'int') + query_parameters = {} + if start_line is not None: + query_parameters['startLine'] = self._serialize.query('start_line', start_line, 'long') + if end_line is not None: + query_parameters['endLine'] = self._serialize.query('end_line', end_line, 'long') + response = self._send(http_method='GET', + location_id='46f5667d-263a-4684-91b1-dff7fdcf64e2', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def get_logs(self, scope_identifier, hub_name, plan_id): + """GetLogs. + :param str scope_identifier: The project GUID to scope the request + :param str hub_name: The name of the server hub: "build" for the Build server or "rm" for the Release Management server + :param str plan_id: + :rtype: [TaskLog] + """ + route_values = {} + if scope_identifier is not None: + route_values['scopeIdentifier'] = self._serialize.url('scope_identifier', scope_identifier, 'str') + if hub_name is not None: + route_values['hubName'] = self._serialize.url('hub_name', hub_name, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'str') + response = self._send(http_method='GET', + location_id='46f5667d-263a-4684-91b1-dff7fdcf64e2', + version='5.1', + route_values=route_values) + return self._deserialize('[TaskLog]', self._unwrap_collection(response)) + + def get_records(self, scope_identifier, hub_name, plan_id, timeline_id, change_id=None): + """GetRecords. + :param str scope_identifier: The project GUID to scope the request + :param str hub_name: The name of the server hub: "build" for the Build server or "rm" for the Release Management server + :param str plan_id: + :param str timeline_id: + :param int change_id: + :rtype: [TimelineRecord] + """ + route_values = {} + if scope_identifier is not None: + route_values['scopeIdentifier'] = self._serialize.url('scope_identifier', scope_identifier, 'str') + if hub_name is not None: + route_values['hubName'] = self._serialize.url('hub_name', hub_name, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'str') + if timeline_id is not None: + route_values['timelineId'] = self._serialize.url('timeline_id', timeline_id, 'str') + query_parameters = {} + if change_id is not None: + query_parameters['changeId'] = self._serialize.query('change_id', change_id, 'int') + response = self._send(http_method='GET', + location_id='8893bc5b-35b2-4be7-83cb-99e683551db4', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TimelineRecord]', self._unwrap_collection(response)) + + def update_records(self, records, scope_identifier, hub_name, plan_id, timeline_id): + """UpdateRecords. + :param :class:` ` records: + :param str scope_identifier: The project GUID to scope the request + :param str hub_name: The name of the server hub: "build" for the Build server or "rm" for the Release Management server + :param str plan_id: + :param str timeline_id: + :rtype: [TimelineRecord] + """ + route_values = {} + if scope_identifier is not None: + route_values['scopeIdentifier'] = self._serialize.url('scope_identifier', scope_identifier, 'str') + if hub_name is not None: + route_values['hubName'] = self._serialize.url('hub_name', hub_name, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'str') + if timeline_id is not None: + route_values['timelineId'] = self._serialize.url('timeline_id', timeline_id, 'str') + content = self._serialize.body(records, 'VssJsonCollectionWrapper') + response = self._send(http_method='PATCH', + location_id='8893bc5b-35b2-4be7-83cb-99e683551db4', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[TimelineRecord]', self._unwrap_collection(response)) + + def create_timeline(self, timeline, scope_identifier, hub_name, plan_id): + """CreateTimeline. + :param :class:` ` timeline: + :param str scope_identifier: The project GUID to scope the request + :param str hub_name: The name of the server hub: "build" for the Build server or "rm" for the Release Management server + :param str plan_id: + :rtype: :class:` ` + """ + route_values = {} + if scope_identifier is not None: + route_values['scopeIdentifier'] = self._serialize.url('scope_identifier', scope_identifier, 'str') + if hub_name is not None: + route_values['hubName'] = self._serialize.url('hub_name', hub_name, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'str') + content = self._serialize.body(timeline, 'Timeline') + response = self._send(http_method='POST', + location_id='83597576-cc2c-453c-bea6-2882ae6a1653', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('Timeline', response) + + def delete_timeline(self, scope_identifier, hub_name, plan_id, timeline_id): + """DeleteTimeline. + :param str scope_identifier: The project GUID to scope the request + :param str hub_name: The name of the server hub: "build" for the Build server or "rm" for the Release Management server + :param str plan_id: + :param str timeline_id: + """ + route_values = {} + if scope_identifier is not None: + route_values['scopeIdentifier'] = self._serialize.url('scope_identifier', scope_identifier, 'str') + if hub_name is not None: + route_values['hubName'] = self._serialize.url('hub_name', hub_name, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'str') + if timeline_id is not None: + route_values['timelineId'] = self._serialize.url('timeline_id', timeline_id, 'str') + self._send(http_method='DELETE', + location_id='83597576-cc2c-453c-bea6-2882ae6a1653', + version='5.1', + route_values=route_values) + + def get_timeline(self, scope_identifier, hub_name, plan_id, timeline_id, change_id=None, include_records=None): + """GetTimeline. + :param str scope_identifier: The project GUID to scope the request + :param str hub_name: The name of the server hub: "build" for the Build server or "rm" for the Release Management server + :param str plan_id: + :param str timeline_id: + :param int change_id: + :param bool include_records: + :rtype: :class:` ` + """ + route_values = {} + if scope_identifier is not None: + route_values['scopeIdentifier'] = self._serialize.url('scope_identifier', scope_identifier, 'str') + if hub_name is not None: + route_values['hubName'] = self._serialize.url('hub_name', hub_name, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'str') + if timeline_id is not None: + route_values['timelineId'] = self._serialize.url('timeline_id', timeline_id, 'str') + query_parameters = {} + if change_id is not None: + query_parameters['changeId'] = self._serialize.query('change_id', change_id, 'int') + if include_records is not None: + query_parameters['includeRecords'] = self._serialize.query('include_records', include_records, 'bool') + response = self._send(http_method='GET', + location_id='83597576-cc2c-453c-bea6-2882ae6a1653', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('Timeline', response) + + def get_timelines(self, scope_identifier, hub_name, plan_id): + """GetTimelines. + :param str scope_identifier: The project GUID to scope the request + :param str hub_name: The name of the server hub: "build" for the Build server or "rm" for the Release Management server + :param str plan_id: + :rtype: [Timeline] + """ + route_values = {} + if scope_identifier is not None: + route_values['scopeIdentifier'] = self._serialize.url('scope_identifier', scope_identifier, 'str') + if hub_name is not None: + route_values['hubName'] = self._serialize.url('hub_name', hub_name, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'str') + response = self._send(http_method='GET', + location_id='83597576-cc2c-453c-bea6-2882ae6a1653', + version='5.1', + route_values=route_values) + return self._deserialize('[Timeline]', self._unwrap_collection(response)) + diff --git a/azure-devops/azure/devops/released/task_agent/__init__.py b/azure-devops/azure/devops/released/task_agent/__init__.py new file mode 100644 index 00000000..3fd6378d --- /dev/null +++ b/azure-devops/azure/devops/released/task_agent/__init__.py @@ -0,0 +1,135 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.task_agent.models import * +from .task_agent_client import TaskAgentClient + +__all__ = [ + 'AadOauthTokenRequest', + 'AadOauthTokenResult', + 'AuthenticationSchemeReference', + 'AuthorizationHeader', + 'AzureManagementGroup', + 'AzureManagementGroupQueryResult', + 'AzureSubscription', + 'AzureSubscriptionQueryResult', + 'ClientCertificate', + 'DataSource', + 'DataSourceBinding', + 'DataSourceBindingBase', + 'DataSourceDetails', + 'DependencyBinding', + 'DependencyData', + 'DependsOn', + 'DeploymentGroup', + 'DeploymentGroupCreateParameter', + 'DeploymentGroupCreateParameterPoolProperty', + 'DeploymentGroupMetrics', + 'DeploymentGroupReference', + 'DeploymentGroupUpdateParameter', + 'DeploymentMachine', + 'DeploymentMachineGroup', + 'DeploymentMachineGroupReference', + 'DeploymentPoolSummary', + 'DeploymentTargetUpdateParameter', + 'EndpointAuthorization', + 'EndpointUrl', + 'EnvironmentCreateParameter', + 'EnvironmentDeploymentExecutionRecord', + 'EnvironmentInstance', + 'EnvironmentReference', + 'EnvironmentResource', + 'EnvironmentResourceReference', + 'EnvironmentUpdateParameter', + 'GraphSubjectBase', + 'HelpLink', + 'IdentityRef', + 'InputDescriptor', + 'InputValidation', + 'InputValidationRequest', + 'InputValue', + 'InputValues', + 'InputValuesError', + 'KubernetesResource', + 'KubernetesResourceCreateParameters', + 'MarketplacePurchasedLicense', + 'MetricsColumnMetaData', + 'MetricsColumnsHeader', + 'MetricsRow', + 'PackageMetadata', + 'PackageVersion', + 'ProjectReference', + 'PublishTaskGroupMetadata', + 'ReferenceLinks', + 'ResourceLimit', + 'ResourceUsage', + 'ResultTransformationDetails', + 'SecureFile', + 'ServiceEndpoint', + 'ServiceEndpointAuthenticationScheme', + 'ServiceEndpointDetails', + 'ServiceEndpointExecutionData', + 'ServiceEndpointExecutionRecord', + 'ServiceEndpointExecutionRecordsInput', + 'ServiceEndpointRequest', + 'ServiceEndpointRequestResult', + 'ServiceEndpointType', + 'TaskAgent', + 'TaskAgentAuthorization', + 'TaskAgentCloud', + 'TaskAgentCloudRequest', + 'TaskAgentCloudType', + 'TaskAgentDelaySource', + 'TaskAgentJobRequest', + 'TaskAgentMessage', + 'TaskAgentPool', + 'TaskAgentPoolMaintenanceDefinition', + 'TaskAgentPoolMaintenanceJob', + 'TaskAgentPoolMaintenanceJobTargetAgent', + 'TaskAgentPoolMaintenanceOptions', + 'TaskAgentPoolMaintenanceRetentionPolicy', + 'TaskAgentPoolMaintenanceSchedule', + 'TaskAgentPoolReference', + 'TaskAgentPublicKey', + 'TaskAgentQueue', + 'TaskAgentReference', + 'TaskAgentSession', + 'TaskAgentSessionKey', + 'TaskAgentUpdate', + 'TaskAgentUpdateReason', + 'TaskDefinition', + 'TaskDefinitionEndpoint', + 'TaskDefinitionReference', + 'TaskExecution', + 'TaskGroup', + 'TaskGroupCreateParameter', + 'TaskGroupDefinition', + 'TaskGroupRevision', + 'TaskGroupStep', + 'TaskGroupUpdateParameter', + 'TaskHubLicenseDetails', + 'TaskInputDefinition', + 'TaskInputDefinitionBase', + 'TaskInputValidation', + 'TaskOrchestrationOwner', + 'TaskOutputVariable', + 'TaskPackageMetadata', + 'TaskReference', + 'TaskSourceDefinition', + 'TaskSourceDefinitionBase', + 'TaskVersion', + 'ValidationItem', + 'VariableGroup', + 'VariableGroupParameters', + 'VariableGroupProviderData', + 'VariableValue', + 'VirtualMachine', + 'VirtualMachineGroup', + 'VirtualMachineGroupCreateParameters', + 'TaskAgentClient' +] diff --git a/azure-devops/azure/devops/released/task_agent/task_agent_client.py b/azure-devops/azure/devops/released/task_agent/task_agent_client.py new file mode 100644 index 00000000..4550fde4 --- /dev/null +++ b/azure-devops/azure/devops/released/task_agent/task_agent_client.py @@ -0,0 +1,294 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.task_agent import models + + +class TaskAgentClient(Client): + """TaskAgent + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(TaskAgentClient, 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 = 'a85b8835-c1a1-4aac-ae97-1c3d0ba72dbd' + + def add_agent(self, agent, pool_id): + """AddAgent. + Adds an agent to a pool. You probably don't want to call this endpoint directly. Instead, [configure an agent](https://docs.microsoft.com/azure/devops/pipelines/agents/agents) using the agent download package. + :param :class:` ` agent: Details about the agent being added + :param int pool_id: The agent pool in which to add the agent + :rtype: :class:` ` + """ + route_values = {} + if pool_id is not None: + route_values['poolId'] = self._serialize.url('pool_id', pool_id, 'int') + content = self._serialize.body(agent, 'TaskAgent') + response = self._send(http_method='POST', + location_id='e298ef32-5878-4cab-993c-043836571f42', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('TaskAgent', response) + + def delete_agent(self, pool_id, agent_id): + """DeleteAgent. + Delete an agent. You probably don't want to call this endpoint directly. Instead, [use the agent configuration script](https://docs.microsoft.com/azure/devops/pipelines/agents/agents) to remove an agent from your organization. + :param int pool_id: The pool ID to remove the agent from + :param int agent_id: The agent ID to remove + """ + route_values = {} + if pool_id is not None: + route_values['poolId'] = self._serialize.url('pool_id', pool_id, 'int') + if agent_id is not None: + route_values['agentId'] = self._serialize.url('agent_id', agent_id, 'int') + self._send(http_method='DELETE', + location_id='e298ef32-5878-4cab-993c-043836571f42', + version='5.1', + route_values=route_values) + + def get_agent(self, pool_id, agent_id, include_capabilities=None, include_assigned_request=None, include_last_completed_request=None, property_filters=None): + """GetAgent. + Get information about an agent. + :param int pool_id: The agent pool containing the agent + :param int agent_id: The agent ID to get information about + :param bool include_capabilities: Whether to include the agent's capabilities in the response + :param bool include_assigned_request: Whether to include details about the agent's current work + :param bool include_last_completed_request: Whether to include details about the agents' most recent completed work + :param [str] property_filters: Filter which custom properties will be returned + :rtype: :class:` ` + """ + route_values = {} + if pool_id is not None: + route_values['poolId'] = self._serialize.url('pool_id', pool_id, 'int') + if agent_id is not None: + route_values['agentId'] = self._serialize.url('agent_id', agent_id, 'int') + query_parameters = {} + if include_capabilities is not None: + query_parameters['includeCapabilities'] = self._serialize.query('include_capabilities', include_capabilities, 'bool') + if include_assigned_request is not None: + query_parameters['includeAssignedRequest'] = self._serialize.query('include_assigned_request', include_assigned_request, 'bool') + if include_last_completed_request is not None: + query_parameters['includeLastCompletedRequest'] = self._serialize.query('include_last_completed_request', include_last_completed_request, 'bool') + if property_filters is not None: + property_filters = ",".join(property_filters) + query_parameters['propertyFilters'] = self._serialize.query('property_filters', property_filters, 'str') + response = self._send(http_method='GET', + location_id='e298ef32-5878-4cab-993c-043836571f42', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('TaskAgent', response) + + def get_agents(self, pool_id, agent_name=None, include_capabilities=None, include_assigned_request=None, include_last_completed_request=None, property_filters=None, demands=None): + """GetAgents. + Get a list of agents. + :param int pool_id: The agent pool containing the agents + :param str agent_name: Filter on agent name + :param bool include_capabilities: Whether to include the agents' capabilities in the response + :param bool include_assigned_request: Whether to include details about the agents' current work + :param bool include_last_completed_request: Whether to include details about the agents' most recent completed work + :param [str] property_filters: Filter which custom properties will be returned + :param [str] demands: Filter by demands the agents can satisfy + :rtype: [TaskAgent] + """ + route_values = {} + if pool_id is not None: + route_values['poolId'] = self._serialize.url('pool_id', pool_id, 'int') + query_parameters = {} + if agent_name is not None: + query_parameters['agentName'] = self._serialize.query('agent_name', agent_name, 'str') + if include_capabilities is not None: + query_parameters['includeCapabilities'] = self._serialize.query('include_capabilities', include_capabilities, 'bool') + if include_assigned_request is not None: + query_parameters['includeAssignedRequest'] = self._serialize.query('include_assigned_request', include_assigned_request, 'bool') + if include_last_completed_request is not None: + query_parameters['includeLastCompletedRequest'] = self._serialize.query('include_last_completed_request', include_last_completed_request, 'bool') + if property_filters is not None: + property_filters = ",".join(property_filters) + query_parameters['propertyFilters'] = self._serialize.query('property_filters', property_filters, 'str') + if demands is not None: + demands = ",".join(demands) + query_parameters['demands'] = self._serialize.query('demands', demands, 'str') + response = self._send(http_method='GET', + location_id='e298ef32-5878-4cab-993c-043836571f42', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TaskAgent]', self._unwrap_collection(response)) + + def replace_agent(self, agent, pool_id, agent_id): + """ReplaceAgent. + Replace an agent. You probably don't want to call this endpoint directly. Instead, [use the agent configuration script](https://docs.microsoft.com/azure/devops/pipelines/agents/agents) to remove and reconfigure an agent from your organization. + :param :class:` ` agent: Updated details about the replacing agent + :param int pool_id: The agent pool to use + :param int agent_id: The agent to replace + :rtype: :class:` ` + """ + route_values = {} + if pool_id is not None: + route_values['poolId'] = self._serialize.url('pool_id', pool_id, 'int') + if agent_id is not None: + route_values['agentId'] = self._serialize.url('agent_id', agent_id, 'int') + content = self._serialize.body(agent, 'TaskAgent') + response = self._send(http_method='PUT', + location_id='e298ef32-5878-4cab-993c-043836571f42', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('TaskAgent', response) + + def update_agent(self, agent, pool_id, agent_id): + """UpdateAgent. + Update agent details. + :param :class:` ` agent: Updated details about the agent + :param int pool_id: The agent pool to use + :param int agent_id: The agent to update + :rtype: :class:` ` + """ + route_values = {} + if pool_id is not None: + route_values['poolId'] = self._serialize.url('pool_id', pool_id, 'int') + if agent_id is not None: + route_values['agentId'] = self._serialize.url('agent_id', agent_id, 'int') + content = self._serialize.body(agent, 'TaskAgent') + response = self._send(http_method='PATCH', + location_id='e298ef32-5878-4cab-993c-043836571f42', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('TaskAgent', response) + + def add_agent_pool(self, pool): + """AddAgentPool. + Create an agent pool. + :param :class:` ` pool: Details about the new agent pool + :rtype: :class:` ` + """ + content = self._serialize.body(pool, 'TaskAgentPool') + response = self._send(http_method='POST', + location_id='a8c47e17-4d56-4a56-92bb-de7ea7dc65be', + version='5.1', + content=content) + return self._deserialize('TaskAgentPool', response) + + def delete_agent_pool(self, pool_id): + """DeleteAgentPool. + Delete an agent pool. + :param int pool_id: ID of the agent pool to delete + """ + route_values = {} + if pool_id is not None: + route_values['poolId'] = self._serialize.url('pool_id', pool_id, 'int') + self._send(http_method='DELETE', + location_id='a8c47e17-4d56-4a56-92bb-de7ea7dc65be', + version='5.1', + route_values=route_values) + + def get_agent_pool(self, pool_id, properties=None, action_filter=None): + """GetAgentPool. + Get information about an agent pool. + :param int pool_id: An agent pool ID + :param [str] properties: Agent pool properties (comma-separated) + :param str action_filter: Filter by whether the calling user has use or manage permissions + :rtype: :class:` ` + """ + route_values = {} + if pool_id is not None: + route_values['poolId'] = self._serialize.url('pool_id', pool_id, 'int') + query_parameters = {} + if properties is not None: + properties = ",".join(properties) + query_parameters['properties'] = self._serialize.query('properties', properties, 'str') + if action_filter is not None: + query_parameters['actionFilter'] = self._serialize.query('action_filter', action_filter, 'str') + response = self._send(http_method='GET', + location_id='a8c47e17-4d56-4a56-92bb-de7ea7dc65be', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('TaskAgentPool', response) + + def get_agent_pools(self, pool_name=None, properties=None, pool_type=None, action_filter=None): + """GetAgentPools. + Get a list of agent pools. + :param str pool_name: Filter by name + :param [str] properties: Filter by agent pool properties (comma-separated) + :param str pool_type: Filter by pool type + :param str action_filter: Filter by whether the calling user has use or manage permissions + :rtype: [TaskAgentPool] + """ + query_parameters = {} + if pool_name is not None: + query_parameters['poolName'] = self._serialize.query('pool_name', pool_name, 'str') + if properties is not None: + properties = ",".join(properties) + query_parameters['properties'] = self._serialize.query('properties', properties, 'str') + if pool_type is not None: + query_parameters['poolType'] = self._serialize.query('pool_type', pool_type, 'str') + if action_filter is not None: + query_parameters['actionFilter'] = self._serialize.query('action_filter', action_filter, 'str') + response = self._send(http_method='GET', + location_id='a8c47e17-4d56-4a56-92bb-de7ea7dc65be', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[TaskAgentPool]', self._unwrap_collection(response)) + + def get_agent_pools_by_ids(self, pool_ids, action_filter=None): + """GetAgentPoolsByIds. + Get a list of agent pools. + :param [int] pool_ids: pool Ids to fetch + :param str action_filter: Filter by whether the calling user has use or manage permissions + :rtype: [TaskAgentPool] + """ + query_parameters = {} + if pool_ids is not None: + pool_ids = ",".join(map(str, pool_ids)) + query_parameters['poolIds'] = self._serialize.query('pool_ids', pool_ids, 'str') + if action_filter is not None: + query_parameters['actionFilter'] = self._serialize.query('action_filter', action_filter, 'str') + response = self._send(http_method='GET', + location_id='a8c47e17-4d56-4a56-92bb-de7ea7dc65be', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[TaskAgentPool]', self._unwrap_collection(response)) + + def update_agent_pool(self, pool, pool_id): + """UpdateAgentPool. + Update properties on an agent pool + :param :class:` ` pool: Updated agent pool details + :param int pool_id: The agent pool to update + :rtype: :class:` ` + """ + route_values = {} + if pool_id is not None: + route_values['poolId'] = self._serialize.url('pool_id', pool_id, 'int') + content = self._serialize.body(pool, 'TaskAgentPool') + response = self._send(http_method='PATCH', + location_id='a8c47e17-4d56-4a56-92bb-de7ea7dc65be', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('TaskAgentPool', response) + + def get_yaml_schema(self): + """GetYamlSchema. + :rtype: object + """ + response = self._send(http_method='GET', + location_id='1f9990b9-1dba-441f-9c2e-6485888c42b6', + version='5.1') + return self._deserialize('object', response) + diff --git a/azure-devops/azure/devops/released/test/__init__.py b/azure-devops/azure/devops/released/test/__init__.py new file mode 100644 index 00000000..d333f47f --- /dev/null +++ b/azure-devops/azure/devops/released/test/__init__.py @@ -0,0 +1,129 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.test.models import * +from .test_client import TestClient + +__all__ = [ + 'AggregatedDataForResultTrend', + 'AggregatedResultsAnalysis', + 'AggregatedResultsByOutcome', + 'AggregatedResultsDifference', + 'AggregatedRunsByOutcome', + 'AggregatedRunsByState', + 'BuildConfiguration', + 'BuildCoverage', + 'BuildReference', + 'CloneOperationInformation', + 'CloneOptions', + 'CloneStatistics', + 'CodeCoverageData', + 'CodeCoverageStatistics', + 'CodeCoverageSummary', + 'CoverageStatistics', + 'CustomTestField', + 'CustomTestFieldDefinition', + 'DtlEnvironmentDetails', + 'FailingSince', + 'FieldDetailsForTestResults', + 'FunctionCoverage', + 'GraphSubjectBase', + 'IdentityRef', + 'JobReference', + 'LastResultDetails', + 'LinkedWorkItemsQuery', + 'LinkedWorkItemsQueryResult', + 'ModuleCoverage', + 'NameValuePair', + 'PhaseReference', + 'PipelineReference', + 'PlanUpdateModel', + 'PointAssignment', + 'PointsFilter', + 'PointUpdateModel', + 'PropertyBag', + 'QueryModel', + 'ReferenceLinks', + 'ReleaseEnvironmentDefinitionReference', + 'ReleaseReference', + 'ResultRetentionSettings', + 'ResultsFilter', + 'RunCreateModel', + 'RunFilter', + 'RunStatistic', + 'RunSummaryModel', + 'RunUpdateModel', + 'ShallowReference', + 'ShallowTestCaseResult', + 'SharedStepModel', + 'StageReference', + 'SuiteCreateModel', + 'SuiteEntry', + 'SuiteEntryUpdateModel', + 'SuiteTestCase', + 'SuiteTestCaseUpdateModel', + 'SuiteUpdateModel', + 'TeamContext', + 'TeamProjectReference', + 'TestActionResultModel', + 'TestAttachment', + 'TestAttachmentReference', + 'TestAttachmentRequestModel', + 'TestCaseResult', + 'TestCaseResultAttachmentModel', + 'TestCaseResultIdentifier', + 'TestCaseResultUpdateModel', + 'TestConfiguration', + 'TestEnvironment', + 'TestFailureDetails', + 'TestFailuresAnalysis', + 'TestFlakyIdentifier', + 'TestHistoryQuery', + 'TestIterationDetailsModel', + 'TestMessageLogDetails', + 'TestMethod', + 'TestOperationReference', + 'TestOutcomeSettings', + 'TestPlan', + 'TestPlanCloneRequest', + 'TestPoint', + 'TestPointsQuery', + 'TestResolutionState', + 'TestResultCreateModel', + 'TestResultDocument', + 'TestResultHistory', + 'TestResultHistoryDetailsForGroup', + 'TestResultHistoryForGroup', + 'TestResultMetaData', + 'TestResultModelBase', + 'TestResultParameterModel', + 'TestResultPayload', + 'TestResultsContext', + 'TestResultsDetails', + 'TestResultsDetailsForGroup', + 'TestResultsGroupsForBuild', + 'TestResultsGroupsForRelease', + 'TestResultsQuery', + 'TestResultSummary', + 'TestResultTrendFilter', + 'TestRun', + 'TestRunCoverage', + 'TestRunStatistic', + 'TestSession', + 'TestSettings', + 'TestSubResult', + 'TestSuite', + 'TestSuiteCloneRequest', + 'TestSummaryForWorkItem', + 'TestTag', + 'TestToWorkItemLinks', + 'TestVariable', + 'WorkItemReference', + 'WorkItemToTestLinks', + 'TestClient' +] diff --git a/azure-devops/azure/devops/released/test/test_client.py b/azure-devops/azure/devops/released/test/test_client.py new file mode 100644 index 00000000..e5546c11 --- /dev/null +++ b/azure-devops/azure/devops/released/test/test_client.py @@ -0,0 +1,686 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.test import models + + +class TestClient(Client): + """Test + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(TestClient, 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 = 'c2aa639c-3ccc-4740-b3b6-ce2a1e1d984e' + + def get_action_results(self, project, run_id, test_case_result_id, iteration_id, action_path=None): + """GetActionResults. + Gets the action results for an iteration in a test result. + :param str project: Project ID or project name + :param int run_id: ID of the test run that contains the result. + :param int test_case_result_id: ID of the test result that contains the iterations. + :param int iteration_id: ID of the iteration that contains the actions. + :param str action_path: Path of a specific action, used to get just that action. + :rtype: [TestActionResultModel] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if run_id is not None: + route_values['runId'] = self._serialize.url('run_id', run_id, 'int') + if test_case_result_id is not None: + route_values['testCaseResultId'] = self._serialize.url('test_case_result_id', test_case_result_id, 'int') + if iteration_id is not None: + route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int') + if action_path is not None: + route_values['actionPath'] = self._serialize.url('action_path', action_path, 'str') + response = self._send(http_method='GET', + location_id='eaf40c31-ff84-4062-aafd-d5664be11a37', + version='5.1', + route_values=route_values) + return self._deserialize('[TestActionResultModel]', self._unwrap_collection(response)) + + def get_test_iteration(self, project, run_id, test_case_result_id, iteration_id, include_action_results=None): + """GetTestIteration. + Get iteration for a result + :param str project: Project ID or project name + :param int run_id: ID of the test run that contains the result. + :param int test_case_result_id: ID of the test result that contains the iterations. + :param int iteration_id: Id of the test results Iteration. + :param bool include_action_results: Include result details for each action performed in the test iteration. ActionResults refer to outcome (pass/fail) of test steps that are executed as part of a running a manual test. Including the ActionResults flag gets the outcome of test steps in the actionResults section and test parameters in the parameters section for each test iteration. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if run_id is not None: + route_values['runId'] = self._serialize.url('run_id', run_id, 'int') + if test_case_result_id is not None: + route_values['testCaseResultId'] = self._serialize.url('test_case_result_id', test_case_result_id, 'int') + if iteration_id is not None: + route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int') + query_parameters = {} + if include_action_results is not None: + query_parameters['includeActionResults'] = self._serialize.query('include_action_results', include_action_results, 'bool') + response = self._send(http_method='GET', + location_id='73eb9074-3446-4c44-8296-2f811950ff8d', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('TestIterationDetailsModel', response) + + def get_test_iterations(self, project, run_id, test_case_result_id, include_action_results=None): + """GetTestIterations. + Get iterations for a result + :param str project: Project ID or project name + :param int run_id: ID of the test run that contains the result. + :param int test_case_result_id: ID of the test result that contains the iterations. + :param bool include_action_results: Include result details for each action performed in the test iteration. ActionResults refer to outcome (pass/fail) of test steps that are executed as part of a running a manual test. Including the ActionResults flag gets the outcome of test steps in the actionResults section and test parameters in the parameters section for each test iteration. + :rtype: [TestIterationDetailsModel] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if run_id is not None: + route_values['runId'] = self._serialize.url('run_id', run_id, 'int') + if test_case_result_id is not None: + route_values['testCaseResultId'] = self._serialize.url('test_case_result_id', test_case_result_id, 'int') + query_parameters = {} + if include_action_results is not None: + query_parameters['includeActionResults'] = self._serialize.query('include_action_results', include_action_results, 'bool') + response = self._send(http_method='GET', + location_id='73eb9074-3446-4c44-8296-2f811950ff8d', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TestIterationDetailsModel]', self._unwrap_collection(response)) + + def get_result_parameters(self, project, run_id, test_case_result_id, iteration_id, param_name=None): + """GetResultParameters. + Get a list of parameterized results + :param str project: Project ID or project name + :param int run_id: ID of the test run that contains the result. + :param int test_case_result_id: ID of the test result that contains the iterations. + :param int iteration_id: ID of the iteration that contains the parameterized results. + :param str param_name: Name of the parameter. + :rtype: [TestResultParameterModel] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if run_id is not None: + route_values['runId'] = self._serialize.url('run_id', run_id, 'int') + if test_case_result_id is not None: + route_values['testCaseResultId'] = self._serialize.url('test_case_result_id', test_case_result_id, 'int') + if iteration_id is not None: + route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'int') + query_parameters = {} + if param_name is not None: + query_parameters['paramName'] = self._serialize.query('param_name', param_name, 'str') + response = self._send(http_method='GET', + location_id='7c69810d-3354-4af3-844a-180bd25db08a', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TestResultParameterModel]', self._unwrap_collection(response)) + + def get_point(self, project, plan_id, suite_id, point_ids, wit_fields=None): + """GetPoint. + Get a test point. + :param str project: Project ID or project name + :param int plan_id: ID of the test plan. + :param int suite_id: ID of the suite that contains the point. + :param int point_ids: ID of the test point to get. + :param str wit_fields: Comma-separated list of work item field names. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'int') + if suite_id is not None: + route_values['suiteId'] = self._serialize.url('suite_id', suite_id, 'int') + if point_ids is not None: + route_values['pointIds'] = self._serialize.url('point_ids', point_ids, 'int') + query_parameters = {} + if wit_fields is not None: + query_parameters['witFields'] = self._serialize.query('wit_fields', wit_fields, 'str') + response = self._send(http_method='GET', + location_id='3bcfd5c8-be62-488e-b1da-b8289ce9299c', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('TestPoint', response) + + def get_points(self, project, plan_id, suite_id, wit_fields=None, configuration_id=None, test_case_id=None, test_point_ids=None, include_point_details=None, skip=None, top=None): + """GetPoints. + Get a list of test points. + :param str project: Project ID or project name + :param int plan_id: ID of the test plan. + :param int suite_id: ID of the suite that contains the points. + :param str wit_fields: Comma-separated list of work item field names. + :param str configuration_id: Get test points for specific configuration. + :param str test_case_id: Get test points for a specific test case, valid when configurationId is not set. + :param str test_point_ids: Get test points for comma-separated list of test point IDs, valid only when configurationId and testCaseId are not set. + :param bool include_point_details: Include all properties for the test point. + :param int skip: Number of test points to skip.. + :param int top: Number of test points to return. + :rtype: [TestPoint] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'int') + if suite_id is not None: + route_values['suiteId'] = self._serialize.url('suite_id', suite_id, 'int') + query_parameters = {} + if wit_fields is not None: + query_parameters['witFields'] = self._serialize.query('wit_fields', wit_fields, 'str') + if configuration_id is not None: + query_parameters['configurationId'] = self._serialize.query('configuration_id', configuration_id, 'str') + if test_case_id is not None: + query_parameters['testCaseId'] = self._serialize.query('test_case_id', test_case_id, 'str') + if test_point_ids is not None: + query_parameters['testPointIds'] = self._serialize.query('test_point_ids', test_point_ids, 'str') + if include_point_details is not None: + query_parameters['includePointDetails'] = self._serialize.query('include_point_details', include_point_details, 'bool') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + response = self._send(http_method='GET', + location_id='3bcfd5c8-be62-488e-b1da-b8289ce9299c', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TestPoint]', self._unwrap_collection(response)) + + def update_test_points(self, point_update_model, project, plan_id, suite_id, point_ids): + """UpdateTestPoints. + Update test points. + :param :class:` ` point_update_model: Data to update. + :param str project: Project ID or project name + :param int plan_id: ID of the test plan. + :param int suite_id: ID of the suite that contains the points. + :param str point_ids: ID of the test point to get. Use a comma-separated list of IDs to update multiple test points. + :rtype: [TestPoint] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'int') + if suite_id is not None: + route_values['suiteId'] = self._serialize.url('suite_id', suite_id, 'int') + if point_ids is not None: + route_values['pointIds'] = self._serialize.url('point_ids', point_ids, 'str') + content = self._serialize.body(point_update_model, 'PointUpdateModel') + response = self._send(http_method='PATCH', + location_id='3bcfd5c8-be62-488e-b1da-b8289ce9299c', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[TestPoint]', self._unwrap_collection(response)) + + def add_test_results_to_test_run(self, results, project, run_id): + """AddTestResultsToTestRun. + Add test results to a test run. + :param [TestCaseResult] results: List of test results to add. + :param str project: Project ID or project name + :param int run_id: Test run ID into which test results to add. + :rtype: [TestCaseResult] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if run_id is not None: + route_values['runId'] = self._serialize.url('run_id', run_id, 'int') + content = self._serialize.body(results, '[TestCaseResult]') + response = self._send(http_method='POST', + location_id='4637d869-3a76-4468-8057-0bb02aa385cf', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[TestCaseResult]', self._unwrap_collection(response)) + + def get_test_result_by_id(self, project, run_id, test_case_result_id, details_to_include=None): + """GetTestResultById. + Get a test result for a test run. + :param str project: Project ID or project name + :param int run_id: Test run ID of a test result to fetch. + :param int test_case_result_id: Test result ID. + :param str details_to_include: Details to include with test results. Default is None. Other values are Iterations, WorkItems and SubResults. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if run_id is not None: + route_values['runId'] = self._serialize.url('run_id', run_id, 'int') + if test_case_result_id is not None: + route_values['testCaseResultId'] = self._serialize.url('test_case_result_id', test_case_result_id, 'int') + query_parameters = {} + if details_to_include is not None: + query_parameters['detailsToInclude'] = self._serialize.query('details_to_include', details_to_include, 'str') + response = self._send(http_method='GET', + location_id='4637d869-3a76-4468-8057-0bb02aa385cf', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('TestCaseResult', response) + + def get_test_results(self, project, run_id, details_to_include=None, skip=None, top=None, outcomes=None): + """GetTestResults. + Get test results for a test run. + :param str project: Project ID or project name + :param int run_id: Test run ID of test results to fetch. + :param str details_to_include: Details to include with test results. Default is None. Other values are Iterations and WorkItems. + :param int skip: Number of test results to skip from beginning. + :param int top: Number of test results to return. Maximum is 1000 when detailsToInclude is None and 200 otherwise. + :param [TestOutcome] outcomes: Comma separated list of test outcomes to filter test results. + :rtype: [TestCaseResult] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if run_id is not None: + route_values['runId'] = self._serialize.url('run_id', run_id, 'int') + query_parameters = {} + if details_to_include is not None: + query_parameters['detailsToInclude'] = self._serialize.query('details_to_include', details_to_include, 'str') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if outcomes is not None: + outcomes = ",".join(map(str, outcomes)) + query_parameters['outcomes'] = self._serialize.query('outcomes', outcomes, 'str') + response = self._send(http_method='GET', + location_id='4637d869-3a76-4468-8057-0bb02aa385cf', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TestCaseResult]', self._unwrap_collection(response)) + + def update_test_results(self, results, project, run_id): + """UpdateTestResults. + Update test results in a test run. + :param [TestCaseResult] results: List of test results to update. + :param str project: Project ID or project name + :param int run_id: Test run ID whose test results to update. + :rtype: [TestCaseResult] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if run_id is not None: + route_values['runId'] = self._serialize.url('run_id', run_id, 'int') + content = self._serialize.body(results, '[TestCaseResult]') + response = self._send(http_method='PATCH', + location_id='4637d869-3a76-4468-8057-0bb02aa385cf', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[TestCaseResult]', self._unwrap_collection(response)) + + def get_test_run_statistics(self, project, run_id): + """GetTestRunStatistics. + Get test run statistics , used when we want to get summary of a run by outcome. + :param str project: Project ID or project name + :param int run_id: ID of the run to get. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if run_id is not None: + route_values['runId'] = self._serialize.url('run_id', run_id, 'int') + response = self._send(http_method='GET', + location_id='0a42c424-d764-4a16-a2d5-5c85f87d0ae8', + version='5.1', + route_values=route_values) + return self._deserialize('TestRunStatistic', response) + + def create_test_run(self, test_run, project): + """CreateTestRun. + Create new test run. + :param :class:` ` test_run: Run details RunCreateModel + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(test_run, 'RunCreateModel') + response = self._send(http_method='POST', + location_id='cadb3810-d47d-4a3c-a234-fe5f3be50138', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('TestRun', response) + + def delete_test_run(self, project, run_id): + """DeleteTestRun. + Delete a test run by its ID. + :param str project: Project ID or project name + :param int run_id: ID of the run to delete. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if run_id is not None: + route_values['runId'] = self._serialize.url('run_id', run_id, 'int') + self._send(http_method='DELETE', + location_id='cadb3810-d47d-4a3c-a234-fe5f3be50138', + version='5.1', + route_values=route_values) + + def get_test_run_by_id(self, project, run_id, include_details=None): + """GetTestRunById. + Get a test run by its ID. + :param str project: Project ID or project name + :param int run_id: ID of the run to get. + :param bool include_details: Default value is true. It includes details like run statistics, release, build, test environment, post process state, and more. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if run_id is not None: + route_values['runId'] = self._serialize.url('run_id', run_id, 'int') + query_parameters = {} + if include_details is not None: + query_parameters['includeDetails'] = self._serialize.query('include_details', include_details, 'bool') + response = self._send(http_method='GET', + location_id='cadb3810-d47d-4a3c-a234-fe5f3be50138', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('TestRun', response) + + def get_test_runs(self, project, build_uri=None, owner=None, tmi_run_id=None, plan_id=None, include_run_details=None, automated=None, skip=None, top=None): + """GetTestRuns. + Get a list of test runs. + :param str project: Project ID or project name + :param str build_uri: URI of the build that the runs used. + :param str owner: Team foundation ID of the owner of the runs. + :param str tmi_run_id: + :param int plan_id: ID of the test plan that the runs are a part of. + :param bool include_run_details: If true, include all the properties of the runs. + :param bool automated: If true, only returns automated runs. + :param int skip: Number of test runs to skip. + :param int top: Number of test runs to return. + :rtype: [TestRun] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if build_uri is not None: + query_parameters['buildUri'] = self._serialize.query('build_uri', build_uri, 'str') + if owner is not None: + query_parameters['owner'] = self._serialize.query('owner', owner, 'str') + if tmi_run_id is not None: + query_parameters['tmiRunId'] = self._serialize.query('tmi_run_id', tmi_run_id, 'str') + if plan_id is not None: + query_parameters['planId'] = self._serialize.query('plan_id', plan_id, 'int') + if include_run_details is not None: + query_parameters['includeRunDetails'] = self._serialize.query('include_run_details', include_run_details, 'bool') + if automated is not None: + query_parameters['automated'] = self._serialize.query('automated', automated, 'bool') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + response = self._send(http_method='GET', + location_id='cadb3810-d47d-4a3c-a234-fe5f3be50138', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TestRun]', self._unwrap_collection(response)) + + def query_test_runs(self, project, min_last_updated_date, max_last_updated_date, state=None, plan_ids=None, is_automated=None, publish_context=None, build_ids=None, build_def_ids=None, branch_name=None, release_ids=None, release_def_ids=None, release_env_ids=None, release_env_def_ids=None, run_title=None, top=None, continuation_token=None): + """QueryTestRuns. + Query Test Runs based on filters. Mandatory fields are minLastUpdatedDate and maxLastUpdatedDate. + :param str project: Project ID or project name + :param datetime min_last_updated_date: Minimum Last Modified Date of run to be queried (Mandatory). + :param datetime max_last_updated_date: Maximum Last Modified Date of run to be queried (Mandatory, difference between min and max date can be atmost 7 days). + :param str state: Current state of the Runs to be queried. + :param [int] plan_ids: Plan Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + :param bool is_automated: Automation type of the Runs to be queried. + :param str publish_context: PublishContext of the Runs to be queried. + :param [int] build_ids: Build Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + :param [int] build_def_ids: Build Definition Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + :param str branch_name: Source Branch name of the Runs to be queried. + :param [int] release_ids: Release Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + :param [int] release_def_ids: Release Definition Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + :param [int] release_env_ids: Release Environment Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + :param [int] release_env_def_ids: Release Environment Definition Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + :param str run_title: Run Title of the Runs to be queried. + :param int top: Number of runs to be queried. Limit is 100 + :param str continuation_token: continuationToken received from previous batch or null for first batch. It is not supposed to be created (or altered, if received from last batch) by user. + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if min_last_updated_date is not None: + query_parameters['minLastUpdatedDate'] = self._serialize.query('min_last_updated_date', min_last_updated_date, 'iso-8601') + if max_last_updated_date is not None: + query_parameters['maxLastUpdatedDate'] = self._serialize.query('max_last_updated_date', max_last_updated_date, 'iso-8601') + if state is not None: + query_parameters['state'] = self._serialize.query('state', state, 'str') + if plan_ids is not None: + plan_ids = ",".join(map(str, plan_ids)) + query_parameters['planIds'] = self._serialize.query('plan_ids', plan_ids, 'str') + if is_automated is not None: + query_parameters['isAutomated'] = self._serialize.query('is_automated', is_automated, 'bool') + if publish_context is not None: + query_parameters['publishContext'] = self._serialize.query('publish_context', publish_context, 'str') + if build_ids is not None: + build_ids = ",".join(map(str, build_ids)) + query_parameters['buildIds'] = self._serialize.query('build_ids', build_ids, 'str') + if build_def_ids is not None: + build_def_ids = ",".join(map(str, build_def_ids)) + query_parameters['buildDefIds'] = self._serialize.query('build_def_ids', build_def_ids, 'str') + if branch_name is not None: + query_parameters['branchName'] = self._serialize.query('branch_name', branch_name, 'str') + if release_ids is not None: + release_ids = ",".join(map(str, release_ids)) + query_parameters['releaseIds'] = self._serialize.query('release_ids', release_ids, 'str') + if release_def_ids is not None: + release_def_ids = ",".join(map(str, release_def_ids)) + query_parameters['releaseDefIds'] = self._serialize.query('release_def_ids', release_def_ids, 'str') + if release_env_ids is not None: + release_env_ids = ",".join(map(str, release_env_ids)) + query_parameters['releaseEnvIds'] = self._serialize.query('release_env_ids', release_env_ids, 'str') + if release_env_def_ids is not None: + release_env_def_ids = ",".join(map(str, release_env_def_ids)) + query_parameters['releaseEnvDefIds'] = self._serialize.query('release_env_def_ids', release_env_def_ids, 'str') + if run_title is not None: + query_parameters['runTitle'] = self._serialize.query('run_title', run_title, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + response = self._send(http_method='GET', + location_id='cadb3810-d47d-4a3c-a234-fe5f3be50138', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[TestRun]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.QueryTestRunsResponseValue(response_value, continuation_token) + + class QueryTestRunsResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the query_test_runs method + + :param value: + :type value: :class:`<[TestRun]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def update_test_run(self, run_update_model, project, run_id): + """UpdateTestRun. + Update test run by its ID. + :param :class:` ` run_update_model: Run details RunUpdateModel + :param str project: Project ID or project name + :param int run_id: ID of the run to update. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if run_id is not None: + route_values['runId'] = self._serialize.url('run_id', run_id, 'int') + content = self._serialize.body(run_update_model, 'RunUpdateModel') + response = self._send(http_method='PATCH', + location_id='cadb3810-d47d-4a3c-a234-fe5f3be50138', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('TestRun', response) + + def add_test_cases_to_suite(self, project, plan_id, suite_id, test_case_ids): + """AddTestCasesToSuite. + Add test cases to suite. + :param str project: Project ID or project name + :param int plan_id: ID of the test plan that contains the suite. + :param int suite_id: ID of the test suite to which the test cases must be added. + :param str test_case_ids: IDs of the test cases to add to the suite. Ids are specified in comma separated format. + :rtype: [SuiteTestCase] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'int') + if suite_id is not None: + route_values['suiteId'] = self._serialize.url('suite_id', suite_id, 'int') + if test_case_ids is not None: + route_values['testCaseIds'] = self._serialize.url('test_case_ids', test_case_ids, 'str') + route_values['action'] = 'TestCases' + response = self._send(http_method='POST', + location_id='a4a1ec1c-b03f-41ca-8857-704594ecf58e', + version='5.1', + route_values=route_values) + return self._deserialize('[SuiteTestCase]', self._unwrap_collection(response)) + + def get_test_case_by_id(self, project, plan_id, suite_id, test_case_ids): + """GetTestCaseById. + Get a specific test case in a test suite with test case id. + :param str project: Project ID or project name + :param int plan_id: ID of the test plan that contains the suites. + :param int suite_id: ID of the suite that contains the test case. + :param int test_case_ids: ID of the test case to get. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'int') + if suite_id is not None: + route_values['suiteId'] = self._serialize.url('suite_id', suite_id, 'int') + if test_case_ids is not None: + route_values['testCaseIds'] = self._serialize.url('test_case_ids', test_case_ids, 'int') + route_values['action'] = 'TestCases' + response = self._send(http_method='GET', + location_id='a4a1ec1c-b03f-41ca-8857-704594ecf58e', + version='5.1', + route_values=route_values) + return self._deserialize('SuiteTestCase', response) + + def get_test_cases(self, project, plan_id, suite_id): + """GetTestCases. + Get all test cases in a suite. + :param str project: Project ID or project name + :param int plan_id: ID of the test plan that contains the suites. + :param int suite_id: ID of the suite to get. + :rtype: [SuiteTestCase] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'int') + if suite_id is not None: + route_values['suiteId'] = self._serialize.url('suite_id', suite_id, 'int') + route_values['action'] = 'TestCases' + response = self._send(http_method='GET', + location_id='a4a1ec1c-b03f-41ca-8857-704594ecf58e', + version='5.1', + route_values=route_values) + return self._deserialize('[SuiteTestCase]', self._unwrap_collection(response)) + + def remove_test_cases_from_suite_url(self, project, plan_id, suite_id, test_case_ids): + """RemoveTestCasesFromSuiteUrl. + The test points associated with the test cases are removed from the test suite. The test case work item is not deleted from the system. See test cases resource to delete a test case permanently. + :param str project: Project ID or project name + :param int plan_id: ID of the test plan that contains the suite. + :param int suite_id: ID of the suite to get. + :param str test_case_ids: IDs of the test cases to remove from the suite. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'int') + if suite_id is not None: + route_values['suiteId'] = self._serialize.url('suite_id', suite_id, 'int') + if test_case_ids is not None: + route_values['testCaseIds'] = self._serialize.url('test_case_ids', test_case_ids, 'str') + route_values['action'] = 'TestCases' + self._send(http_method='DELETE', + location_id='a4a1ec1c-b03f-41ca-8857-704594ecf58e', + version='5.1', + route_values=route_values) + + def update_suite_test_cases(self, suite_test_case_update_model, project, plan_id, suite_id, test_case_ids): + """UpdateSuiteTestCases. + Updates the properties of the test case association in a suite. + :param :class:` ` suite_test_case_update_model: Model for updation of the properties of test case suite association. + :param str project: Project ID or project name + :param int plan_id: ID of the test plan that contains the suite. + :param int suite_id: ID of the test suite to which the test cases must be added. + :param str test_case_ids: IDs of the test cases to add to the suite. Ids are specified in comma separated format. + :rtype: [SuiteTestCase] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if plan_id is not None: + route_values['planId'] = self._serialize.url('plan_id', plan_id, 'int') + if suite_id is not None: + route_values['suiteId'] = self._serialize.url('suite_id', suite_id, 'int') + if test_case_ids is not None: + route_values['testCaseIds'] = self._serialize.url('test_case_ids', test_case_ids, 'str') + route_values['action'] = 'TestCases' + content = self._serialize.body(suite_test_case_update_model, 'SuiteTestCaseUpdateModel') + response = self._send(http_method='PATCH', + location_id='a4a1ec1c-b03f-41ca-8857-704594ecf58e', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[SuiteTestCase]', self._unwrap_collection(response)) + diff --git a/azure-devops/azure/devops/released/test_plan/__init__.py b/azure-devops/azure/devops/released/test_plan/__init__.py new file mode 100644 index 00000000..8cb4bb05 --- /dev/null +++ b/azure-devops/azure/devops/released/test_plan/__init__.py @@ -0,0 +1,68 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.test_plan.models import * +from .test_plan_client import TestPlanClient + +__all__ = [ + 'BuildDefinitionReference', + 'CloneOperationCommonResponse', + 'CloneOptions', + 'CloneStatistics', + 'CloneTestPlanOperationInformation', + 'CloneTestPlanParams', + 'CloneTestSuiteOperationInformation', + 'CloneTestSuiteParams', + 'Configuration', + 'DestinationTestPlanCloneParams', + 'DestinationTestSuiteInfo', + 'GraphSubjectBase', + 'IdentityRef', + 'LastResultDetails', + 'NameValuePair', + 'PointAssignment', + 'ReferenceLinks', + 'ReleaseEnvironmentDefinitionReference', + 'Results', + 'SourceTestPlanInfo', + 'SourceTestplanResponse', + 'SourceTestSuiteInfo', + 'SuiteEntry', + 'SuiteEntryUpdateParams', + 'SuiteTestCaseCreateUpdateParameters', + 'TeamProjectReference', + 'TestCase', + 'TestCaseReference', + 'TestConfiguration', + 'TestConfigurationCreateUpdateParameters', + 'TestConfigurationReference', + 'TestEnvironment', + 'TestOutcomeSettings', + 'TestPlan', + 'TestPlanCreateParams', + 'TestPlanDetailedReference', + 'TestPlanReference', + 'TestPlansHubRefreshData', + 'TestPlanUpdateParams', + 'TestPoint', + 'TestPointCount', + 'TestPointResults', + 'TestPointUpdateParams', + 'TestSettings', + 'TestSuite', + 'TestSuiteCreateParams', + 'TestSuiteCreateUpdateCommonParams', + 'TestSuiteReference', + 'TestSuiteReferenceWithProject', + 'TestSuiteUpdateParams', + 'TestVariable', + 'TestVariableCreateUpdateParameters', + 'WorkItem', + 'WorkItemDetails', + 'TestPlanClient' +] diff --git a/azure-devops/azure/devops/released/test_plan/test_plan_client.py b/azure-devops/azure/devops/released/test_plan/test_plan_client.py new file mode 100644 index 00000000..660441a8 --- /dev/null +++ b/azure-devops/azure/devops/released/test_plan/test_plan_client.py @@ -0,0 +1,42 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.test_plan import models + + +class TestPlanClient(Client): + """TestPlan + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(TestPlanClient, 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 = None + + def get_suites_by_test_case_id(self, test_case_id): + """GetSuitesByTestCaseId. + Find the list of all test suites in which a given test case is present. This is helpful if you need to find out which test suites are using a test case, when you need to make changes to a test case. + :param int test_case_id: ID of the test case for which suites need to be fetched. + :rtype: [TestSuite] + """ + query_parameters = {} + if test_case_id is not None: + query_parameters['testCaseId'] = self._serialize.query('test_case_id', test_case_id, 'int') + response = self._send(http_method='GET', + location_id='a4080e84-f17b-4fad-84f1-7960b6525bf2', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[TestSuite]', self._unwrap_collection(response)) + diff --git a/azure-devops/azure/devops/released/test_results/__init__.py b/azure-devops/azure/devops/released/test_results/__init__.py new file mode 100644 index 00000000..27388e6d --- /dev/null +++ b/azure-devops/azure/devops/released/test_results/__init__.py @@ -0,0 +1,105 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.test_results.models import * +from .test_results_client import TestResultsClient + +__all__ = [ + 'AggregatedDataForResultTrend', + 'AggregatedResultsAnalysis', + 'AggregatedResultsByOutcome', + 'AggregatedResultsDifference', + 'AggregatedRunsByOutcome', + 'AggregatedRunsByState', + 'BuildConfiguration', + 'BuildCoverage', + 'BuildReference', + 'CodeCoverageData', + 'CodeCoverageStatistics', + 'CodeCoverageSummary', + 'CoverageStatistics', + 'CustomTestField', + 'DtlEnvironmentDetails', + 'FailingSince', + 'FieldDetailsForTestResults', + 'FileCoverageRequest', + 'FlakyDetection', + 'FlakyDetectionPipelines', + 'FlakySettings', + 'FunctionCoverage', + 'GraphSubjectBase', + 'IdentityRef', + 'JobReference', + 'ModuleCoverage', + 'PhaseReference', + 'PipelineReference', + 'QueryModel', + 'ReferenceLinks', + 'ReleaseReference', + 'ResultsFilter', + 'RunCreateModel', + 'RunFilter', + 'RunStatistic', + 'RunSummaryModel', + 'RunUpdateModel', + 'ShallowReference', + 'ShallowTestCaseResult', + 'SharedStepModel', + 'StageReference', + 'TeamProjectReference', + 'TestActionResultModel', + 'TestAttachment', + 'TestAttachmentReference', + 'TestAttachmentRequestModel', + 'TestCaseResult', + 'TestCaseResultAttachmentModel', + 'TestCaseResultIdentifier', + 'TestEnvironment', + 'TestFailureDetails', + 'TestFailuresAnalysis', + 'TestFlakyIdentifier', + 'TestHistoryQuery', + 'TestIterationDetailsModel', + 'TestLog', + 'TestLogReference', + 'TestLogStoreEndpointDetails', + 'TestMessageLogDetails', + 'TestMethod', + 'TestOperationReference', + 'TestResolutionState', + 'TestResultDocument', + 'TestResultHistory', + 'TestResultHistoryDetailsForGroup', + 'TestResultHistoryForGroup', + 'TestResultMetaData', + 'TestResultMetaDataUpdateInput', + 'TestResultModelBase', + 'TestResultParameterModel', + 'TestResultPayload', + 'TestResultsContext', + 'TestResultsDetails', + 'TestResultsDetailsForGroup', + 'TestResultsQuery', + 'TestResultsSettings', + 'TestResultSummary', + 'TestResultsUpdateSettings', + 'TestResultTrendFilter', + 'TestRun', + 'TestRunCoverage', + 'TestRunStatistic', + 'TestSettings', + 'TestSubResult', + 'TestSummaryForWorkItem', + 'TestTag', + 'TestTagSummary', + 'TestTagsUpdateModel', + 'TestToWorkItemLinks', + 'WorkItemReference', + 'WorkItemToTestLinks', + 'TestResultsClient' +] diff --git a/azure-devops/azure/devops/released/test_results/test_results_client.py b/azure-devops/azure/devops/released/test_results/test_results_client.py new file mode 100644 index 00000000..c533accd --- /dev/null +++ b/azure-devops/azure/devops/released/test_results/test_results_client.py @@ -0,0 +1,45 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.test_results import models + + +class TestResultsClient(Client): + """TestResults + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(TestResultsClient, 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 = None + + def get_test_run_statistics(self, project, run_id): + """GetTestRunStatistics. + Get test run statistics , used when we want to get summary of a run by outcome. + :param str project: Project ID or project name + :param int run_id: ID of the run to get. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if run_id is not None: + route_values['runId'] = self._serialize.url('run_id', run_id, 'int') + response = self._send(http_method='GET', + location_id='82b986e8-ca9e-4a89-b39e-f65c69bc104a', + version='5.1', + route_values=route_values) + return self._deserialize('TestRunStatistic', response) + diff --git a/azure-devops/azure/devops/released/tfvc/__init__.py b/azure-devops/azure/devops/released/tfvc/__init__.py new file mode 100644 index 00000000..34f51057 --- /dev/null +++ b/azure-devops/azure/devops/released/tfvc/__init__.py @@ -0,0 +1,53 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.tfvc.models import * +from .tfvc_client import TfvcClient + +__all__ = [ + 'AssociatedWorkItem', + 'Change', + 'CheckinNote', + 'FileContentMetadata', + 'GitRepository', + 'GitRepositoryRef', + 'GraphSubjectBase', + 'IdentityRef', + 'ItemContent', + 'ItemModel', + 'ReferenceLinks', + 'TeamProjectCollectionReference', + 'TeamProjectReference', + 'TfvcBranch', + 'TfvcBranchMapping', + 'TfvcBranchRef', + 'TfvcChange', + 'TfvcChangeset', + 'TfvcChangesetRef', + 'TfvcChangesetSearchCriteria', + 'TfvcChangesetsRequestData', + 'TfvcItem', + 'TfvcItemDescriptor', + 'TfvcItemRequestData', + 'TfvcLabel', + 'TfvcLabelRef', + 'TfvcLabelRequestData', + 'TfvcMappingFilter', + 'TfvcMergeSource', + 'TfvcPolicyFailureInfo', + 'TfvcPolicyOverrideInfo', + 'TfvcShallowBranchRef', + 'TfvcShelveset', + 'TfvcShelvesetRef', + 'TfvcShelvesetRequestData', + 'TfvcStatistics', + 'TfvcVersionDescriptor', + 'VersionControlProjectInfo', + 'VstsInfo', + 'TfvcClient' +] diff --git a/azure-devops/azure/devops/released/tfvc/tfvc_client.py b/azure-devops/azure/devops/released/tfvc/tfvc_client.py new file mode 100644 index 00000000..eccd9eef --- /dev/null +++ b/azure-devops/azure/devops/released/tfvc/tfvc_client.py @@ -0,0 +1,765 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.tfvc import models + + +class TfvcClient(Client): + """Tfvc + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(TfvcClient, 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 = '8aa40520-446d-40e6-89f6-9c9f9ce44c48' + + def get_branch(self, path, project=None, include_parent=None, include_children=None): + """GetBranch. + Get a single branch hierarchy at the given path with parents or children as specified. + :param str path: Full path to the branch. Default: $/ Examples: $/, $/MyProject, $/MyProject/SomeFolder. + :param str project: Project ID or project name + :param bool include_parent: Return the parent branch, if there is one. Default: False + :param bool include_children: Return child branches, if there are any. Default: False + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if include_parent is not None: + query_parameters['includeParent'] = self._serialize.query('include_parent', include_parent, 'bool') + if include_children is not None: + query_parameters['includeChildren'] = self._serialize.query('include_children', include_children, 'bool') + response = self._send(http_method='GET', + location_id='bc1f417e-239d-42e7-85e1-76e80cb2d6eb', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('TfvcBranch', response) + + def get_branches(self, project=None, include_parent=None, include_children=None, include_deleted=None, include_links=None): + """GetBranches. + Get a collection of branch roots -- first-level children, branches with no parents. + :param str project: Project ID or project name + :param bool include_parent: Return the parent branch, if there is one. Default: False + :param bool include_children: Return the child branches for each root branch. Default: False + :param bool include_deleted: Return deleted branches. Default: False + :param bool include_links: Return links. Default: False + :rtype: [TfvcBranch] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if include_parent is not None: + query_parameters['includeParent'] = self._serialize.query('include_parent', include_parent, 'bool') + if include_children is not None: + query_parameters['includeChildren'] = self._serialize.query('include_children', include_children, 'bool') + if include_deleted is not None: + query_parameters['includeDeleted'] = self._serialize.query('include_deleted', include_deleted, 'bool') + if include_links is not None: + query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool') + response = self._send(http_method='GET', + location_id='bc1f417e-239d-42e7-85e1-76e80cb2d6eb', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TfvcBranch]', self._unwrap_collection(response)) + + def get_branch_refs(self, scope_path, project=None, include_deleted=None, include_links=None): + """GetBranchRefs. + Get branch hierarchies below the specified scopePath + :param str scope_path: Full path to the branch. Default: $/ Examples: $/, $/MyProject, $/MyProject/SomeFolder. + :param str project: Project ID or project name + :param bool include_deleted: Return deleted branches. Default: False + :param bool include_links: Return links. Default: False + :rtype: [TfvcBranchRef] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if scope_path is not None: + query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str') + if include_deleted is not None: + query_parameters['includeDeleted'] = self._serialize.query('include_deleted', include_deleted, 'bool') + if include_links is not None: + query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool') + response = self._send(http_method='GET', + location_id='bc1f417e-239d-42e7-85e1-76e80cb2d6eb', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TfvcBranchRef]', self._unwrap_collection(response)) + + def get_changeset_changes(self, id=None, skip=None, top=None, continuation_token=None): + """GetChangesetChanges. + Retrieve Tfvc changes for a given changeset. + :param int id: ID of the changeset. Default: null + :param int skip: Number of results to skip. Default: null + :param int top: The maximum number of results to return. Default: null + :param str continuation_token: Return the next page of results. Default: null + :rtype: :class:`` + """ + route_values = {} + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'int') + query_parameters = {} + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + response = self._send(http_method='GET', + location_id='f32b86f2-15b9-4fe6-81b1-6f8938617ee5', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[TfvcChange]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetChangesetChangesResponseValue(response_value, continuation_token) + + class GetChangesetChangesResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_changeset_changes method + + :param value: + :type value: :class:`<[TfvcChange]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def create_changeset(self, changeset, project=None): + """CreateChangeset. + Create a new changeset. + :param :class:` ` changeset: + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(changeset, 'TfvcChangeset') + response = self._send(http_method='POST', + location_id='0bc8f0a4-6bfb-42a9-ba84-139da7b99c49', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('TfvcChangesetRef', response) + + def get_changeset(self, id, project=None, max_change_count=None, include_details=None, include_work_items=None, max_comment_length=None, include_source_rename=None, skip=None, top=None, orderby=None, search_criteria=None): + """GetChangeset. + Retrieve a Tfvc Changeset + :param int id: Changeset Id to retrieve. + :param str project: Project ID or project name + :param int max_change_count: Number of changes to return (maximum 100 changes) Default: 0 + :param bool include_details: Include policy details and check-in notes in the response. Default: false + :param bool include_work_items: Include workitems. Default: false + :param int max_comment_length: Include details about associated work items in the response. Default: null + :param bool include_source_rename: Include renames. Default: false + :param int skip: Number of results to skip. Default: null + :param int top: The maximum number of results to return. Default: null + :param str orderby: Results are sorted by ID in descending order by default. Use id asc to sort by ID in ascending order. + :param :class:` ` search_criteria: Following criteria available (.itemPath, .version, .versionType, .versionOption, .author, .fromId, .toId, .fromDate, .toDate) Default: null + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'int') + query_parameters = {} + if max_change_count is not None: + query_parameters['maxChangeCount'] = self._serialize.query('max_change_count', max_change_count, 'int') + if include_details is not None: + query_parameters['includeDetails'] = self._serialize.query('include_details', include_details, 'bool') + if include_work_items is not None: + query_parameters['includeWorkItems'] = self._serialize.query('include_work_items', include_work_items, 'bool') + if max_comment_length is not None: + query_parameters['maxCommentLength'] = self._serialize.query('max_comment_length', max_comment_length, 'int') + if include_source_rename is not None: + query_parameters['includeSourceRename'] = self._serialize.query('include_source_rename', include_source_rename, 'bool') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query('orderby', orderby, 'str') + if search_criteria is not None: + if search_criteria.item_path is not None: + query_parameters['searchCriteria.itemPath'] = search_criteria.item_path + if search_criteria.author is not None: + query_parameters['searchCriteria.author'] = search_criteria.author + if search_criteria.from_date is not None: + query_parameters['searchCriteria.fromDate'] = search_criteria.from_date + if search_criteria.to_date is not None: + query_parameters['searchCriteria.toDate'] = search_criteria.to_date + if search_criteria.from_id is not None: + query_parameters['searchCriteria.fromId'] = search_criteria.from_id + if search_criteria.to_id is not None: + query_parameters['searchCriteria.toId'] = search_criteria.to_id + if search_criteria.follow_renames is not None: + query_parameters['searchCriteria.followRenames'] = search_criteria.follow_renames + if search_criteria.include_links is not None: + query_parameters['searchCriteria.includeLinks'] = search_criteria.include_links + if search_criteria.mappings is not None: + query_parameters['searchCriteria.mappings'] = search_criteria.mappings + response = self._send(http_method='GET', + location_id='0bc8f0a4-6bfb-42a9-ba84-139da7b99c49', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('TfvcChangeset', response) + + def get_changesets(self, project=None, max_comment_length=None, skip=None, top=None, orderby=None, search_criteria=None): + """GetChangesets. + Retrieve Tfvc Changesets + :param str project: Project ID or project name + :param int max_comment_length: Include details about associated work items in the response. Default: null + :param int skip: Number of results to skip. Default: null + :param int top: The maximum number of results to return. Default: null + :param str orderby: Results are sorted by ID in descending order by default. Use id asc to sort by ID in ascending order. + :param :class:` ` search_criteria: Following criteria available (.itemPath, .version, .versionType, .versionOption, .author, .fromId, .toId, .fromDate, .toDate) Default: null + :rtype: [TfvcChangesetRef] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if max_comment_length is not None: + query_parameters['maxCommentLength'] = self._serialize.query('max_comment_length', max_comment_length, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query('orderby', orderby, 'str') + if search_criteria is not None: + if search_criteria.item_path is not None: + query_parameters['searchCriteria.itemPath'] = search_criteria.item_path + if search_criteria.author is not None: + query_parameters['searchCriteria.author'] = search_criteria.author + if search_criteria.from_date is not None: + query_parameters['searchCriteria.fromDate'] = search_criteria.from_date + if search_criteria.to_date is not None: + query_parameters['searchCriteria.toDate'] = search_criteria.to_date + if search_criteria.from_id is not None: + query_parameters['searchCriteria.fromId'] = search_criteria.from_id + if search_criteria.to_id is not None: + query_parameters['searchCriteria.toId'] = search_criteria.to_id + if search_criteria.follow_renames is not None: + query_parameters['searchCriteria.followRenames'] = search_criteria.follow_renames + if search_criteria.include_links is not None: + query_parameters['searchCriteria.includeLinks'] = search_criteria.include_links + if search_criteria.mappings is not None: + query_parameters['searchCriteria.mappings'] = search_criteria.mappings + response = self._send(http_method='GET', + location_id='0bc8f0a4-6bfb-42a9-ba84-139da7b99c49', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TfvcChangesetRef]', self._unwrap_collection(response)) + + def get_batched_changesets(self, changesets_request_data): + """GetBatchedChangesets. + Returns changesets for a given list of changeset Ids. + :param :class:` ` changesets_request_data: List of changeset IDs. + :rtype: [TfvcChangesetRef] + """ + content = self._serialize.body(changesets_request_data, 'TfvcChangesetsRequestData') + response = self._send(http_method='POST', + location_id='b7e7c173-803c-4fea-9ec8-31ee35c5502a', + version='5.1', + content=content) + return self._deserialize('[TfvcChangesetRef]', self._unwrap_collection(response)) + + def get_changeset_work_items(self, id=None): + """GetChangesetWorkItems. + Retrieves the work items associated with a particular changeset. + :param int id: ID of the changeset. Default: null + :rtype: [AssociatedWorkItem] + """ + route_values = {} + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'int') + response = self._send(http_method='GET', + location_id='64ae0bea-1d71-47c9-a9e5-fe73f5ea0ff4', + version='5.1', + route_values=route_values) + return self._deserialize('[AssociatedWorkItem]', self._unwrap_collection(response)) + + def get_items_batch(self, item_request_data, project=None): + """GetItemsBatch. + Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path. + :param :class:` ` item_request_data: + :param str project: Project ID or project name + :rtype: [[TfvcItem]] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(item_request_data, 'TfvcItemRequestData') + response = self._send(http_method='POST', + location_id='fe6f827b-5f64-480f-b8af-1eca3b80e833', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[[TfvcItem]]', self._unwrap_collection(response)) + + def get_items_batch_zip(self, item_request_data, project=None, **kwargs): + """GetItemsBatchZip. + Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path. + :param :class:` ` item_request_data: + :param str project: Project ID or project name + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(item_request_data, 'TfvcItemRequestData') + response = self._send(http_method='POST', + location_id='fe6f827b-5f64-480f-b8af-1eca3b80e833', + version='5.1', + route_values=route_values, + content=content, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_item(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, include_content=None): + """GetItem. + Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. + :param str path: Version control path of an individual item to return. + :param str project: Project ID or project name + :param str file_name: file name of item returned. + :param bool download: If true, create a downloadable attachment. + :param str scope_path: Version control path of a folder to return multiple items. + :param str recursion_level: None (just the item), or OneLevel (contents of a folder). + :param :class:` ` version_descriptor: Version descriptor. Default is null. + :param bool include_content: Set to true to include item content when requesting json. Default is false. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + if scope_path is not None: + query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str') + if recursion_level is not None: + query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str') + if version_descriptor is not None: + if version_descriptor.version_option is not None: + query_parameters['versionDescriptor.versionOption'] = version_descriptor.version_option + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if include_content is not None: + query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool') + response = self._send(http_method='GET', + location_id='ba9fc436-9a38-4578-89d6-e4f3241f5040', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('TfvcItem', response) + + def get_item_content(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, include_content=None, **kwargs): + """GetItemContent. + Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. + :param str path: Version control path of an individual item to return. + :param str project: Project ID or project name + :param str file_name: file name of item returned. + :param bool download: If true, create a downloadable attachment. + :param str scope_path: Version control path of a folder to return multiple items. + :param str recursion_level: None (just the item), or OneLevel (contents of a folder). + :param :class:` ` version_descriptor: Version descriptor. Default is null. + :param bool include_content: Set to true to include item content when requesting json. Default is false. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + if scope_path is not None: + query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str') + if recursion_level is not None: + query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str') + if version_descriptor is not None: + if version_descriptor.version_option is not None: + query_parameters['versionDescriptor.versionOption'] = version_descriptor.version_option + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if include_content is not None: + query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool') + response = self._send(http_method='GET', + location_id='ba9fc436-9a38-4578-89d6-e4f3241f5040', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_items(self, project=None, scope_path=None, recursion_level=None, include_links=None, version_descriptor=None): + """GetItems. + Get a list of Tfvc items + :param str project: Project ID or project name + :param str scope_path: Version control path of a folder to return multiple items. + :param str recursion_level: None (just the item), or OneLevel (contents of a folder). + :param bool include_links: True to include links. + :param :class:` ` version_descriptor: + :rtype: [TfvcItem] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if scope_path is not None: + query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str') + if recursion_level is not None: + query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str') + if include_links is not None: + query_parameters['includeLinks'] = self._serialize.query('include_links', include_links, 'bool') + if version_descriptor is not None: + if version_descriptor.version_option is not None: + query_parameters['versionDescriptor.versionOption'] = version_descriptor.version_option + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + response = self._send(http_method='GET', + location_id='ba9fc436-9a38-4578-89d6-e4f3241f5040', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TfvcItem]', self._unwrap_collection(response)) + + def get_item_text(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, include_content=None, **kwargs): + """GetItemText. + Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. + :param str path: Version control path of an individual item to return. + :param str project: Project ID or project name + :param str file_name: file name of item returned. + :param bool download: If true, create a downloadable attachment. + :param str scope_path: Version control path of a folder to return multiple items. + :param str recursion_level: None (just the item), or OneLevel (contents of a folder). + :param :class:` ` version_descriptor: Version descriptor. Default is null. + :param bool include_content: Set to true to include item content when requesting json. Default is false. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + if scope_path is not None: + query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str') + if recursion_level is not None: + query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str') + if version_descriptor is not None: + if version_descriptor.version_option is not None: + query_parameters['versionDescriptor.versionOption'] = version_descriptor.version_option + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if include_content is not None: + query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool') + response = self._send(http_method='GET', + location_id='ba9fc436-9a38-4578-89d6-e4f3241f5040', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_item_zip(self, path, project=None, file_name=None, download=None, scope_path=None, recursion_level=None, version_descriptor=None, include_content=None, **kwargs): + """GetItemZip. + Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. + :param str path: Version control path of an individual item to return. + :param str project: Project ID or project name + :param str file_name: file name of item returned. + :param bool download: If true, create a downloadable attachment. + :param str scope_path: Version control path of a folder to return multiple items. + :param str recursion_level: None (just the item), or OneLevel (contents of a folder). + :param :class:` ` version_descriptor: Version descriptor. Default is null. + :param bool include_content: Set to true to include item content when requesting json. Default is false. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + if scope_path is not None: + query_parameters['scopePath'] = self._serialize.query('scope_path', scope_path, 'str') + if recursion_level is not None: + query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str') + if version_descriptor is not None: + if version_descriptor.version_option is not None: + query_parameters['versionDescriptor.versionOption'] = version_descriptor.version_option + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if include_content is not None: + query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool') + response = self._send(http_method='GET', + location_id='ba9fc436-9a38-4578-89d6-e4f3241f5040', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_label_items(self, label_id, top=None, skip=None): + """GetLabelItems. + Get items under a label. + :param str label_id: Unique identifier of label + :param int top: Max number of items to return + :param int skip: Number of items to skip + :rtype: [TfvcItem] + """ + route_values = {} + if label_id is not None: + route_values['labelId'] = self._serialize.url('label_id', label_id, 'str') + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + response = self._send(http_method='GET', + location_id='06166e34-de17-4b60-8cd1-23182a346fda', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TfvcItem]', self._unwrap_collection(response)) + + def get_label(self, label_id, request_data, project=None): + """GetLabel. + Get a single deep label. + :param str label_id: Unique identifier of label + :param :class:` ` request_data: maxItemCount + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if label_id is not None: + route_values['labelId'] = self._serialize.url('label_id', label_id, 'str') + query_parameters = {} + if request_data is not None: + if request_data.label_scope is not None: + query_parameters['requestData.labelScope'] = request_data.label_scope + if request_data.name is not None: + query_parameters['requestData.name'] = request_data.name + if request_data.owner is not None: + query_parameters['requestData.owner'] = request_data.owner + if request_data.item_label_filter is not None: + query_parameters['requestData.itemLabelFilter'] = request_data.item_label_filter + if request_data.max_item_count is not None: + query_parameters['requestData.maxItemCount'] = request_data.max_item_count + if request_data.include_links is not None: + query_parameters['requestData.includeLinks'] = request_data.include_links + response = self._send(http_method='GET', + location_id='a5d9bd7f-b661-4d0e-b9be-d9c16affae54', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('TfvcLabel', response) + + def get_labels(self, request_data, project=None, top=None, skip=None): + """GetLabels. + Get a collection of shallow label references. + :param :class:` ` request_data: labelScope, name, owner, and itemLabelFilter + :param str project: Project ID or project name + :param int top: Max number of labels to return, defaults to 100 when undefined + :param int skip: Number of labels to skip + :rtype: [TfvcLabelRef] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if request_data is not None: + if request_data.label_scope is not None: + query_parameters['requestData.labelScope'] = request_data.label_scope + if request_data.name is not None: + query_parameters['requestData.name'] = request_data.name + if request_data.owner is not None: + query_parameters['requestData.owner'] = request_data.owner + if request_data.item_label_filter is not None: + query_parameters['requestData.itemLabelFilter'] = request_data.item_label_filter + if request_data.max_item_count is not None: + query_parameters['requestData.maxItemCount'] = request_data.max_item_count + if request_data.include_links is not None: + query_parameters['requestData.includeLinks'] = request_data.include_links + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + response = self._send(http_method='GET', + location_id='a5d9bd7f-b661-4d0e-b9be-d9c16affae54', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TfvcLabelRef]', self._unwrap_collection(response)) + + def get_shelveset_changes(self, shelveset_id, top=None, skip=None): + """GetShelvesetChanges. + Get changes included in a shelveset. + :param str shelveset_id: Shelveset's unique ID + :param int top: Max number of changes to return + :param int skip: Number of changes to skip + :rtype: [TfvcChange] + """ + query_parameters = {} + if shelveset_id is not None: + query_parameters['shelvesetId'] = self._serialize.query('shelveset_id', shelveset_id, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + response = self._send(http_method='GET', + location_id='dbaf075b-0445-4c34-9e5b-82292f856522', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[TfvcChange]', self._unwrap_collection(response)) + + def get_shelveset(self, shelveset_id, request_data=None): + """GetShelveset. + Get a single deep shelveset. + :param str shelveset_id: Shelveset's unique ID + :param :class:` ` request_data: includeDetails, includeWorkItems, maxChangeCount, and maxCommentLength + :rtype: :class:` ` + """ + query_parameters = {} + if shelveset_id is not None: + query_parameters['shelvesetId'] = self._serialize.query('shelveset_id', shelveset_id, 'str') + if request_data is not None: + if request_data.name is not None: + query_parameters['requestData.name'] = request_data.name + if request_data.owner is not None: + query_parameters['requestData.owner'] = request_data.owner + if request_data.max_comment_length is not None: + query_parameters['requestData.maxCommentLength'] = request_data.max_comment_length + if request_data.max_change_count is not None: + query_parameters['requestData.maxChangeCount'] = request_data.max_change_count + if request_data.include_details is not None: + query_parameters['requestData.includeDetails'] = request_data.include_details + if request_data.include_work_items is not None: + query_parameters['requestData.includeWorkItems'] = request_data.include_work_items + if request_data.include_links is not None: + query_parameters['requestData.includeLinks'] = request_data.include_links + response = self._send(http_method='GET', + location_id='e36d44fb-e907-4b0a-b194-f83f1ed32ad3', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('TfvcShelveset', response) + + def get_shelvesets(self, request_data=None, top=None, skip=None): + """GetShelvesets. + Return a collection of shallow shelveset references. + :param :class:` ` request_data: name, owner, and maxCommentLength + :param int top: Max number of shelvesets to return + :param int skip: Number of shelvesets to skip + :rtype: [TfvcShelvesetRef] + """ + query_parameters = {} + if request_data is not None: + if request_data.name is not None: + query_parameters['requestData.name'] = request_data.name + if request_data.owner is not None: + query_parameters['requestData.owner'] = request_data.owner + if request_data.max_comment_length is not None: + query_parameters['requestData.maxCommentLength'] = request_data.max_comment_length + if request_data.max_change_count is not None: + query_parameters['requestData.maxChangeCount'] = request_data.max_change_count + if request_data.include_details is not None: + query_parameters['requestData.includeDetails'] = request_data.include_details + if request_data.include_work_items is not None: + query_parameters['requestData.includeWorkItems'] = request_data.include_work_items + if request_data.include_links is not None: + query_parameters['requestData.includeLinks'] = request_data.include_links + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + response = self._send(http_method='GET', + location_id='e36d44fb-e907-4b0a-b194-f83f1ed32ad3', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[TfvcShelvesetRef]', self._unwrap_collection(response)) + + def get_shelveset_work_items(self, shelveset_id): + """GetShelvesetWorkItems. + Get work items associated with a shelveset. + :param str shelveset_id: Shelveset's unique ID + :rtype: [AssociatedWorkItem] + """ + query_parameters = {} + if shelveset_id is not None: + query_parameters['shelvesetId'] = self._serialize.query('shelveset_id', shelveset_id, 'str') + response = self._send(http_method='GET', + location_id='a7a0c1c1-373e-425a-b031-a519474d743d', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[AssociatedWorkItem]', self._unwrap_collection(response)) + diff --git a/azure-devops/azure/devops/released/wiki/__init__.py b/azure-devops/azure/devops/released/wiki/__init__.py new file mode 100644 index 00000000..c75bf8e3 --- /dev/null +++ b/azure-devops/azure/devops/released/wiki/__init__.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.wiki.models import * +from .wiki_client import WikiClient + +__all__ = [ + 'GitRepository', + 'GitRepositoryRef', + 'GitVersionDescriptor', + 'ReferenceLinks', + 'TeamProjectCollectionReference', + 'TeamProjectReference', + 'WikiAttachment', + 'WikiAttachmentResponse', + 'WikiCreateBaseParameters', + 'WikiCreateParametersV2', + 'WikiPage', + 'WikiPageCreateOrUpdateParameters', + 'WikiPageMove', + 'WikiPageMoveParameters', + 'WikiPageMoveResponse', + 'WikiPageResponse', + 'WikiPageViewStats', + 'WikiUpdateParameters', + 'WikiV2', + 'WikiClient' +] diff --git a/azure-devops/azure/devops/released/wiki/wiki_client.py b/azure-devops/azure/devops/released/wiki/wiki_client.py new file mode 100644 index 00000000..92cf8916 --- /dev/null +++ b/azure-devops/azure/devops/released/wiki/wiki_client.py @@ -0,0 +1,402 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.wiki import models + + +class WikiClient(Client): + """Wiki + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(WikiClient, 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 = 'bf7d82a0-8aa5-4613-94ef-6172a5ea01f3' + + def create_attachment(self, upload_stream, project, wiki_identifier, name, version_descriptor=None, **kwargs): + """CreateAttachment. + Creates an attachment in the wiki. + :param object upload_stream: Stream to upload + :param str project: Project ID or project name + :param str wiki_identifier: Wiki Id or name. + :param str name: Wiki attachment name. + :param :class:` ` version_descriptor: GitVersionDescriptor for the page. (Optional in case of ProjectWiki). + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if wiki_identifier is not None: + route_values['wikiIdentifier'] = self._serialize.url('wiki_identifier', wiki_identifier, 'str') + query_parameters = {} + if name is not None: + query_parameters['name'] = self._serialize.query('name', name, 'str') + if version_descriptor is not None: + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if version_descriptor.version_options is not None: + query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + content = self._client.stream_upload(upload_stream, callback=callback) + response = self._send(http_method='PUT', + location_id='c4382d8d-fefc-40e0-92c5-49852e9e17c0', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content, + media_type='application/octet-stream') + response_object = models.WikiAttachmentResponse() + response_object.attachment = self._deserialize('WikiAttachment', response) + response_object.eTag = response.headers.get('ETag') + return response_object + + def create_page_move(self, page_move_parameters, project, wiki_identifier, comment=None, version_descriptor=None): + """CreatePageMove. + Creates a page move operation that updates the path and order of the page as provided in the parameters. + :param :class:` ` page_move_parameters: Page more operation parameters. + :param str project: Project ID or project name + :param str wiki_identifier: Wiki Id or name. + :param str comment: Comment that is to be associated with this page move. + :param :class:` ` version_descriptor: GitVersionDescriptor for the page. (Optional in case of ProjectWiki). + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if wiki_identifier is not None: + route_values['wikiIdentifier'] = self._serialize.url('wiki_identifier', wiki_identifier, 'str') + query_parameters = {} + if comment is not None: + query_parameters['comment'] = self._serialize.query('comment', comment, 'str') + if version_descriptor is not None: + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if version_descriptor.version_options is not None: + query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options + content = self._serialize.body(page_move_parameters, 'WikiPageMoveParameters') + response = self._send(http_method='POST', + location_id='e37bbe71-cbae-49e5-9a4e-949143b9d910', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + response_object = models.WikiPageMoveResponse() + response_object.page_move = self._deserialize('WikiPageMove', response) + response_object.eTag = response.headers.get('ETag') + return response_object + + def create_or_update_page(self, parameters, project, wiki_identifier, path, version, comment=None, version_descriptor=None): + """CreateOrUpdatePage. + Creates or edits a wiki page. + :param :class:` ` parameters: Wiki create or update operation parameters. + :param str project: Project ID or project name + :param str wiki_identifier: Wiki Id or name. + :param str path: Wiki page path. + :param String version: Version of the page on which the change is to be made. Mandatory for `Edit` scenario. To be populated in the If-Match header of the request. + :param str comment: Comment to be associated with the page operation. + :param :class:` ` version_descriptor: GitVersionDescriptor for the page. (Optional in case of ProjectWiki). + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if wiki_identifier is not None: + route_values['wikiIdentifier'] = self._serialize.url('wiki_identifier', wiki_identifier, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if comment is not None: + query_parameters['comment'] = self._serialize.query('comment', comment, 'str') + if version_descriptor is not None: + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if version_descriptor.version_options is not None: + query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options + additional_headers = {} + if version is not None: + additional_headers['If-Match'] = version + content = self._serialize.body(parameters, 'WikiPageCreateOrUpdateParameters') + response = self._send(http_method='PUT', + location_id='25d3fbc7-fe3d-46cb-b5a5-0b6f79caf27b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + additional_headers=additional_headers, + content=content) + response_object = models.WikiPageResponse() + response_object.page = self._deserialize('WikiPage', response) + response_object.eTag = response.headers.get('ETag') + return response_object + + def delete_page(self, project, wiki_identifier, path, comment=None, version_descriptor=None): + """DeletePage. + Deletes a wiki page. + :param str project: Project ID or project name + :param str wiki_identifier: Wiki Id or name. + :param str path: Wiki page path. + :param str comment: Comment to be associated with this page delete. + :param :class:` ` version_descriptor: GitVersionDescriptor for the page. (Optional in case of ProjectWiki). + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if wiki_identifier is not None: + route_values['wikiIdentifier'] = self._serialize.url('wiki_identifier', wiki_identifier, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if comment is not None: + query_parameters['comment'] = self._serialize.query('comment', comment, 'str') + if version_descriptor is not None: + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if version_descriptor.version_options is not None: + query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options + response = self._send(http_method='DELETE', + location_id='25d3fbc7-fe3d-46cb-b5a5-0b6f79caf27b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_object = models.WikiPageResponse() + response_object.page = self._deserialize('WikiPage', response) + response_object.eTag = response.headers.get('ETag') + return response_object + + def get_page(self, project, wiki_identifier, path=None, recursion_level=None, version_descriptor=None, include_content=None): + """GetPage. + Gets metadata or content of the wiki page for the provided path. Content negotiation is done based on the `Accept` header sent in the request. + :param str project: Project ID or project name + :param str wiki_identifier: Wiki Id or name. + :param str path: Wiki page path. + :param str recursion_level: Recursion level for subpages retrieval. Defaults to `None` (Optional). + :param :class:` ` version_descriptor: GitVersionDescriptor for the page. Defaults to the default branch (Optional). + :param bool include_content: True to include the content of the page in the response for Json content type. Defaults to false (Optional) + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if wiki_identifier is not None: + route_values['wikiIdentifier'] = self._serialize.url('wiki_identifier', wiki_identifier, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if recursion_level is not None: + query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str') + if version_descriptor is not None: + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if version_descriptor.version_options is not None: + query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options + if include_content is not None: + query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool') + response = self._send(http_method='GET', + location_id='25d3fbc7-fe3d-46cb-b5a5-0b6f79caf27b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_object = models.WikiPageResponse() + response_object.page = self._deserialize('WikiPage', response) + response_object.eTag = response.headers.get('ETag') + return response_object + + def get_page_text(self, project, wiki_identifier, path=None, recursion_level=None, version_descriptor=None, include_content=None, **kwargs): + """GetPageText. + Gets metadata or content of the wiki page for the provided path. Content negotiation is done based on the `Accept` header sent in the request. + :param str project: Project ID or project name + :param str wiki_identifier: Wiki Id or name. + :param str path: Wiki page path. + :param str recursion_level: Recursion level for subpages retrieval. Defaults to `None` (Optional). + :param :class:` ` version_descriptor: GitVersionDescriptor for the page. Defaults to the default branch (Optional). + :param bool include_content: True to include the content of the page in the response for Json content type. Defaults to false (Optional) + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if wiki_identifier is not None: + route_values['wikiIdentifier'] = self._serialize.url('wiki_identifier', wiki_identifier, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if recursion_level is not None: + query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str') + if version_descriptor is not None: + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if version_descriptor.version_options is not None: + query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options + if include_content is not None: + query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool') + response = self._send(http_method='GET', + location_id='25d3fbc7-fe3d-46cb-b5a5-0b6f79caf27b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_page_zip(self, project, wiki_identifier, path=None, recursion_level=None, version_descriptor=None, include_content=None, **kwargs): + """GetPageZip. + Gets metadata or content of the wiki page for the provided path. Content negotiation is done based on the `Accept` header sent in the request. + :param str project: Project ID or project name + :param str wiki_identifier: Wiki Id or name. + :param str path: Wiki page path. + :param str recursion_level: Recursion level for subpages retrieval. Defaults to `None` (Optional). + :param :class:` ` version_descriptor: GitVersionDescriptor for the page. Defaults to the default branch (Optional). + :param bool include_content: True to include the content of the page in the response for Json content type. Defaults to false (Optional) + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if wiki_identifier is not None: + route_values['wikiIdentifier'] = self._serialize.url('wiki_identifier', wiki_identifier, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if recursion_level is not None: + query_parameters['recursionLevel'] = self._serialize.query('recursion_level', recursion_level, 'str') + if version_descriptor is not None: + if version_descriptor.version_type is not None: + query_parameters['versionDescriptor.versionType'] = version_descriptor.version_type + if version_descriptor.version is not None: + query_parameters['versionDescriptor.version'] = version_descriptor.version + if version_descriptor.version_options is not None: + query_parameters['versionDescriptor.versionOptions'] = version_descriptor.version_options + if include_content is not None: + query_parameters['includeContent'] = self._serialize.query('include_content', include_content, 'bool') + response = self._send(http_method='GET', + location_id='25d3fbc7-fe3d-46cb-b5a5-0b6f79caf27b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def create_wiki(self, wiki_create_params, project=None): + """CreateWiki. + Creates the wiki resource. + :param :class:` ` wiki_create_params: Parameters for the wiki creation. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(wiki_create_params, 'WikiCreateParametersV2') + response = self._send(http_method='POST', + location_id='288d122c-dbd4-451d-aa5f-7dbbba070728', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('WikiV2', response) + + def delete_wiki(self, wiki_identifier, project=None): + """DeleteWiki. + Deletes the wiki corresponding to the wiki name or Id provided. + :param str wiki_identifier: Wiki name or Id. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if wiki_identifier is not None: + route_values['wikiIdentifier'] = self._serialize.url('wiki_identifier', wiki_identifier, 'str') + response = self._send(http_method='DELETE', + location_id='288d122c-dbd4-451d-aa5f-7dbbba070728', + version='5.1', + route_values=route_values) + return self._deserialize('WikiV2', response) + + def get_all_wikis(self, project=None): + """GetAllWikis. + Gets all wikis in a project or collection. + :param str project: Project ID or project name + :rtype: [WikiV2] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='288d122c-dbd4-451d-aa5f-7dbbba070728', + version='5.1', + route_values=route_values) + return self._deserialize('[WikiV2]', self._unwrap_collection(response)) + + def get_wiki(self, wiki_identifier, project=None): + """GetWiki. + Gets the wiki corresponding to the wiki name or Id provided. + :param str wiki_identifier: Wiki name or id. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if wiki_identifier is not None: + route_values['wikiIdentifier'] = self._serialize.url('wiki_identifier', wiki_identifier, 'str') + response = self._send(http_method='GET', + location_id='288d122c-dbd4-451d-aa5f-7dbbba070728', + version='5.1', + route_values=route_values) + return self._deserialize('WikiV2', response) + + def update_wiki(self, update_parameters, wiki_identifier, project=None): + """UpdateWiki. + Updates the wiki corresponding to the wiki Id or name provided using the update parameters. + :param :class:` ` update_parameters: Update parameters. + :param str wiki_identifier: Wiki name or Id. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if wiki_identifier is not None: + route_values['wikiIdentifier'] = self._serialize.url('wiki_identifier', wiki_identifier, 'str') + content = self._serialize.body(update_parameters, 'WikiUpdateParameters') + response = self._send(http_method='PATCH', + location_id='288d122c-dbd4-451d-aa5f-7dbbba070728', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('WikiV2', response) + diff --git a/azure-devops/azure/devops/released/work/__init__.py b/azure-devops/azure/devops/released/work/__init__.py new file mode 100644 index 00000000..80fb2ca9 --- /dev/null +++ b/azure-devops/azure/devops/released/work/__init__.py @@ -0,0 +1,85 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.work.models import * +from .work_client import WorkClient + +__all__ = [ + 'Activity', + 'BacklogColumn', + 'BacklogConfiguration', + 'BacklogFields', + 'BacklogLevel', + 'BacklogLevelConfiguration', + 'BacklogLevelWorkItems', + 'Board', + 'BoardBadge', + 'BoardCardRuleSettings', + 'BoardCardSettings', + 'BoardChart', + 'BoardChartReference', + 'BoardColumn', + 'BoardFields', + 'BoardReference', + 'BoardRow', + 'BoardSuggestedValue', + 'BoardUserSettings', + 'CapacityContractBase', + 'CapacityPatch', + 'CategoryConfiguration', + 'CreatePlan', + 'DateRange', + 'DeliveryViewData', + 'FieldReference', + 'FilterClause', + 'GraphSubjectBase', + 'IdentityRef', + 'IterationWorkItems', + 'Link', + 'Member', + 'ParentChildWIMap', + 'Plan', + 'PlanViewData', + 'PredefinedQuery', + 'ProcessConfiguration', + 'ReferenceLinks', + 'ReorderOperation', + 'ReorderResult', + 'Rule', + 'TeamContext', + 'TeamFieldValue', + 'TeamFieldValues', + 'TeamFieldValuesPatch', + 'TeamIterationAttributes', + 'TeamMemberCapacity', + 'TeamMemberCapacityIdentityRef', + 'TeamSetting', + 'TeamSettingsDataContractBase', + 'TeamSettingsDaysOff', + 'TeamSettingsDaysOffPatch', + 'TeamSettingsIteration', + 'TeamSettingsPatch', + 'TimelineCriteriaStatus', + 'TimelineIterationStatus', + 'TimelineTeamData', + 'TimelineTeamIteration', + 'TimelineTeamStatus', + 'UpdatePlan', + 'WorkItem', + 'WorkItemColor', + 'WorkItemCommentVersionRef', + 'WorkItemFieldReference', + 'WorkItemLink', + 'WorkItemReference', + 'WorkItemRelation', + 'WorkItemTrackingResource', + 'WorkItemTrackingResourceReference', + 'WorkItemTypeReference', + 'WorkItemTypeStateInfo', + 'WorkClient' +] diff --git a/azure-devops/azure/devops/released/work/work_client.py b/azure-devops/azure/devops/released/work/work_client.py new file mode 100644 index 00000000..ca53c38d --- /dev/null +++ b/azure-devops/azure/devops/released/work/work_client.py @@ -0,0 +1,1129 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.work import models + + +class WorkClient(Client): + """Work + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(WorkClient, 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 = '1d4f49f9-02b9-4e26-b826-2cdb6195f2a9' + + def get_backlog_configurations(self, team_context): + """GetBacklogConfigurations. + Gets backlog configuration for a team + :param :class:` ` team_context: The team context for the operation + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + response = self._send(http_method='GET', + location_id='7799f497-3cb5-4f16-ad4f-5cd06012db64', + version='5.1', + route_values=route_values) + return self._deserialize('BacklogConfiguration', response) + + def get_column_suggested_values(self, project=None): + """GetColumnSuggestedValues. + Get available board columns in a project + :param str project: Project ID or project name + :rtype: [BoardSuggestedValue] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='eb7ec5a3-1ba3-4fd1-b834-49a5a387e57d', + version='5.1', + route_values=route_values) + return self._deserialize('[BoardSuggestedValue]', self._unwrap_collection(response)) + + def get_row_suggested_values(self, project=None): + """GetRowSuggestedValues. + Get available board rows in a project + :param str project: Project ID or project name + :rtype: [BoardSuggestedValue] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='bb494cc6-a0f5-4c6c-8dca-ea6912e79eb9', + version='5.1', + route_values=route_values) + return self._deserialize('[BoardSuggestedValue]', self._unwrap_collection(response)) + + def get_board(self, team_context, id): + """GetBoard. + Get board + :param :class:` ` team_context: The team context for the operation + :param str id: identifier for board, either board's backlog level name (Eg:"Stories") or Id + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'str') + response = self._send(http_method='GET', + location_id='23ad19fc-3b8e-4877-8462-b3f92bc06b40', + version='5.1', + route_values=route_values) + return self._deserialize('Board', response) + + def get_boards(self, team_context): + """GetBoards. + Get boards + :param :class:` ` team_context: The team context for the operation + :rtype: [BoardReference] + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + response = self._send(http_method='GET', + location_id='23ad19fc-3b8e-4877-8462-b3f92bc06b40', + version='5.1', + route_values=route_values) + return self._deserialize('[BoardReference]', self._unwrap_collection(response)) + + def set_board_options(self, options, team_context, id): + """SetBoardOptions. + Update board options + :param {str} options: options to updated + :param :class:` ` team_context: The team context for the operation + :param str id: identifier for board, either category plural name (Eg:"Stories") or guid + :rtype: {str} + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'str') + content = self._serialize.body(options, '{str}') + response = self._send(http_method='PUT', + location_id='23ad19fc-3b8e-4877-8462-b3f92bc06b40', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('{str}', self._unwrap_collection(response)) + + def get_capacities_with_identity_ref(self, team_context, iteration_id): + """GetCapacitiesWithIdentityRef. + Get a team's capacity + :param :class:` ` team_context: The team context for the operation + :param str iteration_id: ID of the iteration + :rtype: [TeamMemberCapacityIdentityRef] + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if iteration_id is not None: + route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'str') + response = self._send(http_method='GET', + location_id='74412d15-8c1a-4352-a48d-ef1ed5587d57', + version='5.1', + route_values=route_values) + return self._deserialize('[TeamMemberCapacityIdentityRef]', self._unwrap_collection(response)) + + def get_capacity_with_identity_ref(self, team_context, iteration_id, team_member_id): + """GetCapacityWithIdentityRef. + Get a team member's capacity + :param :class:` ` team_context: The team context for the operation + :param str iteration_id: ID of the iteration + :param str team_member_id: ID of the team member + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if iteration_id is not None: + route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'str') + if team_member_id is not None: + route_values['teamMemberId'] = self._serialize.url('team_member_id', team_member_id, 'str') + response = self._send(http_method='GET', + location_id='74412d15-8c1a-4352-a48d-ef1ed5587d57', + version='5.1', + route_values=route_values) + return self._deserialize('TeamMemberCapacityIdentityRef', response) + + def replace_capacities_with_identity_ref(self, capacities, team_context, iteration_id): + """ReplaceCapacitiesWithIdentityRef. + Replace a team's capacity + :param [TeamMemberCapacityIdentityRef] capacities: Team capacity to replace + :param :class:` ` team_context: The team context for the operation + :param str iteration_id: ID of the iteration + :rtype: [TeamMemberCapacityIdentityRef] + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if iteration_id is not None: + route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'str') + content = self._serialize.body(capacities, '[TeamMemberCapacityIdentityRef]') + response = self._send(http_method='PUT', + location_id='74412d15-8c1a-4352-a48d-ef1ed5587d57', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[TeamMemberCapacityIdentityRef]', self._unwrap_collection(response)) + + def update_capacity_with_identity_ref(self, patch, team_context, iteration_id, team_member_id): + """UpdateCapacityWithIdentityRef. + Update a team member's capacity + :param :class:` ` patch: Updated capacity + :param :class:` ` team_context: The team context for the operation + :param str iteration_id: ID of the iteration + :param str team_member_id: ID of the team member + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if iteration_id is not None: + route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'str') + if team_member_id is not None: + route_values['teamMemberId'] = self._serialize.url('team_member_id', team_member_id, 'str') + content = self._serialize.body(patch, 'CapacityPatch') + response = self._send(http_method='PATCH', + location_id='74412d15-8c1a-4352-a48d-ef1ed5587d57', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('TeamMemberCapacityIdentityRef', response) + + def get_board_card_rule_settings(self, team_context, board): + """GetBoardCardRuleSettings. + Get board card Rule settings for the board id or board by name + :param :class:` ` team_context: The team context for the operation + :param str board: + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if board is not None: + route_values['board'] = self._serialize.url('board', board, 'str') + response = self._send(http_method='GET', + location_id='b044a3d9-02ea-49c7-91a1-b730949cc896', + version='5.1', + route_values=route_values) + return self._deserialize('BoardCardRuleSettings', response) + + def update_board_card_rule_settings(self, board_card_rule_settings, team_context, board): + """UpdateBoardCardRuleSettings. + Update board card Rule settings for the board id or board by name + :param :class:` ` board_card_rule_settings: + :param :class:` ` team_context: The team context for the operation + :param str board: + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if board is not None: + route_values['board'] = self._serialize.url('board', board, 'str') + content = self._serialize.body(board_card_rule_settings, 'BoardCardRuleSettings') + response = self._send(http_method='PATCH', + location_id='b044a3d9-02ea-49c7-91a1-b730949cc896', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('BoardCardRuleSettings', response) + + def get_board_card_settings(self, team_context, board): + """GetBoardCardSettings. + Get board card settings for the board id or board by name + :param :class:` ` team_context: The team context for the operation + :param str board: + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if board is not None: + route_values['board'] = self._serialize.url('board', board, 'str') + response = self._send(http_method='GET', + location_id='07c3b467-bc60-4f05-8e34-599ce288fafc', + version='5.1', + route_values=route_values) + return self._deserialize('BoardCardSettings', response) + + def update_board_card_settings(self, board_card_settings_to_save, team_context, board): + """UpdateBoardCardSettings. + Update board card settings for the board id or board by name + :param :class:` ` board_card_settings_to_save: + :param :class:` ` team_context: The team context for the operation + :param str board: + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if board is not None: + route_values['board'] = self._serialize.url('board', board, 'str') + content = self._serialize.body(board_card_settings_to_save, 'BoardCardSettings') + response = self._send(http_method='PUT', + location_id='07c3b467-bc60-4f05-8e34-599ce288fafc', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('BoardCardSettings', response) + + def get_board_chart(self, team_context, board, name): + """GetBoardChart. + Get a board chart + :param :class:` ` team_context: The team context for the operation + :param str board: Identifier for board, either board's backlog level name (Eg:"Stories") or Id + :param str name: The chart name + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if board is not None: + route_values['board'] = self._serialize.url('board', board, 'str') + if name is not None: + route_values['name'] = self._serialize.url('name', name, 'str') + response = self._send(http_method='GET', + location_id='45fe888c-239e-49fd-958c-df1a1ab21d97', + version='5.1', + route_values=route_values) + return self._deserialize('BoardChart', response) + + def get_board_charts(self, team_context, board): + """GetBoardCharts. + Get board charts + :param :class:` ` team_context: The team context for the operation + :param str board: Identifier for board, either board's backlog level name (Eg:"Stories") or Id + :rtype: [BoardChartReference] + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if board is not None: + route_values['board'] = self._serialize.url('board', board, 'str') + response = self._send(http_method='GET', + location_id='45fe888c-239e-49fd-958c-df1a1ab21d97', + version='5.1', + route_values=route_values) + return self._deserialize('[BoardChartReference]', self._unwrap_collection(response)) + + def update_board_chart(self, chart, team_context, board, name): + """UpdateBoardChart. + Update a board chart + :param :class:` ` chart: + :param :class:` ` team_context: The team context for the operation + :param str board: Identifier for board, either board's backlog level name (Eg:"Stories") or Id + :param str name: The chart name + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if board is not None: + route_values['board'] = self._serialize.url('board', board, 'str') + if name is not None: + route_values['name'] = self._serialize.url('name', name, 'str') + content = self._serialize.body(chart, 'BoardChart') + response = self._send(http_method='PATCH', + location_id='45fe888c-239e-49fd-958c-df1a1ab21d97', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('BoardChart', response) + + def get_board_columns(self, team_context, board): + """GetBoardColumns. + Get columns on a board + :param :class:` ` team_context: The team context for the operation + :param str board: Name or ID of the specific board + :rtype: [BoardColumn] + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if board is not None: + route_values['board'] = self._serialize.url('board', board, 'str') + response = self._send(http_method='GET', + location_id='c555d7ff-84e1-47df-9923-a3fe0cd8751b', + version='5.1', + route_values=route_values) + return self._deserialize('[BoardColumn]', self._unwrap_collection(response)) + + def update_board_columns(self, board_columns, team_context, board): + """UpdateBoardColumns. + Update columns on a board + :param [BoardColumn] board_columns: List of board columns to update + :param :class:` ` team_context: The team context for the operation + :param str board: Name or ID of the specific board + :rtype: [BoardColumn] + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if board is not None: + route_values['board'] = self._serialize.url('board', board, 'str') + content = self._serialize.body(board_columns, '[BoardColumn]') + response = self._send(http_method='PUT', + location_id='c555d7ff-84e1-47df-9923-a3fe0cd8751b', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[BoardColumn]', self._unwrap_collection(response)) + + def get_delivery_timeline_data(self, project, id, revision=None, start_date=None, end_date=None): + """GetDeliveryTimelineData. + Get Delivery View Data + :param str project: Project ID or project name + :param str id: Identifier for delivery view + :param int revision: Revision of the plan for which you want data. If the current plan is a different revision you will get an ViewRevisionMismatchException exception. If you do not supply a revision you will get data for the latest revision. + :param datetime start_date: The start date of timeline + :param datetime end_date: The end date of timeline + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'str') + query_parameters = {} + if revision is not None: + query_parameters['revision'] = self._serialize.query('revision', revision, 'int') + if start_date is not None: + query_parameters['startDate'] = self._serialize.query('start_date', start_date, 'iso-8601') + if end_date is not None: + query_parameters['endDate'] = self._serialize.query('end_date', end_date, 'iso-8601') + response = self._send(http_method='GET', + location_id='bdd0834e-101f-49f0-a6ae-509f384a12b4', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('DeliveryViewData', response) + + def delete_team_iteration(self, team_context, id): + """DeleteTeamIteration. + Delete a team's iteration by iterationId + :param :class:` ` team_context: The team context for the operation + :param str id: ID of the iteration + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'str') + self._send(http_method='DELETE', + location_id='c9175577-28a1-4b06-9197-8636af9f64ad', + version='5.1', + route_values=route_values) + + def get_team_iteration(self, team_context, id): + """GetTeamIteration. + Get team's iteration by iterationId + :param :class:` ` team_context: The team context for the operation + :param str id: ID of the iteration + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'str') + response = self._send(http_method='GET', + location_id='c9175577-28a1-4b06-9197-8636af9f64ad', + version='5.1', + route_values=route_values) + return self._deserialize('TeamSettingsIteration', response) + + def get_team_iterations(self, team_context, timeframe=None): + """GetTeamIterations. + Get a team's iterations using timeframe filter + :param :class:` ` team_context: The team context for the operation + :param str timeframe: A filter for which iterations are returned based on relative time. Only Current is supported currently. + :rtype: [TeamSettingsIteration] + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + query_parameters = {} + if timeframe is not None: + query_parameters['$timeframe'] = self._serialize.query('timeframe', timeframe, 'str') + response = self._send(http_method='GET', + location_id='c9175577-28a1-4b06-9197-8636af9f64ad', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[TeamSettingsIteration]', self._unwrap_collection(response)) + + def post_team_iteration(self, iteration, team_context): + """PostTeamIteration. + Add an iteration to the team + :param :class:` ` iteration: Iteration to add + :param :class:` ` team_context: The team context for the operation + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + content = self._serialize.body(iteration, 'TeamSettingsIteration') + response = self._send(http_method='POST', + location_id='c9175577-28a1-4b06-9197-8636af9f64ad', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('TeamSettingsIteration', response) + + def create_plan(self, posted_plan, project): + """CreatePlan. + Add a new plan for the team + :param :class:` ` posted_plan: Plan definition + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(posted_plan, 'CreatePlan') + response = self._send(http_method='POST', + location_id='0b42cb47-cd73-4810-ac90-19c9ba147453', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('Plan', response) + + def delete_plan(self, project, id): + """DeletePlan. + Delete the specified plan + :param str project: Project ID or project name + :param str id: Identifier of the plan + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'str') + self._send(http_method='DELETE', + location_id='0b42cb47-cd73-4810-ac90-19c9ba147453', + version='5.1', + route_values=route_values) + + def get_plan(self, project, id): + """GetPlan. + Get the information for the specified plan + :param str project: Project ID or project name + :param str id: Identifier of the plan + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'str') + response = self._send(http_method='GET', + location_id='0b42cb47-cd73-4810-ac90-19c9ba147453', + version='5.1', + route_values=route_values) + return self._deserialize('Plan', response) + + def get_plans(self, project): + """GetPlans. + Get the information for all the plans configured for the given team + :param str project: Project ID or project name + :rtype: [Plan] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='0b42cb47-cd73-4810-ac90-19c9ba147453', + version='5.1', + route_values=route_values) + return self._deserialize('[Plan]', self._unwrap_collection(response)) + + def update_plan(self, updated_plan, project, id): + """UpdatePlan. + Update the information for the specified plan + :param :class:` ` updated_plan: Plan definition to be updated + :param str project: Project ID or project name + :param str id: Identifier of the plan + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'str') + content = self._serialize.body(updated_plan, 'UpdatePlan') + response = self._send(http_method='PUT', + location_id='0b42cb47-cd73-4810-ac90-19c9ba147453', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('Plan', response) + + def get_board_rows(self, team_context, board): + """GetBoardRows. + Get rows on a board + :param :class:` ` team_context: The team context for the operation + :param str board: Name or ID of the specific board + :rtype: [BoardRow] + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if board is not None: + route_values['board'] = self._serialize.url('board', board, 'str') + response = self._send(http_method='GET', + location_id='0863355d-aefd-4d63-8669-984c9b7b0e78', + version='5.1', + route_values=route_values) + return self._deserialize('[BoardRow]', self._unwrap_collection(response)) + + def update_board_rows(self, board_rows, team_context, board): + """UpdateBoardRows. + Update rows on a board + :param [BoardRow] board_rows: List of board rows to update + :param :class:` ` team_context: The team context for the operation + :param str board: Name or ID of the specific board + :rtype: [BoardRow] + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if board is not None: + route_values['board'] = self._serialize.url('board', board, 'str') + content = self._serialize.body(board_rows, '[BoardRow]') + response = self._send(http_method='PUT', + location_id='0863355d-aefd-4d63-8669-984c9b7b0e78', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[BoardRow]', self._unwrap_collection(response)) + + def get_team_days_off(self, team_context, iteration_id): + """GetTeamDaysOff. + Get team's days off for an iteration + :param :class:` ` team_context: The team context for the operation + :param str iteration_id: ID of the iteration + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if iteration_id is not None: + route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'str') + response = self._send(http_method='GET', + location_id='2d4faa2e-9150-4cbf-a47a-932b1b4a0773', + version='5.1', + route_values=route_values) + return self._deserialize('TeamSettingsDaysOff', response) + + def update_team_days_off(self, days_off_patch, team_context, iteration_id): + """UpdateTeamDaysOff. + Set a team's days off for an iteration + :param :class:` ` days_off_patch: Team's days off patch containing a list of start and end dates + :param :class:` ` team_context: The team context for the operation + :param str iteration_id: ID of the iteration + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if iteration_id is not None: + route_values['iterationId'] = self._serialize.url('iteration_id', iteration_id, 'str') + content = self._serialize.body(days_off_patch, 'TeamSettingsDaysOffPatch') + response = self._send(http_method='PATCH', + location_id='2d4faa2e-9150-4cbf-a47a-932b1b4a0773', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('TeamSettingsDaysOff', response) + + def get_team_field_values(self, team_context): + """GetTeamFieldValues. + Get a collection of team field values + :param :class:` ` team_context: The team context for the operation + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + response = self._send(http_method='GET', + location_id='07ced576-58ed-49e6-9c1e-5cb53ab8bf2a', + version='5.1', + route_values=route_values) + return self._deserialize('TeamFieldValues', response) + + def update_team_field_values(self, patch, team_context): + """UpdateTeamFieldValues. + Update team field values + :param :class:` ` patch: + :param :class:` ` team_context: The team context for the operation + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + content = self._serialize.body(patch, 'TeamFieldValuesPatch') + response = self._send(http_method='PATCH', + location_id='07ced576-58ed-49e6-9c1e-5cb53ab8bf2a', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('TeamFieldValues', response) + + def get_team_settings(self, team_context): + """GetTeamSettings. + Get a team's settings + :param :class:` ` team_context: The team context for the operation + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + response = self._send(http_method='GET', + location_id='c3c1012b-bea7-49d7-b45e-1664e566f84c', + version='5.1', + route_values=route_values) + return self._deserialize('TeamSetting', response) + + def update_team_settings(self, team_settings_patch, team_context): + """UpdateTeamSettings. + Update a team's settings + :param :class:` ` team_settings_patch: TeamSettings changes + :param :class:` ` team_context: The team context for the operation + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + content = self._serialize.body(team_settings_patch, 'TeamSettingsPatch') + response = self._send(http_method='PATCH', + location_id='c3c1012b-bea7-49d7-b45e-1664e566f84c', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('TeamSetting', response) + diff --git a/azure-devops/azure/devops/released/work_item_tracking/__init__.py b/azure-devops/azure/devops/released/work_item_tracking/__init__.py new file mode 100644 index 00000000..40999905 --- /dev/null +++ b/azure-devops/azure/devops/released/work_item_tracking/__init__.py @@ -0,0 +1,94 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.work_item_tracking.models import * +from .work_item_tracking_client import WorkItemTrackingClient + +__all__ = [ + 'AccountMyWorkResult', + 'AccountRecentActivityWorkItemModel', + 'AccountRecentActivityWorkItemModel2', + 'AccountRecentActivityWorkItemModelBase', + 'AccountRecentMentionWorkItemModel', + 'AccountWorkWorkItemModel', + 'ArtifactUriQuery', + 'ArtifactUriQueryResult', + 'AttachmentReference', + 'Comment', + 'CommentCreate', + 'CommentList', + 'CommentMention', + 'CommentReaction', + 'CommentUpdate', + 'CommentVersion', + 'FieldDependentRule', + 'FieldsToEvaluate', + 'GraphSubjectBase', + 'IdentityRef', + 'IdentityReference', + 'JsonPatchOperation', + 'Link', + 'ProjectWorkItemStateColors', + 'ProvisioningResult', + 'QueryBatchGetRequest', + 'QueryHierarchyItem', + 'QueryHierarchyItemsResult', + 'ReferenceLinks', + 'ReportingWorkItemLinksBatch', + 'ReportingWorkItemRevisionsBatch', + 'ReportingWorkItemRevisionsFilter', + 'StreamedBatch', + 'TeamContext', + 'Wiql', + 'WorkArtifactLink', + 'WorkItem', + 'WorkItemBatchGetRequest', + 'WorkItemClassificationNode', + 'WorkItemComment', + 'WorkItemComments', + 'WorkItemCommentVersionRef', + 'WorkItemDelete', + 'WorkItemDeleteReference', + 'WorkItemDeleteShallowReference', + 'WorkItemDeleteUpdate', + 'WorkItemField', + 'WorkItemFieldOperation', + 'WorkItemFieldReference', + 'WorkItemFieldUpdate', + 'WorkItemHistory', + 'WorkItemIcon', + 'WorkItemLink', + 'WorkItemNextStateOnTransition', + 'WorkItemQueryClause', + 'WorkItemQueryResult', + 'WorkItemQuerySortColumn', + 'WorkItemReference', + 'WorkItemRelation', + 'WorkItemRelationType', + 'WorkItemRelationUpdates', + 'WorkItemStateColor', + 'WorkItemStateTransition', + 'WorkItemTemplate', + 'WorkItemTemplateReference', + 'WorkItemTrackingReference', + 'WorkItemTrackingResource', + 'WorkItemTrackingResourceReference', + 'WorkItemType', + 'WorkItemTypeCategory', + 'WorkItemTypeColor', + 'WorkItemTypeColorAndIcon', + 'WorkItemTypeFieldInstance', + 'WorkItemTypeFieldInstanceBase', + 'WorkItemTypeFieldWithReferences', + 'WorkItemTypeReference', + 'WorkItemTypeStateColors', + 'WorkItemTypeTemplate', + 'WorkItemTypeTemplateUpdateModel', + 'WorkItemUpdate', + 'WorkItemTrackingClient' +] diff --git a/azure-devops/azure/devops/released/work_item_tracking/work_item_tracking_client.py b/azure-devops/azure/devops/released/work_item_tracking/work_item_tracking_client.py new file mode 100644 index 00000000..8e2675ce --- /dev/null +++ b/azure-devops/azure/devops/released/work_item_tracking/work_item_tracking_client.py @@ -0,0 +1,1370 @@ +# -------------------------------------------------------------------------------------------- +# 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 ...v5_1.work_item_tracking import models + + +class WorkItemTrackingClient(Client): + """WorkItemTracking + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(WorkItemTrackingClient, 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 = '5264459e-e5e0-4bd8-b118-0985e68a4ec5' + + def create_attachment(self, upload_stream, project=None, file_name=None, upload_type=None, area_path=None, **kwargs): + """CreateAttachment. + Uploads an attachment. + :param object upload_stream: Stream to upload + :param str project: Project ID or project name + :param str file_name: The name of the file + :param str upload_type: Attachment upload type: Simple or Chunked + :param str area_path: Target project Area Path + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + if upload_type is not None: + query_parameters['uploadType'] = self._serialize.query('upload_type', upload_type, 'str') + if area_path is not None: + query_parameters['areaPath'] = self._serialize.query('area_path', area_path, 'str') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + content = self._client.stream_upload(upload_stream, callback=callback) + response = self._send(http_method='POST', + location_id='e07b5fa4-1499-494d-a496-64b860fd64ff', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content, + media_type='application/octet-stream') + return self._deserialize('AttachmentReference', response) + + def get_attachment_content(self, id, project=None, file_name=None, download=None, **kwargs): + """GetAttachmentContent. + Downloads an attachment. + :param str id: Attachment ID + :param str project: Project ID or project name + :param str file_name: Name of the file + :param bool download: If set to true always download attachment + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'str') + query_parameters = {} + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + response = self._send(http_method='GET', + location_id='e07b5fa4-1499-494d-a496-64b860fd64ff', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_attachment_zip(self, id, project=None, file_name=None, download=None, **kwargs): + """GetAttachmentZip. + Downloads an attachment. + :param str id: Attachment ID + :param str project: Project ID or project name + :param str file_name: Name of the file + :param bool download: If set to true always download attachment + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'str') + query_parameters = {} + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + if download is not None: + query_parameters['download'] = self._serialize.query('download', download, 'bool') + response = self._send(http_method='GET', + location_id='e07b5fa4-1499-494d-a496-64b860fd64ff', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_classification_nodes(self, project, ids, depth=None, error_policy=None): + """GetClassificationNodes. + Gets root classification nodes or list of classification nodes for a given list of nodes ids, for a given project. In case ids parameter is supplied you will get list of classification nodes for those ids. Otherwise you will get root classification nodes for this project. + :param str project: Project ID or project name + :param [int] ids: Comma separated integer classification nodes ids. It's not required, if you want root nodes. + :param int depth: Depth of children to fetch. + :param str error_policy: Flag to handle errors in getting some nodes. Possible options are Fail and Omit. + :rtype: [WorkItemClassificationNode] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if ids is not None: + ids = ",".join(map(str, ids)) + query_parameters['ids'] = self._serialize.query('ids', ids, 'str') + if depth is not None: + query_parameters['$depth'] = self._serialize.query('depth', depth, 'int') + if error_policy is not None: + query_parameters['errorPolicy'] = self._serialize.query('error_policy', error_policy, 'str') + response = self._send(http_method='GET', + location_id='a70579d1-f53a-48ee-a5be-7be8659023b9', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[WorkItemClassificationNode]', self._unwrap_collection(response)) + + def get_root_nodes(self, project, depth=None): + """GetRootNodes. + Gets root classification nodes under the project. + :param str project: Project ID or project name + :param int depth: Depth of children to fetch. + :rtype: [WorkItemClassificationNode] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if depth is not None: + query_parameters['$depth'] = self._serialize.query('depth', depth, 'int') + response = self._send(http_method='GET', + location_id='a70579d1-f53a-48ee-a5be-7be8659023b9', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[WorkItemClassificationNode]', self._unwrap_collection(response)) + + def create_or_update_classification_node(self, posted_node, project, structure_group, path=None): + """CreateOrUpdateClassificationNode. + Create new or update an existing classification node. + :param :class:` ` posted_node: Node to create or update. + :param str project: Project ID or project name + :param TreeStructureGroup structure_group: Structure group of the classification node, area or iteration. + :param str path: Path of the classification node. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if structure_group is not None: + route_values['structureGroup'] = self._serialize.url('structure_group', structure_group, 'TreeStructureGroup') + if path is not None: + route_values['path'] = self._serialize.url('path', path, 'str') + content = self._serialize.body(posted_node, 'WorkItemClassificationNode') + response = self._send(http_method='POST', + location_id='5a172953-1b41-49d3-840a-33f79c3ce89f', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('WorkItemClassificationNode', response) + + def delete_classification_node(self, project, structure_group, path=None, reclassify_id=None): + """DeleteClassificationNode. + Delete an existing classification node. + :param str project: Project ID or project name + :param TreeStructureGroup structure_group: Structure group of the classification node, area or iteration. + :param str path: Path of the classification node. + :param int reclassify_id: Id of the target classification node for reclassification. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if structure_group is not None: + route_values['structureGroup'] = self._serialize.url('structure_group', structure_group, 'TreeStructureGroup') + if path is not None: + route_values['path'] = self._serialize.url('path', path, 'str') + query_parameters = {} + if reclassify_id is not None: + query_parameters['$reclassifyId'] = self._serialize.query('reclassify_id', reclassify_id, 'int') + self._send(http_method='DELETE', + location_id='5a172953-1b41-49d3-840a-33f79c3ce89f', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + + def get_classification_node(self, project, structure_group, path=None, depth=None): + """GetClassificationNode. + Gets the classification node for a given node path. + :param str project: Project ID or project name + :param TreeStructureGroup structure_group: Structure group of the classification node, area or iteration. + :param str path: Path of the classification node. + :param int depth: Depth of children to fetch. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if structure_group is not None: + route_values['structureGroup'] = self._serialize.url('structure_group', structure_group, 'TreeStructureGroup') + if path is not None: + route_values['path'] = self._serialize.url('path', path, 'str') + query_parameters = {} + if depth is not None: + query_parameters['$depth'] = self._serialize.query('depth', depth, 'int') + response = self._send(http_method='GET', + location_id='5a172953-1b41-49d3-840a-33f79c3ce89f', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('WorkItemClassificationNode', response) + + def update_classification_node(self, posted_node, project, structure_group, path=None): + """UpdateClassificationNode. + Update an existing classification node. + :param :class:` ` posted_node: Node to create or update. + :param str project: Project ID or project name + :param TreeStructureGroup structure_group: Structure group of the classification node, area or iteration. + :param str path: Path of the classification node. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if structure_group is not None: + route_values['structureGroup'] = self._serialize.url('structure_group', structure_group, 'TreeStructureGroup') + if path is not None: + route_values['path'] = self._serialize.url('path', path, 'str') + content = self._serialize.body(posted_node, 'WorkItemClassificationNode') + response = self._send(http_method='PATCH', + location_id='5a172953-1b41-49d3-840a-33f79c3ce89f', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('WorkItemClassificationNode', response) + + def create_field(self, work_item_field, project=None): + """CreateField. + Create a new field. + :param :class:` ` work_item_field: New field definition + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(work_item_field, 'WorkItemField') + response = self._send(http_method='POST', + location_id='b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('WorkItemField', response) + + def delete_field(self, field_name_or_ref_name, project=None): + """DeleteField. + Deletes the field. + :param str field_name_or_ref_name: Field simple name or reference name + :param str project: Project ID or project name + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if field_name_or_ref_name is not None: + route_values['fieldNameOrRefName'] = self._serialize.url('field_name_or_ref_name', field_name_or_ref_name, 'str') + self._send(http_method='DELETE', + location_id='b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94', + version='5.1', + route_values=route_values) + + def get_field(self, field_name_or_ref_name, project=None): + """GetField. + Gets information on a specific field. + :param str field_name_or_ref_name: Field simple name or reference name + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if field_name_or_ref_name is not None: + route_values['fieldNameOrRefName'] = self._serialize.url('field_name_or_ref_name', field_name_or_ref_name, 'str') + response = self._send(http_method='GET', + location_id='b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94', + version='5.1', + route_values=route_values) + return self._deserialize('WorkItemField', response) + + def get_fields(self, project=None, expand=None): + """GetFields. + Returns information for all fields. + :param str project: Project ID or project name + :param str expand: Use ExtensionFields to include extension fields, otherwise exclude them. Unless the feature flag for this parameter is enabled, extension fields are always included. + :rtype: [WorkItemField] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + response = self._send(http_method='GET', + location_id='b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[WorkItemField]', self._unwrap_collection(response)) + + def create_query(self, posted_query, project, query, validate_wiql_only=None): + """CreateQuery. + Creates a query, or moves a query. + :param :class:` ` posted_query: The query to create. + :param str project: Project ID or project name + :param str query: The parent id or path under which the query is to be created. + :param bool validate_wiql_only: If you only want to validate your WIQL query without actually creating one, set it to true. Default is false. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if query is not None: + route_values['query'] = self._serialize.url('query', query, 'str') + query_parameters = {} + if validate_wiql_only is not None: + query_parameters['validateWiqlOnly'] = self._serialize.query('validate_wiql_only', validate_wiql_only, 'bool') + content = self._serialize.body(posted_query, 'QueryHierarchyItem') + response = self._send(http_method='POST', + location_id='a67d190c-c41f-424b-814d-0e906f659301', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('QueryHierarchyItem', response) + + def delete_query(self, project, query): + """DeleteQuery. + Delete a query or a folder. This deletes any permission change on the deleted query or folder and any of its descendants if it is a folder. It is important to note that the deleted permission changes cannot be recovered upon undeleting the query or folder. + :param str project: Project ID or project name + :param str query: ID or path of the query or folder to delete. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if query is not None: + route_values['query'] = self._serialize.url('query', query, 'str') + self._send(http_method='DELETE', + location_id='a67d190c-c41f-424b-814d-0e906f659301', + version='5.1', + route_values=route_values) + + def get_queries(self, project, expand=None, depth=None, include_deleted=None): + """GetQueries. + Gets the root queries and their children + :param str project: Project ID or project name + :param str expand: Include the query string (wiql), clauses, query result columns, and sort options in the results. + :param int depth: In the folder of queries, return child queries and folders to this depth. + :param bool include_deleted: Include deleted queries and folders + :rtype: [QueryHierarchyItem] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + if depth is not None: + query_parameters['$depth'] = self._serialize.query('depth', depth, 'int') + if include_deleted is not None: + query_parameters['$includeDeleted'] = self._serialize.query('include_deleted', include_deleted, 'bool') + response = self._send(http_method='GET', + location_id='a67d190c-c41f-424b-814d-0e906f659301', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[QueryHierarchyItem]', self._unwrap_collection(response)) + + def get_query(self, project, query, expand=None, depth=None, include_deleted=None): + """GetQuery. + Retrieves an individual query and its children + :param str project: Project ID or project name + :param str query: ID or path of the query. + :param str expand: Include the query string (wiql), clauses, query result columns, and sort options in the results. + :param int depth: In the folder of queries, return child queries and folders to this depth. + :param bool include_deleted: Include deleted queries and folders + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if query is not None: + route_values['query'] = self._serialize.url('query', query, 'str') + query_parameters = {} + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + if depth is not None: + query_parameters['$depth'] = self._serialize.query('depth', depth, 'int') + if include_deleted is not None: + query_parameters['$includeDeleted'] = self._serialize.query('include_deleted', include_deleted, 'bool') + response = self._send(http_method='GET', + location_id='a67d190c-c41f-424b-814d-0e906f659301', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('QueryHierarchyItem', response) + + def search_queries(self, project, filter, top=None, expand=None, include_deleted=None): + """SearchQueries. + Searches all queries the user has access to in the current project + :param str project: Project ID or project name + :param str filter: The text to filter the queries with. + :param int top: The number of queries to return (Default is 50 and maximum is 200). + :param str expand: + :param bool include_deleted: Include deleted queries and folders + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query('filter', filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + if include_deleted is not None: + query_parameters['$includeDeleted'] = self._serialize.query('include_deleted', include_deleted, 'bool') + response = self._send(http_method='GET', + location_id='a67d190c-c41f-424b-814d-0e906f659301', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('QueryHierarchyItemsResult', response) + + def update_query(self, query_update, project, query, undelete_descendants=None): + """UpdateQuery. + Update a query or a folder. This allows you to update, rename and move queries and folders. + :param :class:` ` query_update: The query to update. + :param str project: Project ID or project name + :param str query: The ID or path for the query to update. + :param bool undelete_descendants: Undelete the children of this folder. It is important to note that this will not bring back the permission changes that were previously applied to the descendants. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if query is not None: + route_values['query'] = self._serialize.url('query', query, 'str') + query_parameters = {} + if undelete_descendants is not None: + query_parameters['$undeleteDescendants'] = self._serialize.query('undelete_descendants', undelete_descendants, 'bool') + content = self._serialize.body(query_update, 'QueryHierarchyItem') + response = self._send(http_method='PATCH', + location_id='a67d190c-c41f-424b-814d-0e906f659301', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('QueryHierarchyItem', response) + + def get_queries_batch(self, query_get_request, project): + """GetQueriesBatch. + Gets a list of queries by ids (Maximum 1000) + :param :class:` ` query_get_request: + :param str project: Project ID or project name + :rtype: [QueryHierarchyItem] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(query_get_request, 'QueryBatchGetRequest') + response = self._send(http_method='POST', + location_id='549816f9-09b0-4e75-9e81-01fbfcd07426', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[QueryHierarchyItem]', self._unwrap_collection(response)) + + def destroy_work_item(self, id, project=None): + """DestroyWorkItem. + Destroys the specified work item permanently from the Recycle Bin. This action can not be undone. + :param int id: ID of the work item to be destroyed permanently + :param str project: Project ID or project name + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'int') + self._send(http_method='DELETE', + location_id='b70d8d39-926c-465e-b927-b1bf0e5ca0e0', + version='5.1', + route_values=route_values) + + def get_deleted_work_item(self, id, project=None): + """GetDeletedWorkItem. + Gets a deleted work item from Recycle Bin. + :param int id: ID of the work item to be returned + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'int') + response = self._send(http_method='GET', + location_id='b70d8d39-926c-465e-b927-b1bf0e5ca0e0', + version='5.1', + route_values=route_values) + return self._deserialize('WorkItemDelete', response) + + def get_deleted_work_items(self, ids, project=None): + """GetDeletedWorkItems. + Gets the work items from the recycle bin, whose IDs have been specified in the parameters + :param [int] ids: Comma separated list of IDs of the deleted work items to be returned + :param str project: Project ID or project name + :rtype: [WorkItemDeleteReference] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if ids is not None: + ids = ",".join(map(str, ids)) + query_parameters['ids'] = self._serialize.query('ids', ids, 'str') + response = self._send(http_method='GET', + location_id='b70d8d39-926c-465e-b927-b1bf0e5ca0e0', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[WorkItemDeleteReference]', self._unwrap_collection(response)) + + def get_deleted_work_item_shallow_references(self, project=None): + """GetDeletedWorkItemShallowReferences. + Gets a list of the IDs and the URLs of the deleted the work items in the Recycle Bin. + :param str project: Project ID or project name + :rtype: [WorkItemDeleteShallowReference] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='b70d8d39-926c-465e-b927-b1bf0e5ca0e0', + version='5.1', + route_values=route_values) + return self._deserialize('[WorkItemDeleteShallowReference]', self._unwrap_collection(response)) + + def restore_work_item(self, payload, id, project=None): + """RestoreWorkItem. + Restores the deleted work item from Recycle Bin. + :param :class:` ` payload: Paylod with instructions to update the IsDeleted flag to false + :param int id: ID of the work item to be restored + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'int') + content = self._serialize.body(payload, 'WorkItemDeleteUpdate') + response = self._send(http_method='PATCH', + location_id='b70d8d39-926c-465e-b927-b1bf0e5ca0e0', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('WorkItemDelete', response) + + def get_revision(self, id, revision_number, project=None, expand=None): + """GetRevision. + Returns a fully hydrated work item for the requested revision + :param int id: + :param int revision_number: + :param str project: Project ID or project name + :param str expand: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'int') + if revision_number is not None: + route_values['revisionNumber'] = self._serialize.url('revision_number', revision_number, 'int') + query_parameters = {} + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + response = self._send(http_method='GET', + location_id='a00c85a5-80fa-4565-99c3-bcd2181434bb', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('WorkItem', response) + + def get_revisions(self, id, project=None, top=None, skip=None, expand=None): + """GetRevisions. + Returns the list of fully hydrated work item revisions, paged. + :param int id: + :param str project: Project ID or project name + :param int top: + :param int skip: + :param str expand: + :rtype: [WorkItem] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'int') + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + response = self._send(http_method='GET', + location_id='a00c85a5-80fa-4565-99c3-bcd2181434bb', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[WorkItem]', self._unwrap_collection(response)) + + def get_update(self, id, update_number, project=None): + """GetUpdate. + Returns a single update for a work item + :param int id: + :param int update_number: + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'int') + if update_number is not None: + route_values['updateNumber'] = self._serialize.url('update_number', update_number, 'int') + response = self._send(http_method='GET', + location_id='6570bf97-d02c-4a91-8d93-3abe9895b1a9', + version='5.1', + route_values=route_values) + return self._deserialize('WorkItemUpdate', response) + + def get_updates(self, id, project=None, top=None, skip=None): + """GetUpdates. + Returns a the deltas between work item revisions + :param int id: + :param str project: Project ID or project name + :param int top: + :param int skip: + :rtype: [WorkItemUpdate] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'int') + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if skip is not None: + query_parameters['$skip'] = self._serialize.query('skip', skip, 'int') + response = self._send(http_method='GET', + location_id='6570bf97-d02c-4a91-8d93-3abe9895b1a9', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[WorkItemUpdate]', self._unwrap_collection(response)) + + def query_by_wiql(self, wiql, team_context=None, time_precision=None, top=None): + """QueryByWiql. + Gets the results of the query given its WIQL. + :param :class:` ` wiql: The query containing the WIQL. + :param :class:` ` team_context: The team context for the operation + :param bool time_precision: Whether or not to use time precision. + :param int top: The max number of results to return. + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + query_parameters = {} + if time_precision is not None: + query_parameters['timePrecision'] = self._serialize.query('time_precision', time_precision, 'bool') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + content = self._serialize.body(wiql, 'Wiql') + response = self._send(http_method='POST', + location_id='1a9c53f7-f243-4447-b110-35ef023636e4', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('WorkItemQueryResult', response) + + def get_query_result_count(self, id, team_context=None, time_precision=None, top=None): + """GetQueryResultCount. + Gets the results of the query given the query ID. + :param str id: The query ID. + :param :class:` ` team_context: The team context for the operation + :param bool time_precision: Whether or not to use time precision. + :param int top: The max number of results to return. + :rtype: int + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'str') + query_parameters = {} + if time_precision is not None: + query_parameters['timePrecision'] = self._serialize.query('time_precision', time_precision, 'bool') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + response = self._send(http_method='HEAD', + location_id='a02355f5-5f8a-4671-8e32-369d23aac83d', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('int', response) + + def query_by_id(self, id, team_context=None, time_precision=None, top=None): + """QueryById. + Gets the results of the query given the query ID. + :param str id: The query ID. + :param :class:` ` team_context: The team context for the operation + :param bool time_precision: Whether or not to use time precision. + :param int top: The max number of results to return. + :rtype: :class:` ` + """ + project = None + team = None + if team_context is not None: + if team_context.project_id: + project = team_context.project_id + else: + project = team_context.project + if team_context.team_id: + team = team_context.team_id + else: + team = team_context.team + + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'string') + if team is not None: + route_values['team'] = self._serialize.url('team', team, 'string') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'str') + query_parameters = {} + if time_precision is not None: + query_parameters['timePrecision'] = self._serialize.query('time_precision', time_precision, 'bool') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + response = self._send(http_method='GET', + location_id='a02355f5-5f8a-4671-8e32-369d23aac83d', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('WorkItemQueryResult', response) + + def get_work_item_icon_json(self, icon, color=None, v=None): + """GetWorkItemIconJson. + Get a work item icon given the friendly name and icon color. + :param str icon: The name of the icon + :param str color: The 6-digit hex color for the icon + :param int v: The version of the icon (used only for cache invalidation) + :rtype: :class:` ` + """ + route_values = {} + if icon is not None: + route_values['icon'] = self._serialize.url('icon', icon, 'str') + query_parameters = {} + if color is not None: + query_parameters['color'] = self._serialize.query('color', color, 'str') + if v is not None: + query_parameters['v'] = self._serialize.query('v', v, 'int') + response = self._send(http_method='GET', + location_id='4e1eb4a5-1970-4228-a682-ec48eb2dca30', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('WorkItemIcon', response) + + def get_work_item_icons(self): + """GetWorkItemIcons. + Get a list of all work item icons. + :rtype: [WorkItemIcon] + """ + response = self._send(http_method='GET', + location_id='4e1eb4a5-1970-4228-a682-ec48eb2dca30', + version='5.1') + return self._deserialize('[WorkItemIcon]', self._unwrap_collection(response)) + + def get_work_item_icon_svg(self, icon, color=None, v=None, **kwargs): + """GetWorkItemIconSvg. + Get a work item icon given the friendly name and icon color. + :param str icon: The name of the icon + :param str color: The 6-digit hex color for the icon + :param int v: The version of the icon (used only for cache invalidation) + :rtype: object + """ + route_values = {} + if icon is not None: + route_values['icon'] = self._serialize.url('icon', icon, 'str') + query_parameters = {} + if color is not None: + query_parameters['color'] = self._serialize.query('color', color, 'str') + if v is not None: + query_parameters['v'] = self._serialize.query('v', v, 'int') + response = self._send(http_method='GET', + location_id='4e1eb4a5-1970-4228-a682-ec48eb2dca30', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='image/svg+xml') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_work_item_icon_xaml(self, icon, color=None, v=None, **kwargs): + """GetWorkItemIconXaml. + Get a work item icon given the friendly name and icon color. + :param str icon: The name of the icon + :param str color: The 6-digit hex color for the icon + :param int v: The version of the icon (used only for cache invalidation) + :rtype: object + """ + route_values = {} + if icon is not None: + route_values['icon'] = self._serialize.url('icon', icon, 'str') + query_parameters = {} + if color is not None: + query_parameters['color'] = self._serialize.query('color', color, 'str') + if v is not None: + query_parameters['v'] = self._serialize.query('v', v, 'int') + response = self._send(http_method='GET', + location_id='4e1eb4a5-1970-4228-a682-ec48eb2dca30', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='image/xaml+xml') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_reporting_links_by_link_type(self, project=None, link_types=None, types=None, continuation_token=None, start_date_time=None): + """GetReportingLinksByLinkType. + Get a batch of work item links + :param str project: Project ID or project name + :param [str] link_types: A list of types to filter the results to specific link types. Omit this parameter to get work item links of all link types. + :param [str] types: A list of types to filter the results to specific work item types. Omit this parameter to get work item links of all work item types. + :param str continuation_token: Specifies the continuationToken to start the batch from. Omit this parameter to get the first batch of links. + :param datetime start_date_time: Date/time to use as a starting point for link changes. Only link changes that occurred after that date/time will be returned. Cannot be used in conjunction with 'watermark' parameter. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if link_types is not None: + link_types = ",".join(link_types) + query_parameters['linkTypes'] = self._serialize.query('link_types', link_types, 'str') + if types is not None: + types = ",".join(types) + query_parameters['types'] = self._serialize.query('types', types, 'str') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if start_date_time is not None: + query_parameters['startDateTime'] = self._serialize.query('start_date_time', start_date_time, 'iso-8601') + response = self._send(http_method='GET', + location_id='b5b5b6d0-0308-40a1-b3f4-b9bb3c66878f', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('ReportingWorkItemLinksBatch', response) + + def get_relation_type(self, relation): + """GetRelationType. + Gets the work item relation type definition. + :param str relation: The relation name + :rtype: :class:` ` + """ + route_values = {} + if relation is not None: + route_values['relation'] = self._serialize.url('relation', relation, 'str') + response = self._send(http_method='GET', + location_id='f5d33bc9-5b49-4a3c-a9bd-f3cd46dd2165', + version='5.1', + route_values=route_values) + return self._deserialize('WorkItemRelationType', response) + + def get_relation_types(self): + """GetRelationTypes. + Gets the work item relation types. + :rtype: [WorkItemRelationType] + """ + response = self._send(http_method='GET', + location_id='f5d33bc9-5b49-4a3c-a9bd-f3cd46dd2165', + version='5.1') + return self._deserialize('[WorkItemRelationType]', self._unwrap_collection(response)) + + def read_reporting_revisions_get(self, project=None, fields=None, types=None, continuation_token=None, start_date_time=None, include_identity_ref=None, include_deleted=None, include_tag_ref=None, include_latest_only=None, expand=None, include_discussion_changes_only=None, max_page_size=None): + """ReadReportingRevisionsGet. + Get a batch of work item revisions with the option of including deleted items + :param str project: Project ID or project name + :param [str] fields: A list of fields to return in work item revisions. Omit this parameter to get all reportable fields. + :param [str] types: A list of types to filter the results to specific work item types. Omit this parameter to get work item revisions of all work item types. + :param str continuation_token: Specifies the watermark to start the batch from. Omit this parameter to get the first batch of revisions. + :param datetime start_date_time: Date/time to use as a starting point for revisions, all revisions will occur after this date/time. Cannot be used in conjunction with 'watermark' parameter. + :param bool include_identity_ref: Return an identity reference instead of a string value for identity fields. + :param bool include_deleted: Specify if the deleted item should be returned. + :param bool include_tag_ref: Specify if the tag objects should be returned for System.Tags field. + :param bool include_latest_only: Return only the latest revisions of work items, skipping all historical revisions + :param str expand: Return all the fields in work item revisions, including long text fields which are not returned by default + :param bool include_discussion_changes_only: Return only the those revisions of work items, where only history field was changed + :param int max_page_size: The maximum number of results to return in this batch + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if fields is not None: + fields = ",".join(fields) + query_parameters['fields'] = self._serialize.query('fields', fields, 'str') + if types is not None: + types = ",".join(types) + query_parameters['types'] = self._serialize.query('types', types, 'str') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if start_date_time is not None: + query_parameters['startDateTime'] = self._serialize.query('start_date_time', start_date_time, 'iso-8601') + if include_identity_ref is not None: + query_parameters['includeIdentityRef'] = self._serialize.query('include_identity_ref', include_identity_ref, 'bool') + if include_deleted is not None: + query_parameters['includeDeleted'] = self._serialize.query('include_deleted', include_deleted, 'bool') + if include_tag_ref is not None: + query_parameters['includeTagRef'] = self._serialize.query('include_tag_ref', include_tag_ref, 'bool') + if include_latest_only is not None: + query_parameters['includeLatestOnly'] = self._serialize.query('include_latest_only', include_latest_only, 'bool') + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + if include_discussion_changes_only is not None: + query_parameters['includeDiscussionChangesOnly'] = self._serialize.query('include_discussion_changes_only', include_discussion_changes_only, 'bool') + if max_page_size is not None: + query_parameters['$maxPageSize'] = self._serialize.query('max_page_size', max_page_size, 'int') + response = self._send(http_method='GET', + location_id='f828fe59-dd87-495d-a17c-7a8d6211ca6c', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('ReportingWorkItemRevisionsBatch', response) + + def read_reporting_revisions_post(self, filter, project=None, continuation_token=None, start_date_time=None, expand=None): + """ReadReportingRevisionsPost. + Get a batch of work item revisions. This request may be used if your list of fields is large enough that it may run the URL over the length limit. + :param :class:` ` filter: An object that contains request settings: field filter, type filter, identity format + :param str project: Project ID or project name + :param str continuation_token: Specifies the watermark to start the batch from. Omit this parameter to get the first batch of revisions. + :param datetime start_date_time: Date/time to use as a starting point for revisions, all revisions will occur after this date/time. Cannot be used in conjunction with 'watermark' parameter. + :param str expand: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if start_date_time is not None: + query_parameters['startDateTime'] = self._serialize.query('start_date_time', start_date_time, 'iso-8601') + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + content = self._serialize.body(filter, 'ReportingWorkItemRevisionsFilter') + response = self._send(http_method='POST', + location_id='f828fe59-dd87-495d-a17c-7a8d6211ca6c', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('ReportingWorkItemRevisionsBatch', response) + + def create_work_item(self, document, project, type, validate_only=None, bypass_rules=None, suppress_notifications=None, expand=None): + """CreateWorkItem. + Creates a single work item. + :param :class:`<[JsonPatchOperation]> ` document: The JSON Patch document representing the work item + :param str project: Project ID or project name + :param str type: The work item type of the work item to create + :param bool validate_only: Indicate if you only want to validate the changes without saving the work item + :param bool bypass_rules: Do not enforce the work item type rules on this update + :param bool suppress_notifications: Do not fire any notifications for this change + :param str expand: The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if type is not None: + route_values['type'] = self._serialize.url('type', type, 'str') + query_parameters = {} + if validate_only is not None: + query_parameters['validateOnly'] = self._serialize.query('validate_only', validate_only, 'bool') + if bypass_rules is not None: + query_parameters['bypassRules'] = self._serialize.query('bypass_rules', bypass_rules, 'bool') + if suppress_notifications is not None: + query_parameters['suppressNotifications'] = self._serialize.query('suppress_notifications', suppress_notifications, 'bool') + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + content = self._serialize.body(document, '[JsonPatchOperation]') + response = self._send(http_method='POST', + location_id='62d3d110-0047-428c-ad3c-4fe872c91c74', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content, + media_type='application/json-patch+json') + return self._deserialize('WorkItem', response) + + def get_work_item_template(self, project, type, fields=None, as_of=None, expand=None): + """GetWorkItemTemplate. + Returns a single work item from a template. + :param str project: Project ID or project name + :param str type: The work item type name + :param str fields: Comma-separated list of requested fields + :param datetime as_of: AsOf UTC date time string + :param str expand: The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if type is not None: + route_values['type'] = self._serialize.url('type', type, 'str') + query_parameters = {} + if fields is not None: + query_parameters['fields'] = self._serialize.query('fields', fields, 'str') + if as_of is not None: + query_parameters['asOf'] = self._serialize.query('as_of', as_of, 'iso-8601') + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + response = self._send(http_method='GET', + location_id='62d3d110-0047-428c-ad3c-4fe872c91c74', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('WorkItem', response) + + def delete_work_item(self, id, project=None, destroy=None): + """DeleteWorkItem. + Deletes the specified work item and sends it to the Recycle Bin, so that it can be restored back, if required. Optionally, if the destroy parameter has been set to true, it destroys the work item permanently. WARNING: If the destroy parameter is set to true, work items deleted by this command will NOT go to recycle-bin and there is no way to restore/recover them after deletion. It is recommended NOT to use this parameter. If you do, please use this parameter with extreme caution. + :param int id: ID of the work item to be deleted + :param str project: Project ID or project name + :param bool destroy: Optional parameter, if set to true, the work item is deleted permanently. Please note: the destroy action is PERMANENT and cannot be undone. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'int') + query_parameters = {} + if destroy is not None: + query_parameters['destroy'] = self._serialize.query('destroy', destroy, 'bool') + response = self._send(http_method='DELETE', + location_id='72c7ddf8-2cdc-4f60-90cd-ab71c14a399b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('WorkItemDelete', response) + + def get_work_item(self, id, project=None, fields=None, as_of=None, expand=None): + """GetWorkItem. + Returns a single work item. + :param int id: The work item id + :param str project: Project ID or project name + :param [str] fields: Comma-separated list of requested fields + :param datetime as_of: AsOf UTC date time string + :param str expand: The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'int') + query_parameters = {} + if fields is not None: + fields = ",".join(fields) + query_parameters['fields'] = self._serialize.query('fields', fields, 'str') + if as_of is not None: + query_parameters['asOf'] = self._serialize.query('as_of', as_of, 'iso-8601') + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + response = self._send(http_method='GET', + location_id='72c7ddf8-2cdc-4f60-90cd-ab71c14a399b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('WorkItem', response) + + def get_work_items(self, ids, project=None, fields=None, as_of=None, expand=None, error_policy=None): + """GetWorkItems. + Returns a list of work items (Maximum 200) + :param [int] ids: The comma-separated list of requested work item ids. (Maximum 200 ids allowed). + :param str project: Project ID or project name + :param [str] fields: Comma-separated list of requested fields + :param datetime as_of: AsOf UTC date time string + :param str expand: The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + :param str error_policy: The flag to control error policy in a bulk get work items request. Possible options are {Fail, Omit}. + :rtype: [WorkItem] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if ids is not None: + ids = ",".join(map(str, ids)) + query_parameters['ids'] = self._serialize.query('ids', ids, 'str') + if fields is not None: + fields = ",".join(fields) + query_parameters['fields'] = self._serialize.query('fields', fields, 'str') + if as_of is not None: + query_parameters['asOf'] = self._serialize.query('as_of', as_of, 'iso-8601') + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + if error_policy is not None: + query_parameters['errorPolicy'] = self._serialize.query('error_policy', error_policy, 'str') + response = self._send(http_method='GET', + location_id='72c7ddf8-2cdc-4f60-90cd-ab71c14a399b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[WorkItem]', self._unwrap_collection(response)) + + def update_work_item(self, document, id, project=None, validate_only=None, bypass_rules=None, suppress_notifications=None, expand=None): + """UpdateWorkItem. + Updates a single work item. + :param :class:`<[JsonPatchOperation]> ` document: The JSON Patch document representing the update + :param int id: The id of the work item to update + :param str project: Project ID or project name + :param bool validate_only: Indicate if you only want to validate the changes without saving the work item + :param bool bypass_rules: Do not enforce the work item type rules on this update + :param bool suppress_notifications: Do not fire any notifications for this change + :param str expand: The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if id is not None: + route_values['id'] = self._serialize.url('id', id, 'int') + query_parameters = {} + if validate_only is not None: + query_parameters['validateOnly'] = self._serialize.query('validate_only', validate_only, 'bool') + if bypass_rules is not None: + query_parameters['bypassRules'] = self._serialize.query('bypass_rules', bypass_rules, 'bool') + if suppress_notifications is not None: + query_parameters['suppressNotifications'] = self._serialize.query('suppress_notifications', suppress_notifications, 'bool') + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + content = self._serialize.body(document, '[JsonPatchOperation]') + response = self._send(http_method='PATCH', + location_id='72c7ddf8-2cdc-4f60-90cd-ab71c14a399b', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content, + media_type='application/json-patch+json') + return self._deserialize('WorkItem', response) + + def get_work_items_batch(self, work_item_get_request, project=None): + """GetWorkItemsBatch. + Gets work items for a list of work item ids (Maximum 200) + :param :class:` ` work_item_get_request: + :param str project: Project ID or project name + :rtype: [WorkItem] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(work_item_get_request, 'WorkItemBatchGetRequest') + response = self._send(http_method='POST', + location_id='908509b6-4248-4475-a1cd-829139ba419f', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[WorkItem]', self._unwrap_collection(response)) + + def get_work_item_type_categories(self, project): + """GetWorkItemTypeCategories. + Get all work item type categories. + :param str project: Project ID or project name + :rtype: [WorkItemTypeCategory] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='9b9f5734-36c8-415e-ba67-f83b45c31408', + version='5.1', + route_values=route_values) + return self._deserialize('[WorkItemTypeCategory]', self._unwrap_collection(response)) + + def get_work_item_type_category(self, project, category): + """GetWorkItemTypeCategory. + Get specific work item type category by name. + :param str project: Project ID or project name + :param str category: The category name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if category is not None: + route_values['category'] = self._serialize.url('category', category, 'str') + response = self._send(http_method='GET', + location_id='9b9f5734-36c8-415e-ba67-f83b45c31408', + version='5.1', + route_values=route_values) + return self._deserialize('WorkItemTypeCategory', response) + + def get_work_item_type(self, project, type): + """GetWorkItemType. + Returns a work item type definition. + :param str project: Project ID or project name + :param str type: Work item type name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if type is not None: + route_values['type'] = self._serialize.url('type', type, 'str') + response = self._send(http_method='GET', + location_id='7c8d7a76-4a09-43e8-b5df-bd792f4ac6aa', + version='5.1', + route_values=route_values) + return self._deserialize('WorkItemType', response) + + def get_work_item_types(self, project): + """GetWorkItemTypes. + Returns the list of work item types + :param str project: Project ID or project name + :rtype: [WorkItemType] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='7c8d7a76-4a09-43e8-b5df-bd792f4ac6aa', + version='5.1', + route_values=route_values) + return self._deserialize('[WorkItemType]', self._unwrap_collection(response)) + + def get_work_item_type_fields_with_references(self, project, type, expand=None): + """GetWorkItemTypeFieldsWithReferences. + Get a list of fields for a work item type with detailed references. + :param str project: Project ID or project name + :param str type: Work item type. + :param str expand: Expand level for the API response. Properties: to include allowedvalues, default value, isRequired etc. as a part of response; None: to skip these properties. + :rtype: [WorkItemTypeFieldWithReferences] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if type is not None: + route_values['type'] = self._serialize.url('type', type, 'str') + query_parameters = {} + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + response = self._send(http_method='GET', + location_id='bd293ce5-3d25-4192-8e67-e8092e879efb', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[WorkItemTypeFieldWithReferences]', self._unwrap_collection(response)) + + def get_work_item_type_field_with_references(self, project, type, field, expand=None): + """GetWorkItemTypeFieldWithReferences. + Get a field for a work item type with detailed references. + :param str project: Project ID or project name + :param str type: Work item type. + :param str field: + :param str expand: Expand level for the API response. Properties: to include allowedvalues, default value, isRequired etc. as a part of response; None: to skip these properties. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if type is not None: + route_values['type'] = self._serialize.url('type', type, 'str') + if field is not None: + route_values['field'] = self._serialize.url('field', field, 'str') + query_parameters = {} + if expand is not None: + query_parameters['$expand'] = self._serialize.query('expand', expand, 'str') + response = self._send(http_method='GET', + location_id='bd293ce5-3d25-4192-8e67-e8092e879efb', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('WorkItemTypeFieldWithReferences', response) + diff --git a/azure-devops/azure/devops/v5_1/__init__.py b/azure-devops/azure/devops/v5_1/__init__.py new file mode 100644 index 00000000..f885a96e --- /dev/null +++ b/azure-devops/azure/devops/v5_1/__init__.py @@ -0,0 +1,7 @@ +# -------------------------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------------------------- diff --git a/azure-devops/azure/devops/v5_1/accounts/__init__.py b/azure-devops/azure/devops/v5_1/accounts/__init__.py new file mode 100644 index 00000000..7b1322e4 --- /dev/null +++ b/azure-devops/azure/devops/v5_1/accounts/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# 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 .accounts_client import AccountsClient + +__all__ = [ + 'Account', + 'AccountCreateInfoInternal', + 'AccountPreferencesInternal', + 'AccountsClient' +] diff --git a/azure-devops/azure/devops/v5_1/accounts/accounts_client.py b/azure-devops/azure/devops/v5_1/accounts/accounts_client.py new file mode 100644 index 00000000..bf218aae --- /dev/null +++ b/azure-devops/azure/devops/v5_1/accounts/accounts_client.py @@ -0,0 +1,48 @@ +# -------------------------------------------------------------------------------------------- +# 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 AccountsClient(Client): + """Accounts + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(AccountsClient, 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 = '0d55247a-1c47-4462-9b1f-5e2125590ee6' + + def get_accounts(self, owner_id=None, member_id=None, properties=None): + """GetAccounts. + Get a list of accounts for a specific owner or a specific member. + :param str owner_id: ID for the owner of the accounts. + :param str member_id: ID for a member of the accounts. + :param str properties: + :rtype: [Account] + """ + query_parameters = {} + if owner_id is not None: + query_parameters['ownerId'] = self._serialize.query('owner_id', owner_id, 'str') + if member_id is not None: + query_parameters['memberId'] = self._serialize.query('member_id', member_id, 'str') + if properties is not None: + query_parameters['properties'] = self._serialize.query('properties', properties, 'str') + response = self._send(http_method='GET', + location_id='229a6a53-b428-4ffb-a835-e8f36b5b4b1e', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[Account]', self._unwrap_collection(response)) + diff --git a/azure-devops/azure/devops/v5_1/accounts/models.py b/azure-devops/azure/devops/v5_1/accounts/models.py new file mode 100644 index 00000000..07715637 --- /dev/null +++ b/azure-devops/azure/devops/v5_1/accounts/models.py @@ -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 Account(Model): + """ + :param account_id: Identifier for an Account + :type account_id: str + :param account_name: Name for an account + :type account_name: str + :param account_owner: Owner of account + :type account_owner: str + :param account_status: Current account status + :type account_status: object + :param account_type: Type of account: Personal, Organization + :type account_type: object + :param account_uri: Uri for an account + :type account_uri: str + :param created_by: Who created the account + :type created_by: str + :param created_date: Date account was created + :type created_date: datetime + :param has_moved: + :type has_moved: bool + :param last_updated_by: Identity of last person to update the account + :type last_updated_by: str + :param last_updated_date: Date account was last updated + :type last_updated_date: datetime + :param namespace_id: Namespace for an account + :type namespace_id: str + :param new_collection_id: + :type new_collection_id: str + :param organization_name: Organization that created the account + :type organization_name: str + :param properties: Extended properties + :type properties: :class:`object ` + :param status_reason: Reason for current status + :type status_reason: str + """ + + _attribute_map = { + 'account_id': {'key': 'accountId', 'type': 'str'}, + 'account_name': {'key': 'accountName', 'type': 'str'}, + 'account_owner': {'key': 'accountOwner', 'type': 'str'}, + 'account_status': {'key': 'accountStatus', 'type': 'object'}, + 'account_type': {'key': 'accountType', 'type': 'object'}, + 'account_uri': {'key': 'accountUri', 'type': 'str'}, + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_date': {'key': 'createdDate', 'type': 'iso-8601'}, + 'has_moved': {'key': 'hasMoved', 'type': 'bool'}, + 'last_updated_by': {'key': 'lastUpdatedBy', 'type': 'str'}, + 'last_updated_date': {'key': 'lastUpdatedDate', 'type': 'iso-8601'}, + 'namespace_id': {'key': 'namespaceId', 'type': 'str'}, + 'new_collection_id': {'key': 'newCollectionId', 'type': 'str'}, + 'organization_name': {'key': 'organizationName', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'status_reason': {'key': 'statusReason', 'type': 'str'} + } + + def __init__(self, account_id=None, account_name=None, account_owner=None, account_status=None, account_type=None, account_uri=None, created_by=None, created_date=None, has_moved=None, last_updated_by=None, last_updated_date=None, namespace_id=None, new_collection_id=None, organization_name=None, properties=None, status_reason=None): + super(Account, self).__init__() + self.account_id = account_id + self.account_name = account_name + self.account_owner = account_owner + self.account_status = account_status + self.account_type = account_type + self.account_uri = account_uri + self.created_by = created_by + self.created_date = created_date + self.has_moved = has_moved + self.last_updated_by = last_updated_by + self.last_updated_date = last_updated_date + self.namespace_id = namespace_id + self.new_collection_id = new_collection_id + self.organization_name = organization_name + self.properties = properties + self.status_reason = status_reason + + +class AccountCreateInfoInternal(Model): + """ + :param account_name: + :type account_name: str + :param creator: + :type creator: str + :param organization: + :type organization: str + :param preferences: + :type preferences: :class:`AccountPreferencesInternal ` + :param properties: + :type properties: :class:`object ` + :param service_definitions: + :type service_definitions: list of { key: str; value: str } + """ + + _attribute_map = { + 'account_name': {'key': 'accountName', 'type': 'str'}, + 'creator': {'key': 'creator', 'type': 'str'}, + 'organization': {'key': 'organization', 'type': 'str'}, + 'preferences': {'key': 'preferences', 'type': 'AccountPreferencesInternal'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'service_definitions': {'key': 'serviceDefinitions', 'type': '[{ key: str; value: str }]'} + } + + def __init__(self, account_name=None, creator=None, organization=None, preferences=None, properties=None, service_definitions=None): + super(AccountCreateInfoInternal, self).__init__() + self.account_name = account_name + self.creator = creator + self.organization = organization + self.preferences = preferences + self.properties = properties + self.service_definitions = service_definitions + + +class AccountPreferencesInternal(Model): + """ + :param culture: + :type culture: object + :param language: + :type language: object + :param time_zone: + :type time_zone: object + """ + + _attribute_map = { + 'culture': {'key': 'culture', 'type': 'object'}, + 'language': {'key': 'language', 'type': 'object'}, + 'time_zone': {'key': 'timeZone', 'type': 'object'} + } + + def __init__(self, culture=None, language=None, time_zone=None): + super(AccountPreferencesInternal, self).__init__() + self.culture = culture + self.language = language + self.time_zone = time_zone + + +__all__ = [ + 'Account', + 'AccountCreateInfoInternal', + 'AccountPreferencesInternal', +] diff --git a/azure-devops/azure/devops/v5_1/audit/__init__.py b/azure-devops/azure/devops/v5_1/audit/__init__.py new file mode 100644 index 00000000..6b8e2823 --- /dev/null +++ b/azure-devops/azure/devops/v5_1/audit/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# 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 .audit_client import AuditClient + +__all__ = [ + 'AuditLogEntry', + 'AuditLogQueryResult', + 'DecoratedAuditLogEntry', + 'AuditClient' +] diff --git a/azure-devops/azure/devops/v5_1/audit/audit_client.py b/azure-devops/azure/devops/v5_1/audit/audit_client.py new file mode 100644 index 00000000..0a726d7b --- /dev/null +++ b/azure-devops/azure/devops/v5_1/audit/audit_client.py @@ -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 AuditClient(Client): + """Audit + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(AuditClient, 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 = '94ff054d-5ee1-413d-9341-3f4a7827de2e' + + def query_log(self, start_time=None, end_time=None, batch_size=None, continuation_token=None, skip_aggregation=None): + """QueryLog. + [Preview API] Queries audit log entries + :param datetime start_time: Start time of download window. Optional + :param datetime end_time: End time of download window. Optional + :param int batch_size: Max number of results to return. Optional + :param str continuation_token: Token used for returning next set of results from previous query. Optional + :param bool skip_aggregation: Skips aggregating events and leaves them as individual entries instead. By default events are aggregated. Event types that are aggregated: AuditLog.AccessLog. + :rtype: :class:` ` + """ + query_parameters = {} + if start_time is not None: + query_parameters['startTime'] = self._serialize.query('start_time', start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query('end_time', end_time, 'iso-8601') + if batch_size is not None: + query_parameters['batchSize'] = self._serialize.query('batch_size', batch_size, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if skip_aggregation is not None: + query_parameters['skipAggregation'] = self._serialize.query('skip_aggregation', skip_aggregation, 'bool') + response = self._send(http_method='GET', + location_id='4e5fa14f-7097-4b73-9c85-00abc7353c61', + version='5.1-preview.1', + query_parameters=query_parameters) + return self._deserialize('AuditLogQueryResult', response) + + def download_log(self, format, start_time=None, end_time=None, **kwargs): + """DownloadLog. + [Preview API] Downloads audit log entries. + :param str format: File format for download. Can be "json" or "csv". + :param datetime start_time: Start time of download window. Optional + :param datetime end_time: End time of download window. Optional + :rtype: object + """ + query_parameters = {} + if format is not None: + query_parameters['format'] = self._serialize.query('format', format, 'str') + if start_time is not None: + query_parameters['startTime'] = self._serialize.query('start_time', start_time, 'iso-8601') + if end_time is not None: + query_parameters['endTime'] = self._serialize.query('end_time', end_time, 'iso-8601') + response = self._send(http_method='GET', + location_id='b7b98a76-04e8-4f4d-ac72-9d46492caaac', + version='5.1-preview.1', + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + diff --git a/azure-devops/azure/devops/v5_1/audit/models.py b/azure-devops/azure/devops/v5_1/audit/models.py new file mode 100644 index 00000000..ade0abcb --- /dev/null +++ b/azure-devops/azure/devops/v5_1/audit/models.py @@ -0,0 +1,195 @@ +# -------------------------------------------------------------------------------------------- +# 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 AuditLogEntry(Model): + """ + :param action_id: The action if for the event, i.e Git.CreateRepo, Project.RenameProject + :type action_id: str + :param activity_id: ActivityId + :type activity_id: str + :param actor_cUID: The Actor's CUID + :type actor_cUID: str + :param actor_user_id: The Actor's User Id + :type actor_user_id: str + :param authentication_mechanism: Type of authentication used by the author + :type authentication_mechanism: str + :param correlation_id: This allows us to group things together, like one user action that caused a cascade of event entries (project creation). + :type correlation_id: str + :param data: External data such as CUIDs, item names, etc. + :type data: dict + :param id: EventId, should be unique + :type id: str + :param ip_address: IP Address where the event was originated + :type ip_address: str + :param scope_id: The org, collection or project Id + :type scope_id: str + :param scope_type: The type of the scope, Enterprise, Organization or Project + :type scope_type: object + :param timestamp: The time when the event occurred in UTC + :type timestamp: datetime + :param user_agent: The user agent from the request + :type user_agent: str + """ + + _attribute_map = { + 'action_id': {'key': 'actionId', 'type': 'str'}, + 'activity_id': {'key': 'activityId', 'type': 'str'}, + 'actor_cUID': {'key': 'actorCUID', 'type': 'str'}, + 'actor_user_id': {'key': 'actorUserId', 'type': 'str'}, + 'authentication_mechanism': {'key': 'authenticationMechanism', 'type': 'str'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'data': {'key': 'data', 'type': '{object}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'scope_id': {'key': 'scopeId', 'type': 'str'}, + 'scope_type': {'key': 'scopeType', 'type': 'object'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'user_agent': {'key': 'userAgent', 'type': 'str'} + } + + def __init__(self, action_id=None, activity_id=None, actor_cUID=None, actor_user_id=None, authentication_mechanism=None, correlation_id=None, data=None, id=None, ip_address=None, scope_id=None, scope_type=None, timestamp=None, user_agent=None): + super(AuditLogEntry, self).__init__() + self.action_id = action_id + self.activity_id = activity_id + self.actor_cUID = actor_cUID + self.actor_user_id = actor_user_id + self.authentication_mechanism = authentication_mechanism + self.correlation_id = correlation_id + self.data = data + self.id = id + self.ip_address = ip_address + self.scope_id = scope_id + self.scope_type = scope_type + self.timestamp = timestamp + self.user_agent = user_agent + + +class AuditLogQueryResult(Model): + """ + The object returned when the audit log is queried. It contains the log and the information needed to query more audit entries. + + :param continuation_token: The continuation token to pass to get the next set of results + :type continuation_token: str + :param decorated_audit_log_entries: The list of audit log entries + :type decorated_audit_log_entries: list of :class:`DecoratedAuditLogEntry ` + :param has_more: True when there are more matching results to be fetched, false otherwise. + :type has_more: bool + """ + + _attribute_map = { + 'continuation_token': {'key': 'continuationToken', 'type': 'str'}, + 'decorated_audit_log_entries': {'key': 'decoratedAuditLogEntries', 'type': '[DecoratedAuditLogEntry]'}, + 'has_more': {'key': 'hasMore', 'type': 'bool'} + } + + def __init__(self, continuation_token=None, decorated_audit_log_entries=None, has_more=None): + super(AuditLogQueryResult, self).__init__() + self.continuation_token = continuation_token + self.decorated_audit_log_entries = decorated_audit_log_entries + self.has_more = has_more + + +class DecoratedAuditLogEntry(Model): + """ + :param action_id: The action if for the event, i.e Git.CreateRepo, Project.RenameProject + :type action_id: str + :param activity_id: ActivityId + :type activity_id: str + :param actor_cUID: The Actor's CUID + :type actor_cUID: str + :param actor_display_name: DisplayName of the user who initiated the action + :type actor_display_name: str + :param actor_image_url: URL of Actor's Profile image + :type actor_image_url: str + :param actor_user_id: The Actor's User Id + :type actor_user_id: str + :param area: Area of Azure DevOps the action occurred + :type area: str + :param authentication_mechanism: Type of authentication used by the actor + :type authentication_mechanism: str + :param category: Type of action executed + :type category: object + :param category_display_name: DisplayName of the category + :type category_display_name: str + :param correlation_id: This allows related audit entries to be grouped together. Generally this occurs when a single action causes a cascade of audit entries. For example, project creation. + :type correlation_id: str + :param data: External data such as CUIDs, item names, etc. + :type data: dict + :param details: Decorated details + :type details: str + :param id: EventId - Needs to be unique per service + :type id: str + :param ip_address: IP Address where the event was originated + :type ip_address: str + :param scope_display_name: DisplayName of the scope + :type scope_display_name: str + :param scope_id: The organization or project Id + :type scope_id: str + :param scope_type: The type of the scope, Organization or Project + :type scope_type: object + :param timestamp: The time when the event occurred in UTC + :type timestamp: datetime + :param user_agent: The user agent from the request + :type user_agent: str + """ + + _attribute_map = { + 'action_id': {'key': 'actionId', 'type': 'str'}, + 'activity_id': {'key': 'activityId', 'type': 'str'}, + 'actor_cUID': {'key': 'actorCUID', 'type': 'str'}, + 'actor_display_name': {'key': 'actorDisplayName', 'type': 'str'}, + 'actor_image_url': {'key': 'actorImageUrl', 'type': 'str'}, + 'actor_user_id': {'key': 'actorUserId', 'type': 'str'}, + 'area': {'key': 'area', 'type': 'str'}, + 'authentication_mechanism': {'key': 'authenticationMechanism', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'object'}, + 'category_display_name': {'key': 'categoryDisplayName', 'type': 'str'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'data': {'key': 'data', 'type': '{object}'}, + 'details': {'key': 'details', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'scope_display_name': {'key': 'scopeDisplayName', 'type': 'str'}, + 'scope_id': {'key': 'scopeId', 'type': 'str'}, + 'scope_type': {'key': 'scopeType', 'type': 'object'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'user_agent': {'key': 'userAgent', 'type': 'str'} + } + + def __init__(self, action_id=None, activity_id=None, actor_cUID=None, actor_display_name=None, actor_image_url=None, actor_user_id=None, area=None, authentication_mechanism=None, category=None, category_display_name=None, correlation_id=None, data=None, details=None, id=None, ip_address=None, scope_display_name=None, scope_id=None, scope_type=None, timestamp=None, user_agent=None): + super(DecoratedAuditLogEntry, self).__init__() + self.action_id = action_id + self.activity_id = activity_id + self.actor_cUID = actor_cUID + self.actor_display_name = actor_display_name + self.actor_image_url = actor_image_url + self.actor_user_id = actor_user_id + self.area = area + self.authentication_mechanism = authentication_mechanism + self.category = category + self.category_display_name = category_display_name + self.correlation_id = correlation_id + self.data = data + self.details = details + self.id = id + self.ip_address = ip_address + self.scope_display_name = scope_display_name + self.scope_id = scope_id + self.scope_type = scope_type + self.timestamp = timestamp + self.user_agent = user_agent + + +__all__ = [ + 'AuditLogEntry', + 'AuditLogQueryResult', + 'DecoratedAuditLogEntry', +] diff --git a/azure-devops/azure/devops/v5_1/build/__init__.py b/azure-devops/azure/devops/v5_1/build/__init__.py new file mode 100644 index 00000000..b9cb53c4 --- /dev/null +++ b/azure-devops/azure/devops/v5_1/build/__init__.py @@ -0,0 +1,90 @@ +# -------------------------------------------------------------------------------------------- +# 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 .build_client import BuildClient + +__all__ = [ + 'AgentPoolQueue', + 'AgentSpecification', + 'AggregatedResultsAnalysis', + 'AggregatedResultsByOutcome', + 'AggregatedResultsDifference', + 'AggregatedRunsByOutcome', + 'AggregatedRunsByState', + 'ArtifactResource', + 'AssociatedWorkItem', + 'Attachment', + 'AuthorizationHeader', + 'Build', + 'BuildArtifact', + 'BuildBadge', + 'BuildController', + 'BuildDefinition', + 'BuildDefinition3_2', + 'BuildDefinitionReference', + 'BuildDefinitionReference3_2', + 'BuildDefinitionRevision', + 'BuildDefinitionStep', + 'BuildDefinitionTemplate', + 'BuildDefinitionTemplate3_2', + 'BuildDefinitionVariable', + 'BuildLog', + 'BuildLogReference', + 'BuildMetric', + 'BuildOption', + 'BuildOptionDefinition', + 'BuildOptionDefinitionReference', + 'BuildOptionGroupDefinition', + 'BuildOptionInputDefinition', + 'BuildReportMetadata', + 'BuildRepository', + 'BuildRequestValidationResult', + 'BuildResourceUsage', + 'BuildSettings', + 'Change', + 'DataSourceBindingBase', + 'DefinitionReference', + 'DefinitionResourceReference', + 'Deployment', + 'Folder', + 'GraphSubjectBase', + 'IdentityRef', + 'Issue', + 'JsonPatchOperation', + 'ProcessParameters', + 'PullRequest', + 'ReferenceLinks', + 'ReleaseReference', + 'RepositoryWebhook', + 'ResourceRef', + 'RetentionPolicy', + 'SourceProviderAttributes', + 'SourceRepositories', + 'SourceRepository', + 'SourceRepositoryItem', + 'SupportedTrigger', + 'TaskAgentPoolReference', + 'TaskDefinitionReference', + 'TaskInputDefinitionBase', + 'TaskInputValidation', + 'TaskOrchestrationPlanReference', + 'TaskReference', + 'TaskSourceDefinitionBase', + 'TeamProjectReference', + 'TestResultsContext', + 'Timeline', + 'TimelineAttempt', + 'TimelineRecord', + 'TimelineReference', + 'VariableGroup', + 'VariableGroupReference', + 'WebApiConnectedServiceRef', + 'XamlBuildControllerReference', + 'BuildClient' +] diff --git a/azure-devops/azure/devops/v5_1/build/build_client.py b/azure-devops/azure/devops/v5_1/build/build_client.py new file mode 100644 index 00000000..84c85473 --- /dev/null +++ b/azure-devops/azure/devops/v5_1/build/build_client.py @@ -0,0 +1,1990 @@ +# -------------------------------------------------------------------------------------------- +# 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 BuildClient(Client): + """Build + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(BuildClient, 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 = '965220d5-5bb9-42cf-8d67-9b146df2a5a4' + + def create_artifact(self, artifact, project, build_id): + """CreateArtifact. + Associates an artifact with a build. + :param :class:` ` artifact: The artifact. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + content = self._serialize.body(artifact, 'BuildArtifact') + response = self._send(http_method='POST', + location_id='1db06c96-014e-44e1-ac91-90b2d4b3e984', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('BuildArtifact', response) + + def get_artifact(self, project, build_id, artifact_name): + """GetArtifact. + Gets a specific artifact for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str artifact_name: The name of the artifact. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if artifact_name is not None: + query_parameters['artifactName'] = self._serialize.query('artifact_name', artifact_name, 'str') + response = self._send(http_method='GET', + location_id='1db06c96-014e-44e1-ac91-90b2d4b3e984', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('BuildArtifact', response) + + def get_artifact_content_zip(self, project, build_id, artifact_name, **kwargs): + """GetArtifactContentZip. + Gets a specific artifact for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str artifact_name: The name of the artifact. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if artifact_name is not None: + query_parameters['artifactName'] = self._serialize.query('artifact_name', artifact_name, 'str') + response = self._send(http_method='GET', + location_id='1db06c96-014e-44e1-ac91-90b2d4b3e984', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_artifacts(self, project, build_id): + """GetArtifacts. + Gets all artifacts for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :rtype: [BuildArtifact] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + response = self._send(http_method='GET', + location_id='1db06c96-014e-44e1-ac91-90b2d4b3e984', + version='5.1', + route_values=route_values) + return self._deserialize('[BuildArtifact]', self._unwrap_collection(response)) + + def get_file(self, project, build_id, artifact_name, file_id, file_name, **kwargs): + """GetFile. + Gets a file from the build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str artifact_name: The name of the artifact. + :param str file_id: The primary key for the file. + :param str file_name: The name that the file will be set to. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if artifact_name is not None: + query_parameters['artifactName'] = self._serialize.query('artifact_name', artifact_name, 'str') + if file_id is not None: + query_parameters['fileId'] = self._serialize.query('file_id', file_id, 'str') + if file_name is not None: + query_parameters['fileName'] = self._serialize.query('file_name', file_name, 'str') + response = self._send(http_method='GET', + location_id='1db06c96-014e-44e1-ac91-90b2d4b3e984', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_attachments(self, project, build_id, type): + """GetAttachments. + [Preview API] Gets the list of attachments of a specific type that are associated with a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str type: The type of attachment. + :rtype: [Attachment] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if type is not None: + route_values['type'] = self._serialize.url('type', type, 'str') + response = self._send(http_method='GET', + location_id='f2192269-89fa-4f94-baf6-8fb128c55159', + version='5.1-preview.2', + route_values=route_values) + return self._deserialize('[Attachment]', self._unwrap_collection(response)) + + def get_attachment(self, project, build_id, timeline_id, record_id, type, name, **kwargs): + """GetAttachment. + [Preview API] Gets a specific attachment. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str timeline_id: The ID of the timeline. + :param str record_id: The ID of the timeline record. + :param str type: The type of the attachment. + :param str name: The name of the attachment. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if timeline_id is not None: + route_values['timelineId'] = self._serialize.url('timeline_id', timeline_id, 'str') + if record_id is not None: + route_values['recordId'] = self._serialize.url('record_id', record_id, 'str') + if type is not None: + route_values['type'] = self._serialize.url('type', type, 'str') + if name is not None: + route_values['name'] = self._serialize.url('name', name, 'str') + response = self._send(http_method='GET', + location_id='af5122d3-3438-485e-a25a-2dbbfde84ee6', + version='5.1-preview.2', + route_values=route_values, + accept_media_type='application/octet-stream') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def authorize_project_resources(self, resources, project): + """AuthorizeProjectResources. + [Preview API] + :param [DefinitionResourceReference] resources: + :param str project: Project ID or project name + :rtype: [DefinitionResourceReference] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(resources, '[DefinitionResourceReference]') + response = self._send(http_method='PATCH', + location_id='398c85bc-81aa-4822-947c-a194a05f0fef', + version='5.1-preview.1', + route_values=route_values, + content=content) + return self._deserialize('[DefinitionResourceReference]', self._unwrap_collection(response)) + + def get_project_resources(self, project, type=None, id=None): + """GetProjectResources. + [Preview API] + :param str project: Project ID or project name + :param str type: + :param str id: + :rtype: [DefinitionResourceReference] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if type is not None: + query_parameters['type'] = self._serialize.query('type', type, 'str') + if id is not None: + query_parameters['id'] = self._serialize.query('id', id, 'str') + response = self._send(http_method='GET', + location_id='398c85bc-81aa-4822-947c-a194a05f0fef', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[DefinitionResourceReference]', self._unwrap_collection(response)) + + def list_branches(self, project, provider_name, service_endpoint_id=None, repository=None, branch_name=None): + """ListBranches. + [Preview API] Gets a list of branches for the given source code repository. + :param str project: Project ID or project name + :param str provider_name: The name of the source provider. + :param str service_endpoint_id: If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + :param str repository: The vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. + :param str branch_name: If supplied, the name of the branch to check for specifically. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if provider_name is not None: + route_values['providerName'] = self._serialize.url('provider_name', provider_name, 'str') + query_parameters = {} + if service_endpoint_id is not None: + query_parameters['serviceEndpointId'] = self._serialize.query('service_endpoint_id', service_endpoint_id, 'str') + if repository is not None: + query_parameters['repository'] = self._serialize.query('repository', repository, 'str') + if branch_name is not None: + query_parameters['branchName'] = self._serialize.query('branch_name', branch_name, 'str') + response = self._send(http_method='GET', + location_id='e05d4403-9b81-4244-8763-20fde28d1976', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def get_build_badge(self, project, repo_type, repo_id=None, branch_name=None): + """GetBuildBadge. + [Preview API] Gets a badge that indicates the status of the most recent build for the specified branch. + :param str project: Project ID or project name + :param str repo_type: The repository type. + :param str repo_id: The repository ID. + :param str branch_name: The branch name. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repo_type is not None: + route_values['repoType'] = self._serialize.url('repo_type', repo_type, 'str') + query_parameters = {} + if repo_id is not None: + query_parameters['repoId'] = self._serialize.query('repo_id', repo_id, 'str') + if branch_name is not None: + query_parameters['branchName'] = self._serialize.query('branch_name', branch_name, 'str') + response = self._send(http_method='GET', + location_id='21b3b9ce-fad5-4567-9ad0-80679794e003', + version='5.1-preview.2', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('BuildBadge', response) + + def get_build_badge_data(self, project, repo_type, repo_id=None, branch_name=None): + """GetBuildBadgeData. + [Preview API] Gets a badge that indicates the status of the most recent build for the specified branch. + :param str project: Project ID or project name + :param str repo_type: The repository type. + :param str repo_id: The repository ID. + :param str branch_name: The branch name. + :rtype: str + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if repo_type is not None: + route_values['repoType'] = self._serialize.url('repo_type', repo_type, 'str') + query_parameters = {} + if repo_id is not None: + query_parameters['repoId'] = self._serialize.query('repo_id', repo_id, 'str') + if branch_name is not None: + query_parameters['branchName'] = self._serialize.query('branch_name', branch_name, 'str') + response = self._send(http_method='GET', + location_id='21b3b9ce-fad5-4567-9ad0-80679794e003', + version='5.1-preview.2', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('str', response) + + def delete_build(self, project, build_id): + """DeleteBuild. + Deletes a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + self._send(http_method='DELETE', + location_id='0cd358e1-9217-4d94-8269-1c1ee6f93dcf', + version='5.1', + route_values=route_values) + + def get_build(self, project, build_id, property_filters=None): + """GetBuild. + Gets a build + :param str project: Project ID or project name + :param int build_id: + :param str property_filters: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if property_filters is not None: + query_parameters['propertyFilters'] = self._serialize.query('property_filters', property_filters, 'str') + response = self._send(http_method='GET', + location_id='0cd358e1-9217-4d94-8269-1c1ee6f93dcf', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('Build', response) + + def get_builds(self, project, definitions=None, queues=None, build_number=None, min_time=None, max_time=None, requested_for=None, reason_filter=None, status_filter=None, result_filter=None, tag_filters=None, properties=None, top=None, continuation_token=None, max_builds_per_definition=None, deleted_filter=None, query_order=None, branch_name=None, build_ids=None, repository_id=None, repository_type=None): + """GetBuilds. + Gets a list of builds. + :param str project: Project ID or project name + :param [int] definitions: A comma-delimited list of definition IDs. If specified, filters to builds for these definitions. + :param [int] queues: A comma-delimited list of queue IDs. If specified, filters to builds that ran against these queues. + :param str build_number: If specified, filters to builds that match this build number. Append * to do a prefix search. + :param datetime min_time: If specified, filters to builds that finished/started/queued after this date based on the queryOrder specified. + :param datetime max_time: If specified, filters to builds that finished/started/queued before this date based on the queryOrder specified. + :param str requested_for: If specified, filters to builds requested for the specified user. + :param str reason_filter: If specified, filters to builds that match this reason. + :param str status_filter: If specified, filters to builds that match this status. + :param str result_filter: If specified, filters to builds that match this result. + :param [str] tag_filters: A comma-delimited list of tags. If specified, filters to builds that have the specified tags. + :param [str] properties: A comma-delimited list of properties to retrieve. + :param int top: The maximum number of builds to return. + :param str continuation_token: A continuation token, returned by a previous call to this method, that can be used to return the next set of builds. + :param int max_builds_per_definition: The maximum number of builds to return per definition. + :param str deleted_filter: Indicates whether to exclude, include, or only return deleted builds. + :param str query_order: The order in which builds should be returned. + :param str branch_name: If specified, filters to builds that built branches that built this branch. + :param [int] build_ids: A comma-delimited list that specifies the IDs of builds to retrieve. + :param str repository_id: If specified, filters to builds that built from this repository. + :param str repository_type: If specified, filters to builds that built from repositories of this type. + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if definitions is not None: + definitions = ",".join(map(str, definitions)) + query_parameters['definitions'] = self._serialize.query('definitions', definitions, 'str') + if queues is not None: + queues = ",".join(map(str, queues)) + query_parameters['queues'] = self._serialize.query('queues', queues, 'str') + if build_number is not None: + query_parameters['buildNumber'] = self._serialize.query('build_number', build_number, 'str') + if min_time is not None: + query_parameters['minTime'] = self._serialize.query('min_time', min_time, 'iso-8601') + if max_time is not None: + query_parameters['maxTime'] = self._serialize.query('max_time', max_time, 'iso-8601') + if requested_for is not None: + query_parameters['requestedFor'] = self._serialize.query('requested_for', requested_for, 'str') + if reason_filter is not None: + query_parameters['reasonFilter'] = self._serialize.query('reason_filter', reason_filter, 'str') + if status_filter is not None: + query_parameters['statusFilter'] = self._serialize.query('status_filter', status_filter, 'str') + if result_filter is not None: + query_parameters['resultFilter'] = self._serialize.query('result_filter', result_filter, 'str') + if tag_filters is not None: + tag_filters = ",".join(tag_filters) + query_parameters['tagFilters'] = self._serialize.query('tag_filters', tag_filters, 'str') + if properties is not None: + properties = ",".join(properties) + query_parameters['properties'] = self._serialize.query('properties', properties, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if max_builds_per_definition is not None: + query_parameters['maxBuildsPerDefinition'] = self._serialize.query('max_builds_per_definition', max_builds_per_definition, 'int') + if deleted_filter is not None: + query_parameters['deletedFilter'] = self._serialize.query('deleted_filter', deleted_filter, 'str') + if query_order is not None: + query_parameters['queryOrder'] = self._serialize.query('query_order', query_order, 'str') + if branch_name is not None: + query_parameters['branchName'] = self._serialize.query('branch_name', branch_name, 'str') + if build_ids is not None: + build_ids = ",".join(map(str, build_ids)) + query_parameters['buildIds'] = self._serialize.query('build_ids', build_ids, 'str') + if repository_id is not None: + query_parameters['repositoryId'] = self._serialize.query('repository_id', repository_id, 'str') + if repository_type is not None: + query_parameters['repositoryType'] = self._serialize.query('repository_type', repository_type, 'str') + response = self._send(http_method='GET', + location_id='0cd358e1-9217-4d94-8269-1c1ee6f93dcf', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[Build]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetBuildsResponseValue(response_value, continuation_token) + + class GetBuildsResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_builds method + + :param value: + :type value: :class:`<[Build]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def queue_build(self, build, project, ignore_warnings=None, check_in_ticket=None, source_build_id=None): + """QueueBuild. + Queues a build + :param :class:` ` build: + :param str project: Project ID or project name + :param bool ignore_warnings: + :param str check_in_ticket: + :param int source_build_id: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if ignore_warnings is not None: + query_parameters['ignoreWarnings'] = self._serialize.query('ignore_warnings', ignore_warnings, 'bool') + if check_in_ticket is not None: + query_parameters['checkInTicket'] = self._serialize.query('check_in_ticket', check_in_ticket, 'str') + if source_build_id is not None: + query_parameters['sourceBuildId'] = self._serialize.query('source_build_id', source_build_id, 'int') + content = self._serialize.body(build, 'Build') + response = self._send(http_method='POST', + location_id='0cd358e1-9217-4d94-8269-1c1ee6f93dcf', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('Build', response) + + def update_build(self, build, project, build_id, retry=None): + """UpdateBuild. + Updates a build. + :param :class:` ` build: The build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param bool retry: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if retry is not None: + query_parameters['retry'] = self._serialize.query('retry', retry, 'bool') + content = self._serialize.body(build, 'Build') + response = self._send(http_method='PATCH', + location_id='0cd358e1-9217-4d94-8269-1c1ee6f93dcf', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('Build', response) + + def update_builds(self, builds, project): + """UpdateBuilds. + Updates multiple builds. + :param [Build] builds: The builds to update. + :param str project: Project ID or project name + :rtype: [Build] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(builds, '[Build]') + response = self._send(http_method='PATCH', + location_id='0cd358e1-9217-4d94-8269-1c1ee6f93dcf', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[Build]', self._unwrap_collection(response)) + + def get_build_changes(self, project, build_id, continuation_token=None, top=None, include_source_change=None): + """GetBuildChanges. + Gets the changes associated with a build + :param str project: Project ID or project name + :param int build_id: + :param str continuation_token: + :param int top: The maximum number of changes to return + :param bool include_source_change: + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if include_source_change is not None: + query_parameters['includeSourceChange'] = self._serialize.query('include_source_change', include_source_change, 'bool') + response = self._send(http_method='GET', + location_id='54572c7b-bbd3-45d4-80dc-28be08941620', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[Change]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetBuildChangesResponseValue(response_value, continuation_token) + + class GetBuildChangesResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_build_changes method + + :param value: + :type value: :class:`<[Change]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def get_changes_between_builds(self, project, from_build_id=None, to_build_id=None, top=None): + """GetChangesBetweenBuilds. + [Preview API] Gets the changes made to the repository between two given builds. + :param str project: Project ID or project name + :param int from_build_id: The ID of the first build. + :param int to_build_id: The ID of the last build. + :param int top: The maximum number of changes to return. + :rtype: [Change] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if from_build_id is not None: + query_parameters['fromBuildId'] = self._serialize.query('from_build_id', from_build_id, 'int') + if to_build_id is not None: + query_parameters['toBuildId'] = self._serialize.query('to_build_id', to_build_id, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + response = self._send(http_method='GET', + location_id='f10f0ea5-18a1-43ec-a8fb-2042c7be9b43', + version='5.1-preview.2', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[Change]', self._unwrap_collection(response)) + + def get_build_controller(self, controller_id): + """GetBuildController. + Gets a controller + :param int controller_id: + :rtype: :class:` ` + """ + route_values = {} + if controller_id is not None: + route_values['controllerId'] = self._serialize.url('controller_id', controller_id, 'int') + response = self._send(http_method='GET', + location_id='fcac1932-2ee1-437f-9b6f-7f696be858f6', + version='5.1', + route_values=route_values) + return self._deserialize('BuildController', response) + + def get_build_controllers(self, name=None): + """GetBuildControllers. + Gets controller, optionally filtered by name + :param str name: + :rtype: [BuildController] + """ + query_parameters = {} + if name is not None: + query_parameters['name'] = self._serialize.query('name', name, 'str') + response = self._send(http_method='GET', + location_id='fcac1932-2ee1-437f-9b6f-7f696be858f6', + version='5.1', + query_parameters=query_parameters) + return self._deserialize('[BuildController]', self._unwrap_collection(response)) + + def create_definition(self, definition, project, definition_to_clone_id=None, definition_to_clone_revision=None): + """CreateDefinition. + Creates a new definition. + :param :class:` ` definition: The definition. + :param str project: Project ID or project name + :param int definition_to_clone_id: + :param int definition_to_clone_revision: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if definition_to_clone_id is not None: + query_parameters['definitionToCloneId'] = self._serialize.query('definition_to_clone_id', definition_to_clone_id, 'int') + if definition_to_clone_revision is not None: + query_parameters['definitionToCloneRevision'] = self._serialize.query('definition_to_clone_revision', definition_to_clone_revision, 'int') + content = self._serialize.body(definition, 'BuildDefinition') + response = self._send(http_method='POST', + location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('BuildDefinition', response) + + def delete_definition(self, project, definition_id): + """DeleteDefinition. + Deletes a definition and all associated builds. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + self._send(http_method='DELETE', + location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', + version='5.1', + route_values=route_values) + + def get_definition(self, project, definition_id, revision=None, min_metrics_time=None, property_filters=None, include_latest_builds=None): + """GetDefinition. + Gets a definition, optionally at a specific revision. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + :param int revision: The revision number to retrieve. If this is not specified, the latest version will be returned. + :param datetime min_metrics_time: If specified, indicates the date from which metrics should be included. + :param [str] property_filters: A comma-delimited list of properties to include in the results. + :param bool include_latest_builds: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + query_parameters = {} + if revision is not None: + query_parameters['revision'] = self._serialize.query('revision', revision, 'int') + if min_metrics_time is not None: + query_parameters['minMetricsTime'] = self._serialize.query('min_metrics_time', min_metrics_time, 'iso-8601') + if property_filters is not None: + property_filters = ",".join(property_filters) + query_parameters['propertyFilters'] = self._serialize.query('property_filters', property_filters, 'str') + if include_latest_builds is not None: + query_parameters['includeLatestBuilds'] = self._serialize.query('include_latest_builds', include_latest_builds, 'bool') + response = self._send(http_method='GET', + location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('BuildDefinition', response) + + def get_definitions(self, project, name=None, repository_id=None, repository_type=None, query_order=None, top=None, continuation_token=None, min_metrics_time=None, definition_ids=None, path=None, built_after=None, not_built_after=None, include_all_properties=None, include_latest_builds=None, task_id_filter=None, process_type=None, yaml_filename=None): + """GetDefinitions. + Gets a list of definitions. + :param str project: Project ID or project name + :param str name: If specified, filters to definitions whose names match this pattern. + :param str repository_id: A repository ID. If specified, filters to definitions that use this repository. + :param str repository_type: If specified, filters to definitions that have a repository of this type. + :param str query_order: Indicates the order in which definitions should be returned. + :param int top: The maximum number of definitions to return. + :param str continuation_token: A continuation token, returned by a previous call to this method, that can be used to return the next set of definitions. + :param datetime min_metrics_time: If specified, indicates the date from which metrics should be included. + :param [int] definition_ids: A comma-delimited list that specifies the IDs of definitions to retrieve. + :param str path: If specified, filters to definitions under this folder. + :param datetime built_after: If specified, filters to definitions that have builds after this date. + :param datetime not_built_after: If specified, filters to definitions that do not have builds after this date. + :param bool include_all_properties: Indicates whether the full definitions should be returned. By default, shallow representations of the definitions are returned. + :param bool include_latest_builds: Indicates whether to return the latest and latest completed builds for this definition. + :param str task_id_filter: If specified, filters to definitions that use the specified task. + :param int process_type: If specified, filters to definitions with the given process type. + :param str yaml_filename: If specified, filters to YAML definitions that match the given filename. + :rtype: :class:`` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if name is not None: + query_parameters['name'] = self._serialize.query('name', name, 'str') + if repository_id is not None: + query_parameters['repositoryId'] = self._serialize.query('repository_id', repository_id, 'str') + if repository_type is not None: + query_parameters['repositoryType'] = self._serialize.query('repository_type', repository_type, 'str') + if query_order is not None: + query_parameters['queryOrder'] = self._serialize.query('query_order', query_order, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + if min_metrics_time is not None: + query_parameters['minMetricsTime'] = self._serialize.query('min_metrics_time', min_metrics_time, 'iso-8601') + if definition_ids is not None: + definition_ids = ",".join(map(str, definition_ids)) + query_parameters['definitionIds'] = self._serialize.query('definition_ids', definition_ids, 'str') + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + if built_after is not None: + query_parameters['builtAfter'] = self._serialize.query('built_after', built_after, 'iso-8601') + if not_built_after is not None: + query_parameters['notBuiltAfter'] = self._serialize.query('not_built_after', not_built_after, 'iso-8601') + if include_all_properties is not None: + query_parameters['includeAllProperties'] = self._serialize.query('include_all_properties', include_all_properties, 'bool') + if include_latest_builds is not None: + query_parameters['includeLatestBuilds'] = self._serialize.query('include_latest_builds', include_latest_builds, 'bool') + if task_id_filter is not None: + query_parameters['taskIdFilter'] = self._serialize.query('task_id_filter', task_id_filter, 'str') + if process_type is not None: + query_parameters['processType'] = self._serialize.query('process_type', process_type, 'int') + if yaml_filename is not None: + query_parameters['yamlFilename'] = self._serialize.query('yaml_filename', yaml_filename, 'str') + response = self._send(http_method='GET', + location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + response_value = self._deserialize('[BuildDefinitionReference]', self._unwrap_collection(response)) + continuation_token = self._get_continuation_token(response) + return self.GetDefinitionsResponseValue(response_value, continuation_token) + + class GetDefinitionsResponseValue(object): + def __init__(self, value, continuation_token): + """ + Response for the get_definitions method + + :param value: + :type value: :class:`<[BuildDefinitionReference]> ` + :param continuation_token: The continuation token to be used to get the next page of results. + :type continuation_token: str + """ + self.value = value + self.continuation_token = continuation_token + + def restore_definition(self, project, definition_id, deleted): + """RestoreDefinition. + Restores a deleted definition + :param str project: Project ID or project name + :param int definition_id: The identifier of the definition to restore. + :param bool deleted: When false, restores a deleted definition. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + query_parameters = {} + if deleted is not None: + query_parameters['deleted'] = self._serialize.query('deleted', deleted, 'bool') + response = self._send(http_method='PATCH', + location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('BuildDefinition', response) + + def update_definition(self, definition, project, definition_id, secrets_source_definition_id=None, secrets_source_definition_revision=None): + """UpdateDefinition. + Updates an existing definition. + :param :class:` ` definition: The new version of the definition. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + :param int secrets_source_definition_id: + :param int secrets_source_definition_revision: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + query_parameters = {} + if secrets_source_definition_id is not None: + query_parameters['secretsSourceDefinitionId'] = self._serialize.query('secrets_source_definition_id', secrets_source_definition_id, 'int') + if secrets_source_definition_revision is not None: + query_parameters['secretsSourceDefinitionRevision'] = self._serialize.query('secrets_source_definition_revision', secrets_source_definition_revision, 'int') + content = self._serialize.body(definition, 'BuildDefinition') + response = self._send(http_method='PUT', + location_id='dbeaf647-6167-421a-bda9-c9327b25e2e6', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('BuildDefinition', response) + + def get_file_contents(self, project, provider_name, service_endpoint_id=None, repository=None, commit_or_branch=None, path=None, **kwargs): + """GetFileContents. + [Preview API] Gets the contents of a file in the given source code repository. + :param str project: Project ID or project name + :param str provider_name: The name of the source provider. + :param str service_endpoint_id: If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + :param str repository: If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. + :param str commit_or_branch: The identifier of the commit or branch from which a file's contents are retrieved. + :param str path: The path to the file to retrieve, relative to the root of the repository. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if provider_name is not None: + route_values['providerName'] = self._serialize.url('provider_name', provider_name, 'str') + query_parameters = {} + if service_endpoint_id is not None: + query_parameters['serviceEndpointId'] = self._serialize.query('service_endpoint_id', service_endpoint_id, 'str') + if repository is not None: + query_parameters['repository'] = self._serialize.query('repository', repository, 'str') + if commit_or_branch is not None: + query_parameters['commitOrBranch'] = self._serialize.query('commit_or_branch', commit_or_branch, 'str') + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + response = self._send(http_method='GET', + location_id='29d12225-b1d9-425f-b668-6c594a981313', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def create_folder(self, folder, project, path): + """CreateFolder. + [Preview API] Creates a new folder. + :param :class:` ` folder: The folder. + :param str project: Project ID or project name + :param str path: The full path of the folder. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + content = self._serialize.body(folder, 'Folder') + response = self._send(http_method='PUT', + location_id='a906531b-d2da-4f55-bda7-f3e676cc50d9', + version='5.1-preview.2', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('Folder', response) + + def delete_folder(self, project, path): + """DeleteFolder. + [Preview API] Deletes a definition folder. Definitions and their corresponding builds will also be deleted. + :param str project: Project ID or project name + :param str path: The full path to the folder. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + self._send(http_method='DELETE', + location_id='a906531b-d2da-4f55-bda7-f3e676cc50d9', + version='5.1-preview.2', + route_values=route_values, + query_parameters=query_parameters) + + def get_folders(self, project, path=None, query_order=None): + """GetFolders. + [Preview API] Gets a list of build definition folders. + :param str project: Project ID or project name + :param str path: The path to start with. + :param str query_order: The order in which folders should be returned. + :rtype: [Folder] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if path is not None: + route_values['path'] = self._serialize.url('path', path, 'str') + query_parameters = {} + if query_order is not None: + query_parameters['queryOrder'] = self._serialize.query('query_order', query_order, 'str') + response = self._send(http_method='GET', + location_id='a906531b-d2da-4f55-bda7-f3e676cc50d9', + version='5.1-preview.2', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[Folder]', self._unwrap_collection(response)) + + def update_folder(self, folder, project, path): + """UpdateFolder. + [Preview API] Updates an existing folder at given existing path + :param :class:` ` folder: The new version of the folder. + :param str project: Project ID or project name + :param str path: The full path to the folder. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + content = self._serialize.body(folder, 'Folder') + response = self._send(http_method='POST', + location_id='a906531b-d2da-4f55-bda7-f3e676cc50d9', + version='5.1-preview.2', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('Folder', response) + + def get_latest_build(self, project, definition, branch_name=None): + """GetLatestBuild. + [Preview API] Gets the latest build for a definition, optionally scoped to a specific branch. + :param str project: Project ID or project name + :param str definition: definition name with optional leading folder path, or the definition id + :param str branch_name: optional parameter that indicates the specific branch to use + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition is not None: + route_values['definition'] = self._serialize.url('definition', definition, 'str') + query_parameters = {} + if branch_name is not None: + query_parameters['branchName'] = self._serialize.query('branch_name', branch_name, 'str') + response = self._send(http_method='GET', + location_id='54481611-01f4-47f3-998f-160da0f0c229', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('Build', response) + + def get_build_log(self, project, build_id, log_id, start_line=None, end_line=None, **kwargs): + """GetBuildLog. + Gets an individual log file for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param int log_id: The ID of the log file. + :param long start_line: The start line. + :param long end_line: The end line. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if log_id is not None: + route_values['logId'] = self._serialize.url('log_id', log_id, 'int') + query_parameters = {} + if start_line is not None: + query_parameters['startLine'] = self._serialize.query('start_line', start_line, 'long') + if end_line is not None: + query_parameters['endLine'] = self._serialize.query('end_line', end_line, 'long') + response = self._send(http_method='GET', + location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='text/plain') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_build_log_lines(self, project, build_id, log_id, start_line=None, end_line=None): + """GetBuildLogLines. + Gets an individual log file for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param int log_id: The ID of the log file. + :param long start_line: The start line. + :param long end_line: The end line. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if log_id is not None: + route_values['logId'] = self._serialize.url('log_id', log_id, 'int') + query_parameters = {} + if start_line is not None: + query_parameters['startLine'] = self._serialize.query('start_line', start_line, 'long') + if end_line is not None: + query_parameters['endLine'] = self._serialize.query('end_line', end_line, 'long') + response = self._send(http_method='GET', + location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def get_build_logs(self, project, build_id): + """GetBuildLogs. + Gets the logs for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :rtype: [BuildLog] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + response = self._send(http_method='GET', + location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', + version='5.1', + route_values=route_values) + return self._deserialize('[BuildLog]', self._unwrap_collection(response)) + + def get_build_logs_zip(self, project, build_id, **kwargs): + """GetBuildLogsZip. + Gets the logs for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + response = self._send(http_method='GET', + location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', + version='5.1', + route_values=route_values, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_build_log_zip(self, project, build_id, log_id, start_line=None, end_line=None, **kwargs): + """GetBuildLogZip. + Gets an individual log file for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param int log_id: The ID of the log file. + :param long start_line: The start line. + :param long end_line: The end line. + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if log_id is not None: + route_values['logId'] = self._serialize.url('log_id', log_id, 'int') + query_parameters = {} + if start_line is not None: + query_parameters['startLine'] = self._serialize.query('start_line', start_line, 'long') + if end_line is not None: + query_parameters['endLine'] = self._serialize.query('end_line', end_line, 'long') + response = self._send(http_method='GET', + location_id='35a80daf-7f30-45fc-86e8-6b813d9c90df', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='application/zip') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def get_project_metrics(self, project, metric_aggregation_type=None, min_metrics_time=None): + """GetProjectMetrics. + [Preview API] Gets build metrics for a project. + :param str project: Project ID or project name + :param str metric_aggregation_type: The aggregation type to use (hourly, daily). + :param datetime min_metrics_time: The date from which to calculate metrics. + :rtype: [BuildMetric] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if metric_aggregation_type is not None: + route_values['metricAggregationType'] = self._serialize.url('metric_aggregation_type', metric_aggregation_type, 'str') + query_parameters = {} + if min_metrics_time is not None: + query_parameters['minMetricsTime'] = self._serialize.query('min_metrics_time', min_metrics_time, 'iso-8601') + response = self._send(http_method='GET', + location_id='7433fae7-a6bc-41dc-a6e2-eef9005ce41a', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[BuildMetric]', self._unwrap_collection(response)) + + def get_definition_metrics(self, project, definition_id, min_metrics_time=None): + """GetDefinitionMetrics. + [Preview API] Gets build metrics for a definition. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + :param datetime min_metrics_time: The date from which to calculate metrics. + :rtype: [BuildMetric] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + query_parameters = {} + if min_metrics_time is not None: + query_parameters['minMetricsTime'] = self._serialize.query('min_metrics_time', min_metrics_time, 'iso-8601') + response = self._send(http_method='GET', + location_id='d973b939-0ce0-4fec-91d8-da3940fa1827', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[BuildMetric]', self._unwrap_collection(response)) + + def get_build_option_definitions(self, project=None): + """GetBuildOptionDefinitions. + Gets all build definition options supported by the system. + :param str project: Project ID or project name + :rtype: [BuildOptionDefinition] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='591cb5a4-2d46-4f3a-a697-5cd42b6bd332', + version='5.1', + route_values=route_values) + return self._deserialize('[BuildOptionDefinition]', self._unwrap_collection(response)) + + def get_path_contents(self, project, provider_name, service_endpoint_id=None, repository=None, commit_or_branch=None, path=None): + """GetPathContents. + [Preview API] Gets the contents of a directory in the given source code repository. + :param str project: Project ID or project name + :param str provider_name: The name of the source provider. + :param str service_endpoint_id: If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + :param str repository: If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. + :param str commit_or_branch: The identifier of the commit or branch from which a file's contents are retrieved. + :param str path: The path contents to list, relative to the root of the repository. + :rtype: [SourceRepositoryItem] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if provider_name is not None: + route_values['providerName'] = self._serialize.url('provider_name', provider_name, 'str') + query_parameters = {} + if service_endpoint_id is not None: + query_parameters['serviceEndpointId'] = self._serialize.query('service_endpoint_id', service_endpoint_id, 'str') + if repository is not None: + query_parameters['repository'] = self._serialize.query('repository', repository, 'str') + if commit_or_branch is not None: + query_parameters['commitOrBranch'] = self._serialize.query('commit_or_branch', commit_or_branch, 'str') + if path is not None: + query_parameters['path'] = self._serialize.query('path', path, 'str') + response = self._send(http_method='GET', + location_id='7944d6fb-df01-4709-920a-7a189aa34037', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[SourceRepositoryItem]', self._unwrap_collection(response)) + + def get_build_properties(self, project, build_id, filter=None): + """GetBuildProperties. + [Preview API] Gets properties for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param [str] filter: A comma-delimited list of properties. If specified, filters to these specific properties. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if filter is not None: + filter = ",".join(filter) + query_parameters['filter'] = self._serialize.query('filter', filter, 'str') + response = self._send(http_method='GET', + location_id='0a6312e9-0627-49b7-8083-7d74a64849c9', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('object', response) + + def update_build_properties(self, document, project, build_id): + """UpdateBuildProperties. + [Preview API] Updates properties for a build. + :param :class:`<[JsonPatchOperation]> ` document: A json-patch document describing the properties to update. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + content = self._serialize.body(document, '[JsonPatchOperation]') + response = self._send(http_method='PATCH', + location_id='0a6312e9-0627-49b7-8083-7d74a64849c9', + version='5.1-preview.1', + route_values=route_values, + content=content, + media_type='application/json-patch+json') + return self._deserialize('object', response) + + def get_definition_properties(self, project, definition_id, filter=None): + """GetDefinitionProperties. + [Preview API] Gets properties for a definition. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + :param [str] filter: A comma-delimited list of properties. If specified, filters to these specific properties. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + query_parameters = {} + if filter is not None: + filter = ",".join(filter) + query_parameters['filter'] = self._serialize.query('filter', filter, 'str') + response = self._send(http_method='GET', + location_id='d9826ad7-2a68-46a9-a6e9-677698777895', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('object', response) + + def update_definition_properties(self, document, project, definition_id): + """UpdateDefinitionProperties. + [Preview API] Updates properties for a definition. + :param :class:`<[JsonPatchOperation]> ` document: A json-patch document describing the properties to update. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + content = self._serialize.body(document, '[JsonPatchOperation]') + response = self._send(http_method='PATCH', + location_id='d9826ad7-2a68-46a9-a6e9-677698777895', + version='5.1-preview.1', + route_values=route_values, + content=content, + media_type='application/json-patch+json') + return self._deserialize('object', response) + + def get_pull_request(self, project, provider_name, pull_request_id, repository_id=None, service_endpoint_id=None): + """GetPullRequest. + [Preview API] Gets a pull request object from source provider. + :param str project: Project ID or project name + :param str provider_name: The name of the source provider. + :param str pull_request_id: Vendor-specific id of the pull request. + :param str repository_id: Vendor-specific identifier or the name of the repository that contains the pull request. + :param str service_endpoint_id: If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if provider_name is not None: + route_values['providerName'] = self._serialize.url('provider_name', provider_name, 'str') + if pull_request_id is not None: + route_values['pullRequestId'] = self._serialize.url('pull_request_id', pull_request_id, 'str') + query_parameters = {} + if repository_id is not None: + query_parameters['repositoryId'] = self._serialize.query('repository_id', repository_id, 'str') + if service_endpoint_id is not None: + query_parameters['serviceEndpointId'] = self._serialize.query('service_endpoint_id', service_endpoint_id, 'str') + response = self._send(http_method='GET', + location_id='d8763ec7-9ff0-4fb4-b2b2-9d757906ff14', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('PullRequest', response) + + def get_build_report(self, project, build_id, type=None): + """GetBuildReport. + [Preview API] Gets a build report. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str type: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if type is not None: + query_parameters['type'] = self._serialize.query('type', type, 'str') + response = self._send(http_method='GET', + location_id='45bcaa88-67e1-4042-a035-56d3b4a7d44c', + version='5.1-preview.2', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('BuildReportMetadata', response) + + def get_build_report_html_content(self, project, build_id, type=None, **kwargs): + """GetBuildReportHtmlContent. + [Preview API] Gets a build report. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str type: + :rtype: object + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if type is not None: + query_parameters['type'] = self._serialize.query('type', type, 'str') + response = self._send(http_method='GET', + location_id='45bcaa88-67e1-4042-a035-56d3b4a7d44c', + version='5.1-preview.2', + route_values=route_values, + query_parameters=query_parameters, + accept_media_type='text/html') + if "callback" in kwargs: + callback = kwargs["callback"] + else: + callback = None + return self._client.stream_download(response, callback=callback) + + def list_repositories(self, project, provider_name, service_endpoint_id=None, repository=None, result_set=None, page_results=None, continuation_token=None): + """ListRepositories. + [Preview API] Gets a list of source code repositories. + :param str project: Project ID or project name + :param str provider_name: The name of the source provider. + :param str service_endpoint_id: If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + :param str repository: If specified, the vendor-specific identifier or the name of a single repository to get. + :param str result_set: 'top' for the repositories most relevant for the endpoint. If not set, all repositories are returned. Ignored if 'repository' is set. + :param bool page_results: If set to true, this will limit the set of results and will return a continuation token to continue the query. + :param str continuation_token: When paging results, this is a continuation token, returned by a previous call to this method, that can be used to return the next set of repositories. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if provider_name is not None: + route_values['providerName'] = self._serialize.url('provider_name', provider_name, 'str') + query_parameters = {} + if service_endpoint_id is not None: + query_parameters['serviceEndpointId'] = self._serialize.query('service_endpoint_id', service_endpoint_id, 'str') + if repository is not None: + query_parameters['repository'] = self._serialize.query('repository', repository, 'str') + if result_set is not None: + query_parameters['resultSet'] = self._serialize.query('result_set', result_set, 'str') + if page_results is not None: + query_parameters['pageResults'] = self._serialize.query('page_results', page_results, 'bool') + if continuation_token is not None: + query_parameters['continuationToken'] = self._serialize.query('continuation_token', continuation_token, 'str') + response = self._send(http_method='GET', + location_id='d44d1680-f978-4834-9b93-8c6e132329c9', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('SourceRepositories', response) + + def authorize_definition_resources(self, resources, project, definition_id): + """AuthorizeDefinitionResources. + [Preview API] + :param [DefinitionResourceReference] resources: + :param str project: Project ID or project name + :param int definition_id: + :rtype: [DefinitionResourceReference] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + content = self._serialize.body(resources, '[DefinitionResourceReference]') + response = self._send(http_method='PATCH', + location_id='ea623316-1967-45eb-89ab-e9e6110cf2d6', + version='5.1-preview.1', + route_values=route_values, + content=content) + return self._deserialize('[DefinitionResourceReference]', self._unwrap_collection(response)) + + def get_definition_resources(self, project, definition_id): + """GetDefinitionResources. + [Preview API] + :param str project: Project ID or project name + :param int definition_id: + :rtype: [DefinitionResourceReference] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + response = self._send(http_method='GET', + location_id='ea623316-1967-45eb-89ab-e9e6110cf2d6', + version='5.1-preview.1', + route_values=route_values) + return self._deserialize('[DefinitionResourceReference]', self._unwrap_collection(response)) + + def get_resource_usage(self): + """GetResourceUsage. + [Preview API] Gets information about build resources in the system. + :rtype: :class:` ` + """ + response = self._send(http_method='GET', + location_id='3813d06c-9e36-4ea1-aac3-61a485d60e3d', + version='5.1-preview.2') + return self._deserialize('BuildResourceUsage', response) + + def get_definition_revisions(self, project, definition_id): + """GetDefinitionRevisions. + Gets all revisions of a definition. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + :rtype: [BuildDefinitionRevision] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + response = self._send(http_method='GET', + location_id='7c116775-52e5-453e-8c5d-914d9762d8c4', + version='5.1', + route_values=route_values) + return self._deserialize('[BuildDefinitionRevision]', self._unwrap_collection(response)) + + def get_build_settings(self, project=None): + """GetBuildSettings. + Gets the build settings. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d', + version='5.1', + route_values=route_values) + return self._deserialize('BuildSettings', response) + + def update_build_settings(self, settings, project=None): + """UpdateBuildSettings. + Updates the build settings. + :param :class:` ` settings: The new settings. + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(settings, 'BuildSettings') + response = self._send(http_method='PATCH', + location_id='aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('BuildSettings', response) + + def list_source_providers(self, project): + """ListSourceProviders. + [Preview API] Get a list of source providers and their capabilities. + :param str project: Project ID or project name + :rtype: [SourceProviderAttributes] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='3ce81729-954f-423d-a581-9fea01d25186', + version='5.1-preview.1', + route_values=route_values) + return self._deserialize('[SourceProviderAttributes]', self._unwrap_collection(response)) + + def get_status_badge(self, project, definition, branch_name=None, stage_name=None, job_name=None, configuration=None, label=None): + """GetStatusBadge. + [Preview API]

Gets the build status for a definition, optionally scoped to a specific branch, stage, job, and configuration.

If there are more than one, then it is required to pass in a stageName value when specifying a jobName, and the same rule then applies for both if passing a configuration parameter.

+ :param str project: Project ID or project name + :param str definition: Either the definition name with optional leading folder path, or the definition id. + :param str branch_name: Only consider the most recent build for this branch. + :param str stage_name: Use this stage within the pipeline to render the status. + :param str job_name: Use this job within a stage of the pipeline to render the status. + :param str configuration: Use this job configuration to render the status + :param str label: Replaces the default text on the left side of the badge. + :rtype: str + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition is not None: + route_values['definition'] = self._serialize.url('definition', definition, 'str') + query_parameters = {} + if branch_name is not None: + query_parameters['branchName'] = self._serialize.query('branch_name', branch_name, 'str') + if stage_name is not None: + query_parameters['stageName'] = self._serialize.query('stage_name', stage_name, 'str') + if job_name is not None: + query_parameters['jobName'] = self._serialize.query('job_name', job_name, 'str') + if configuration is not None: + query_parameters['configuration'] = self._serialize.query('configuration', configuration, 'str') + if label is not None: + query_parameters['label'] = self._serialize.query('label', label, 'str') + response = self._send(http_method='GET', + location_id='07acfdce-4757-4439-b422-ddd13a2fcc10', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('str', response) + + def add_build_tag(self, project, build_id, tag): + """AddBuildTag. + Adds a tag to a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str tag: The tag to add. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if tag is not None: + route_values['tag'] = self._serialize.url('tag', tag, 'str') + response = self._send(http_method='PUT', + location_id='6e6114b2-8161-44c8-8f6c-c5505782427f', + version='5.1', + route_values=route_values) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def add_build_tags(self, tags, project, build_id): + """AddBuildTags. + Adds tags to a build. + :param [str] tags: The tags to add. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + content = self._serialize.body(tags, '[str]') + response = self._send(http_method='POST', + location_id='6e6114b2-8161-44c8-8f6c-c5505782427f', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def delete_build_tag(self, project, build_id, tag): + """DeleteBuildTag. + Removes a tag from a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param str tag: The tag to remove. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if tag is not None: + route_values['tag'] = self._serialize.url('tag', tag, 'str') + response = self._send(http_method='DELETE', + location_id='6e6114b2-8161-44c8-8f6c-c5505782427f', + version='5.1', + route_values=route_values) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def get_build_tags(self, project, build_id): + """GetBuildTags. + Gets the tags for a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + response = self._send(http_method='GET', + location_id='6e6114b2-8161-44c8-8f6c-c5505782427f', + version='5.1', + route_values=route_values) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def get_tags(self, project): + """GetTags. + Gets a list of all build and definition tags in the project. + :param str project: Project ID or project name + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='d84ac5c6-edc7-43d5-adc9-1b34be5dea09', + version='5.1', + route_values=route_values) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def add_definition_tag(self, project, definition_id, tag): + """AddDefinitionTag. + [Preview API] Adds a tag to a definition + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + :param str tag: The tag to add. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + if tag is not None: + route_values['tag'] = self._serialize.url('tag', tag, 'str') + response = self._send(http_method='PUT', + location_id='cb894432-134a-4d31-a839-83beceaace4b', + version='5.1-preview.2', + route_values=route_values) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def add_definition_tags(self, tags, project, definition_id): + """AddDefinitionTags. + [Preview API] Adds multiple tags to a definition. + :param [str] tags: The tags to add. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + content = self._serialize.body(tags, '[str]') + response = self._send(http_method='POST', + location_id='cb894432-134a-4d31-a839-83beceaace4b', + version='5.1-preview.2', + route_values=route_values, + content=content) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def delete_definition_tag(self, project, definition_id, tag): + """DeleteDefinitionTag. + [Preview API] Removes a tag from a definition. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + :param str tag: The tag to remove. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + if tag is not None: + route_values['tag'] = self._serialize.url('tag', tag, 'str') + response = self._send(http_method='DELETE', + location_id='cb894432-134a-4d31-a839-83beceaace4b', + version='5.1-preview.2', + route_values=route_values) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def get_definition_tags(self, project, definition_id, revision=None): + """GetDefinitionTags. + [Preview API] Gets the tags for a definition. + :param str project: Project ID or project name + :param int definition_id: The ID of the definition. + :param int revision: The definition revision number. If not specified, uses the latest revision of the definition. + :rtype: [str] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if definition_id is not None: + route_values['definitionId'] = self._serialize.url('definition_id', definition_id, 'int') + query_parameters = {} + if revision is not None: + query_parameters['revision'] = self._serialize.query('revision', revision, 'int') + response = self._send(http_method='GET', + location_id='cb894432-134a-4d31-a839-83beceaace4b', + version='5.1-preview.2', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[str]', self._unwrap_collection(response)) + + def delete_template(self, project, template_id): + """DeleteTemplate. + Deletes a build definition template. + :param str project: Project ID or project name + :param str template_id: The ID of the template. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if template_id is not None: + route_values['templateId'] = self._serialize.url('template_id', template_id, 'str') + self._send(http_method='DELETE', + location_id='e884571e-7f92-4d6a-9274-3f5649900835', + version='5.1', + route_values=route_values) + + def get_template(self, project, template_id): + """GetTemplate. + Gets a specific build definition template. + :param str project: Project ID or project name + :param str template_id: The ID of the requested template. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if template_id is not None: + route_values['templateId'] = self._serialize.url('template_id', template_id, 'str') + response = self._send(http_method='GET', + location_id='e884571e-7f92-4d6a-9274-3f5649900835', + version='5.1', + route_values=route_values) + return self._deserialize('BuildDefinitionTemplate', response) + + def get_templates(self, project): + """GetTemplates. + Gets all definition templates. + :param str project: Project ID or project name + :rtype: [BuildDefinitionTemplate] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + response = self._send(http_method='GET', + location_id='e884571e-7f92-4d6a-9274-3f5649900835', + version='5.1', + route_values=route_values) + return self._deserialize('[BuildDefinitionTemplate]', self._unwrap_collection(response)) + + def save_template(self, template, project, template_id): + """SaveTemplate. + Updates an existing build definition template. + :param :class:` ` template: The new version of the template. + :param str project: Project ID or project name + :param str template_id: The ID of the template. + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if template_id is not None: + route_values['templateId'] = self._serialize.url('template_id', template_id, 'str') + content = self._serialize.body(template, 'BuildDefinitionTemplate') + response = self._send(http_method='PUT', + location_id='e884571e-7f92-4d6a-9274-3f5649900835', + version='5.1', + route_values=route_values, + content=content) + return self._deserialize('BuildDefinitionTemplate', response) + + def get_build_timeline(self, project, build_id, timeline_id=None, change_id=None, plan_id=None): + """GetBuildTimeline. + Gets details for a build + :param str project: Project ID or project name + :param int build_id: + :param str timeline_id: + :param int change_id: + :param str plan_id: + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + if timeline_id is not None: + route_values['timelineId'] = self._serialize.url('timeline_id', timeline_id, 'str') + query_parameters = {} + if change_id is not None: + query_parameters['changeId'] = self._serialize.query('change_id', change_id, 'int') + if plan_id is not None: + query_parameters['planId'] = self._serialize.query('plan_id', plan_id, 'str') + response = self._send(http_method='GET', + location_id='8baac422-4c6e-4de5-8532-db96d92acffa', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('Timeline', response) + + def restore_webhooks(self, trigger_types, project, provider_name, service_endpoint_id=None, repository=None): + """RestoreWebhooks. + [Preview API] Recreates the webhooks for the specified triggers in the given source code repository. + :param [DefinitionTriggerType] trigger_types: The types of triggers to restore webhooks for. + :param str project: Project ID or project name + :param str provider_name: The name of the source provider. + :param str service_endpoint_id: If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + :param str repository: If specified, the vendor-specific identifier or the name of the repository to get webhooks. Can only be omitted for providers that do not support multiple repositories. + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if provider_name is not None: + route_values['providerName'] = self._serialize.url('provider_name', provider_name, 'str') + query_parameters = {} + if service_endpoint_id is not None: + query_parameters['serviceEndpointId'] = self._serialize.query('service_endpoint_id', service_endpoint_id, 'str') + if repository is not None: + query_parameters['repository'] = self._serialize.query('repository', repository, 'str') + content = self._serialize.body(trigger_types, '[DefinitionTriggerType]') + self._send(http_method='POST', + location_id='793bceb8-9736-4030-bd2f-fb3ce6d6b478', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + + def list_webhooks(self, project, provider_name, service_endpoint_id=None, repository=None): + """ListWebhooks. + [Preview API] Gets a list of webhooks installed in the given source code repository. + :param str project: Project ID or project name + :param str provider_name: The name of the source provider. + :param str service_endpoint_id: If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + :param str repository: If specified, the vendor-specific identifier or the name of the repository to get webhooks. Can only be omitted for providers that do not support multiple repositories. + :rtype: [RepositoryWebhook] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if provider_name is not None: + route_values['providerName'] = self._serialize.url('provider_name', provider_name, 'str') + query_parameters = {} + if service_endpoint_id is not None: + query_parameters['serviceEndpointId'] = self._serialize.query('service_endpoint_id', service_endpoint_id, 'str') + if repository is not None: + query_parameters['repository'] = self._serialize.query('repository', repository, 'str') + response = self._send(http_method='GET', + location_id='8f20ff82-9498-4812-9f6e-9c01bdc50e99', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[RepositoryWebhook]', self._unwrap_collection(response)) + + def get_build_work_items_refs(self, project, build_id, top=None): + """GetBuildWorkItemsRefs. + Gets the work items associated with a build. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param int top: The maximum number of work items to return. + :rtype: [ResourceRef] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + response = self._send(http_method='GET', + location_id='5a21f5d2-5642-47e4-a0bd-1356e6731bee', + version='5.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[ResourceRef]', self._unwrap_collection(response)) + + def get_build_work_items_refs_from_commits(self, commit_ids, project, build_id, top=None): + """GetBuildWorkItemsRefsFromCommits. + Gets the work items associated with a build, filtered to specific commits. + :param [str] commit_ids: A comma-delimited list of commit IDs. + :param str project: Project ID or project name + :param int build_id: The ID of the build. + :param int top: The maximum number of work items to return, or the number of commits to consider if no commit IDs are specified. + :rtype: [ResourceRef] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + if build_id is not None: + route_values['buildId'] = self._serialize.url('build_id', build_id, 'int') + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + content = self._serialize.body(commit_ids, '[str]') + response = self._send(http_method='POST', + location_id='5a21f5d2-5642-47e4-a0bd-1356e6731bee', + version='5.1', + route_values=route_values, + query_parameters=query_parameters, + content=content) + return self._deserialize('[ResourceRef]', self._unwrap_collection(response)) + + def get_work_items_between_builds(self, project, from_build_id, to_build_id, top=None): + """GetWorkItemsBetweenBuilds. + [Preview API] Gets all the work items between two builds. + :param str project: Project ID or project name + :param int from_build_id: The ID of the first build. + :param int to_build_id: The ID of the last build. + :param int top: The maximum number of work items to return. + :rtype: [ResourceRef] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if from_build_id is not None: + query_parameters['fromBuildId'] = self._serialize.query('from_build_id', from_build_id, 'int') + if to_build_id is not None: + query_parameters['toBuildId'] = self._serialize.query('to_build_id', to_build_id, 'int') + if top is not None: + query_parameters['$top'] = self._serialize.query('top', top, 'int') + response = self._send(http_method='GET', + location_id='52ba8915-5518-42e3-a4bb-b0182d159e2d', + version='5.1-preview.2', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[ResourceRef]', self._unwrap_collection(response)) + diff --git a/azure-devops/azure/devops/v5_1/build/models.py b/azure-devops/azure/devops/v5_1/build/models.py new file mode 100644 index 00000000..1f50de08 --- /dev/null +++ b/azure-devops/azure/devops/v5_1/build/models.py @@ -0,0 +1,3095 @@ +# -------------------------------------------------------------------------------------------- +# 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 AgentPoolQueue(Model): + """ + Represents a queue for running builds. + + :param _links: + :type _links: :class:`ReferenceLinks ` + :param id: The ID of the queue. + :type id: int + :param name: The name of the queue. + :type name: str + :param pool: The pool used by this queue. + :type pool: :class:`TaskAgentPoolReference ` + :param url: The full http link to the resource. + :type url: str + """ + + _attribute_map = { + '_links': {'key': '_links', 'type': 'ReferenceLinks'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'pool': {'key': 'pool', 'type': 'TaskAgentPoolReference'}, + 'url': {'key': 'url', 'type': 'str'} + } + + def __init__(self, _links=None, id=None, name=None, pool=None, url=None): + super(AgentPoolQueue, self).__init__() + self._links = _links + self.id = id + self.name = name + self.pool = pool + self.url = url + + +class AgentSpecification(Model): + """ + Specification of the agent defined by the pool provider. + + :param identifier: Agent specification unique identifier. + :type identifier: str + """ + + _attribute_map = { + 'identifier': {'key': 'identifier', 'type': 'str'} + } + + def __init__(self, identifier=None): + super(AgentSpecification, self).__init__() + self.identifier = identifier + + +class AggregatedResultsAnalysis(Model): + """ + :param duration: + :type duration: object + :param not_reported_results_by_outcome: + :type not_reported_results_by_outcome: dict + :param previous_context: + :type previous_context: :class:`TestResultsContext ` + :param results_by_outcome: + :type results_by_outcome: dict + :param results_difference: + :type results_difference: :class:`AggregatedResultsDifference ` + :param run_summary_by_outcome: + :type run_summary_by_outcome: dict + :param run_summary_by_state: + :type run_summary_by_state: dict + :param total_tests: + :type total_tests: int + """ + + _attribute_map = { + 'duration': {'key': 'duration', 'type': 'object'}, + 'not_reported_results_by_outcome': {'key': 'notReportedResultsByOutcome', 'type': '{AggregatedResultsByOutcome}'}, + 'previous_context': {'key': 'previousContext', 'type': 'TestResultsContext'}, + 'results_by_outcome': {'key': 'resultsByOutcome', 'type': '{AggregatedResultsByOutcome}'}, + 'results_difference': {'key': 'resultsDifference', 'type': 'AggregatedResultsDifference'}, + 'run_summary_by_outcome': {'key': 'runSummaryByOutcome', 'type': '{AggregatedRunsByOutcome}'}, + 'run_summary_by_state': {'key': 'runSummaryByState', 'type': '{AggregatedRunsByState}'}, + 'total_tests': {'key': 'totalTests', 'type': 'int'} + } + + def __init__(self, duration=None, not_reported_results_by_outcome=None, previous_context=None, results_by_outcome=None, results_difference=None, run_summary_by_outcome=None, run_summary_by_state=None, total_tests=None): + super(AggregatedResultsAnalysis, self).__init__() + self.duration = duration + self.not_reported_results_by_outcome = not_reported_results_by_outcome + self.previous_context = previous_context + self.results_by_outcome = results_by_outcome + self.results_difference = results_difference + self.run_summary_by_outcome = run_summary_by_outcome + self.run_summary_by_state = run_summary_by_state + self.total_tests = total_tests + + +class AggregatedResultsByOutcome(Model): + """ + :param count: + :type count: int + :param duration: + :type duration: object + :param group_by_field: + :type group_by_field: str + :param group_by_value: + :type group_by_value: object + :param outcome: + :type outcome: object + :param rerun_result_count: + :type rerun_result_count: int + """ + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + 'duration': {'key': 'duration', 'type': 'object'}, + 'group_by_field': {'key': 'groupByField', 'type': 'str'}, + 'group_by_value': {'key': 'groupByValue', 'type': 'object'}, + 'outcome': {'key': 'outcome', 'type': 'object'}, + 'rerun_result_count': {'key': 'rerunResultCount', 'type': 'int'} + } + + def __init__(self, count=None, duration=None, group_by_field=None, group_by_value=None, outcome=None, rerun_result_count=None): + super(AggregatedResultsByOutcome, self).__init__() + self.count = count + self.duration = duration + self.group_by_field = group_by_field + self.group_by_value = group_by_value + self.outcome = outcome + self.rerun_result_count = rerun_result_count + + +class AggregatedResultsDifference(Model): + """ + :param increase_in_duration: + :type increase_in_duration: object + :param increase_in_failures: + :type increase_in_failures: int + :param increase_in_other_tests: + :type increase_in_other_tests: int + :param increase_in_passed_tests: + :type increase_in_passed_tests: int + :param increase_in_total_tests: + :type increase_in_total_tests: int + """ + + _attribute_map = { + 'increase_in_duration': {'key': 'increaseInDuration', 'type': 'object'}, + 'increase_in_failures': {'key': 'increaseInFailures', 'type': 'int'}, + 'increase_in_other_tests': {'key': 'increaseInOtherTests', 'type': 'int'}, + 'increase_in_passed_tests': {'key': 'increaseInPassedTests', 'type': 'int'}, + 'increase_in_total_tests': {'key': 'increaseInTotalTests', 'type': 'int'} + } + + def __init__(self, increase_in_duration=None, increase_in_failures=None, increase_in_other_tests=None, increase_in_passed_tests=None, increase_in_total_tests=None): + super(AggregatedResultsDifference, self).__init__() + self.increase_in_duration = increase_in_duration + self.increase_in_failures = increase_in_failures + self.increase_in_other_tests = increase_in_other_tests + self.increase_in_passed_tests = increase_in_passed_tests + self.increase_in_total_tests = increase_in_total_tests + + +class AggregatedRunsByOutcome(Model): + """ + :param outcome: + :type outcome: object + :param runs_count: + :type runs_count: int + """ + + _attribute_map = { + 'outcome': {'key': 'outcome', 'type': 'object'}, + 'runs_count': {'key': 'runsCount', 'type': 'int'} + } + + def __init__(self, outcome=None, runs_count=None): + super(AggregatedRunsByOutcome, self).__init__() + self.outcome = outcome + self.runs_count = runs_count + + +class AggregatedRunsByState(Model): + """ + :param results_by_outcome: + :type results_by_outcome: dict + :param runs_count: + :type runs_count: int + :param state: + :type state: object + """ + + _attribute_map = { + 'results_by_outcome': {'key': 'resultsByOutcome', 'type': '{AggregatedResultsByOutcome}'}, + 'runs_count': {'key': 'runsCount', 'type': 'int'}, + 'state': {'key': 'state', 'type': 'object'} + } + + def __init__(self, results_by_outcome=None, runs_count=None, state=None): + super(AggregatedRunsByState, self).__init__() + self.results_by_outcome = results_by_outcome + self.runs_count = runs_count + self.state = state + + +class ArtifactResource(Model): + """ + :param _links: + :type _links: :class:`ReferenceLinks ` + :param data: Type-specific data about the artifact. + :type data: str + :param download_url: A link to download the resource. + :type download_url: str + :param properties: Type-specific properties of the artifact. + :type properties: dict + :param type: The type of the resource: File container, version control folder, UNC path, etc. + :type type: str + :param url: The full http link to the resource. + :type url: str + """ + + _attribute_map = { + '_links': {'key': '_links', 'type': 'ReferenceLinks'}, + 'data': {'key': 'data', 'type': 'str'}, + 'download_url': {'key': 'downloadUrl', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'type': {'key': 'type', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'} + } + + def __init__(self, _links=None, data=None, download_url=None, properties=None, type=None, url=None): + super(ArtifactResource, self).__init__() + self._links = _links + self.data = data + self.download_url = download_url + self.properties = properties + self.type = type + self.url = url + + +class AssociatedWorkItem(Model): + """ + :param assigned_to: + :type assigned_to: str + :param id: Id of associated the work item. + :type id: int + :param state: + :type state: str + :param title: + :type title: str + :param url: REST Url of the work item. + :type url: str + :param web_url: + :type web_url: str + :param work_item_type: + :type work_item_type: str + """ + + _attribute_map = { + 'assigned_to': {'key': 'assignedTo', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'int'}, + 'state': {'key': 'state', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'web_url': {'key': 'webUrl', 'type': 'str'}, + 'work_item_type': {'key': 'workItemType', 'type': 'str'} + } + + def __init__(self, assigned_to=None, id=None, state=None, title=None, url=None, web_url=None, work_item_type=None): + super(AssociatedWorkItem, self).__init__() + self.assigned_to = assigned_to + self.id = id + self.state = state + self.title = title + self.url = url + self.web_url = web_url + self.work_item_type = work_item_type + + +class Attachment(Model): + """ + Represents an attachment to a build. + + :param _links: + :type _links: :class:`ReferenceLinks ` + :param name: The name of the attachment. + :type name: str + """ + + _attribute_map = { + '_links': {'key': '_links', 'type': 'ReferenceLinks'}, + 'name': {'key': 'name', 'type': 'str'} + } + + def __init__(self, _links=None, name=None): + super(Attachment, self).__init__() + self._links = _links + self.name = name + + +class AuthorizationHeader(Model): + """ + :param name: + :type name: str + :param value: + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'} + } + + def __init__(self, name=None, value=None): + super(AuthorizationHeader, self).__init__() + self.name = name + self.value = value + + +class Build(Model): + """ + Data representation of a build. + + :param _links: + :type _links: :class:`ReferenceLinks ` + :param agent_specification: The agent specification for the build. + :type agent_specification: :class:`AgentSpecification ` + :param build_number: The build number/name of the build. + :type build_number: str + :param build_number_revision: The build number revision. + :type build_number_revision: int + :param controller: The build controller. This is only set if the definition type is Xaml. + :type controller: :class:`BuildController ` + :param definition: The definition associated with the build. + :type definition: :class:`DefinitionReference ` + :param deleted: Indicates whether the build has been deleted. + :type deleted: bool + :param deleted_by: The identity of the process or person that deleted the build. + :type deleted_by: :class:`IdentityRef ` + :param deleted_date: The date the build was deleted. + :type deleted_date: datetime + :param deleted_reason: The description of how the build was deleted. + :type deleted_reason: str + :param demands: A list of demands that represents the agent capabilities required by this build. + :type demands: list of :class:`object ` + :param finish_time: The time that the build was completed. + :type finish_time: datetime + :param id: The ID of the build. + :type id: int + :param keep_forever: Indicates whether the build should be skipped by retention policies. + :type keep_forever: bool + :param last_changed_by: The identity representing the process or person that last changed the build. + :type last_changed_by: :class:`IdentityRef ` + :param last_changed_date: The date the build was last changed. + :type last_changed_date: datetime + :param logs: Information about the build logs. + :type logs: :class:`BuildLogReference ` + :param orchestration_plan: The orchestration plan for the build. + :type orchestration_plan: :class:`TaskOrchestrationPlanReference ` + :param parameters: The parameters for the build. + :type parameters: str + :param plans: Orchestration plans associated with the build (build, cleanup) + :type plans: list of :class:`TaskOrchestrationPlanReference ` + :param priority: The build's priority. + :type priority: object + :param project: The team project. + :type project: :class:`TeamProjectReference ` + :param properties: + :type properties: :class:`object ` + :param quality: The quality of the xaml build (good, bad, etc.) + :type quality: str + :param queue: The queue. This is only set if the definition type is Build. + :type queue: :class:`AgentPoolQueue ` + :param queue_options: Additional options for queueing the build. + :type queue_options: object + :param queue_position: The current position of the build in the queue. + :type queue_position: int + :param queue_time: The time that the build was queued. + :type queue_time: datetime + :param reason: The reason that the build was created. + :type reason: object + :param repository: The repository. + :type repository: :class:`BuildRepository ` + :param requested_by: The identity that queued the build. + :type requested_by: :class:`IdentityRef ` + :param requested_for: The identity on whose behalf the build was queued. + :type requested_for: :class:`IdentityRef ` + :param result: The build result. + :type result: object + :param retained_by_release: Indicates whether the build is retained by a release. + :type retained_by_release: bool + :param source_branch: The source branch. + :type source_branch: str + :param source_version: The source version. + :type source_version: str + :param start_time: The time that the build was started. + :type start_time: datetime + :param status: The status of the build. + :type status: object + :param tags: + :type tags: list of str + :param triggered_by_build: The build that triggered this build via a Build completion trigger. + :type triggered_by_build: :class:`Build ` + :param trigger_info: Sourceprovider-specific information about what triggered the build + :type trigger_info: dict + :param uri: The URI of the build. + :type uri: str + :param url: The REST URL of the build. + :type url: str + :param validation_results: + :type validation_results: list of :class:`BuildRequestValidationResult ` + """ + + _attribute_map = { + '_links': {'key': '_links', 'type': 'ReferenceLinks'}, + 'agent_specification': {'key': 'agentSpecification', 'type': 'AgentSpecification'}, + 'build_number': {'key': 'buildNumber', 'type': 'str'}, + 'build_number_revision': {'key': 'buildNumberRevision', 'type': 'int'}, + 'controller': {'key': 'controller', 'type': 'BuildController'}, + 'definition': {'key': 'definition', 'type': 'DefinitionReference'}, + 'deleted': {'key': 'deleted', 'type': 'bool'}, + 'deleted_by': {'key': 'deletedBy', 'type': 'IdentityRef'}, + 'deleted_date': {'key': 'deletedDate', 'type': 'iso-8601'}, + 'deleted_reason': {'key': 'deletedReason', 'type': 'str'}, + 'demands': {'key': 'demands', 'type': '[object]'}, + 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, + 'id': {'key': 'id', 'type': 'int'}, + 'keep_forever': {'key': 'keepForever', 'type': 'bool'}, + 'last_changed_by': {'key': 'lastChangedBy', 'type': 'IdentityRef'}, + 'last_changed_date': {'key': 'lastChangedDate', 'type': 'iso-8601'}, + 'logs': {'key': 'logs', 'type': 'BuildLogReference'}, + 'orchestration_plan': {'key': 'orchestrationPlan', 'type': 'TaskOrchestrationPlanReference'}, + 'parameters': {'key': 'parameters', 'type': 'str'}, + 'plans': {'key': 'plans', 'type': '[TaskOrchestrationPlanReference]'}, + 'priority': {'key': 'priority', 'type': 'object'}, + 'project': {'key': 'project', 'type': 'TeamProjectReference'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'quality': {'key': 'quality', 'type': 'str'}, + 'queue': {'key': 'queue', 'type': 'AgentPoolQueue'}, + 'queue_options': {'key': 'queueOptions', 'type': 'object'}, + 'queue_position': {'key': 'queuePosition', 'type': 'int'}, + 'queue_time': {'key': 'queueTime', 'type': 'iso-8601'}, + 'reason': {'key': 'reason', 'type': 'object'}, + 'repository': {'key': 'repository', 'type': 'BuildRepository'}, + 'requested_by': {'key': 'requestedBy', 'type': 'IdentityRef'}, + 'requested_for': {'key': 'requestedFor', 'type': 'IdentityRef'}, + 'result': {'key': 'result', 'type': 'object'}, + 'retained_by_release': {'key': 'retainedByRelease', 'type': 'bool'}, + 'source_branch': {'key': 'sourceBranch', 'type': 'str'}, + 'source_version': {'key': 'sourceVersion', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'status': {'key': 'status', 'type': 'object'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + 'triggered_by_build': {'key': 'triggeredByBuild', 'type': 'Build'}, + 'trigger_info': {'key': 'triggerInfo', 'type': '{str}'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'validation_results': {'key': 'validationResults', 'type': '[BuildRequestValidationResult]'} + } + + def __init__(self, _links=None, agent_specification=None, build_number=None, build_number_revision=None, controller=None, definition=None, deleted=None, deleted_by=None, deleted_date=None, deleted_reason=None, demands=None, finish_time=None, id=None, keep_forever=None, last_changed_by=None, last_changed_date=None, logs=None, orchestration_plan=None, parameters=None, plans=None, priority=None, project=None, properties=None, quality=None, queue=None, queue_options=None, queue_position=None, queue_time=None, reason=None, repository=None, requested_by=None, requested_for=None, result=None, retained_by_release=None, source_branch=None, source_version=None, start_time=None, status=None, tags=None, triggered_by_build=None, trigger_info=None, uri=None, url=None, validation_results=None): + super(Build, self).__init__() + self._links = _links + self.agent_specification = agent_specification + self.build_number = build_number + self.build_number_revision = build_number_revision + self.controller = controller + self.definition = definition + self.deleted = deleted + self.deleted_by = deleted_by + self.deleted_date = deleted_date + self.deleted_reason = deleted_reason + self.demands = demands + self.finish_time = finish_time + self.id = id + self.keep_forever = keep_forever + self.last_changed_by = last_changed_by + self.last_changed_date = last_changed_date + self.logs = logs + self.orchestration_plan = orchestration_plan + self.parameters = parameters + self.plans = plans + self.priority = priority + self.project = project + self.properties = properties + self.quality = quality + self.queue = queue + self.queue_options = queue_options + self.queue_position = queue_position + self.queue_time = queue_time + self.reason = reason + self.repository = repository + self.requested_by = requested_by + self.requested_for = requested_for + self.result = result + self.retained_by_release = retained_by_release + self.source_branch = source_branch + self.source_version = source_version + self.start_time = start_time + self.status = status + self.tags = tags + self.triggered_by_build = triggered_by_build + self.trigger_info = trigger_info + self.uri = uri + self.url = url + self.validation_results = validation_results + + +class BuildArtifact(Model): + """ + Represents an artifact produced by a build. + + :param id: The artifact ID. + :type id: int + :param name: The name of the artifact. + :type name: str + :param resource: The actual resource. + :type resource: :class:`ArtifactResource ` + :param source: The artifact source, which will be the ID of the job that produced this artifact. + :type source: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'ArtifactResource'}, + 'source': {'key': 'source', 'type': 'str'} + } + + def __init__(self, id=None, name=None, resource=None, source=None): + super(BuildArtifact, self).__init__() + self.id = id + self.name = name + self.resource = resource + self.source = source + + +class BuildBadge(Model): + """ + Represents a build badge. + + :param build_id: The ID of the build represented by this badge. + :type build_id: int + :param image_url: A link to the SVG resource. + :type image_url: str + """ + + _attribute_map = { + 'build_id': {'key': 'buildId', 'type': 'int'}, + 'image_url': {'key': 'imageUrl', 'type': 'str'} + } + + def __init__(self, build_id=None, image_url=None): + super(BuildBadge, self).__init__() + self.build_id = build_id + self.image_url = image_url + + +class BuildDefinitionRevision(Model): + """ + Represents a revision of a build definition. + + :param changed_by: The identity of the person or process that changed the definition. + :type changed_by: :class:`IdentityRef ` + :param changed_date: The date and time that the definition was changed. + :type changed_date: datetime + :param change_type: The change type (add, edit, delete). + :type change_type: object + :param comment: The comment associated with the change. + :type comment: str + :param definition_url: A link to the definition at this revision. + :type definition_url: str + :param name: The name of the definition. + :type name: str + :param revision: The revision number. + :type revision: int + """ + + _attribute_map = { + 'changed_by': {'key': 'changedBy', 'type': 'IdentityRef'}, + 'changed_date': {'key': 'changedDate', 'type': 'iso-8601'}, + 'change_type': {'key': 'changeType', 'type': 'object'}, + 'comment': {'key': 'comment', 'type': 'str'}, + 'definition_url': {'key': 'definitionUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'revision': {'key': 'revision', 'type': 'int'} + } + + def __init__(self, changed_by=None, changed_date=None, change_type=None, comment=None, definition_url=None, name=None, revision=None): + super(BuildDefinitionRevision, self).__init__() + self.changed_by = changed_by + self.changed_date = changed_date + self.change_type = change_type + self.comment = comment + self.definition_url = definition_url + self.name = name + self.revision = revision + + +class BuildDefinitionStep(Model): + """ + Represents a step in a build phase. + + :param always_run: Indicates whether this step should run even if a previous step fails. + :type always_run: bool + :param condition: A condition that determines whether this step should run. + :type condition: str + :param continue_on_error: Indicates whether the phase should continue even if this step fails. + :type continue_on_error: bool + :param display_name: The display name for this step. + :type display_name: str + :param enabled: Indicates whether the step is enabled. + :type enabled: bool + :param environment: + :type environment: dict + :param inputs: + :type inputs: dict + :param ref_name: The reference name for this step. + :type ref_name: str + :param task: The task associated with this step. + :type task: :class:`TaskDefinitionReference ` + :param timeout_in_minutes: The time, in minutes, that this step is allowed to run. + :type timeout_in_minutes: int + """ + + _attribute_map = { + 'always_run': {'key': 'alwaysRun', 'type': 'bool'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'continue_on_error': {'key': 'continueOnError', 'type': 'bool'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'environment': {'key': 'environment', 'type': '{str}'}, + 'inputs': {'key': 'inputs', 'type': '{str}'}, + 'ref_name': {'key': 'refName', 'type': 'str'}, + 'task': {'key': 'task', 'type': 'TaskDefinitionReference'}, + 'timeout_in_minutes': {'key': 'timeoutInMinutes', 'type': 'int'} + } + + def __init__(self, always_run=None, condition=None, continue_on_error=None, display_name=None, enabled=None, environment=None, inputs=None, ref_name=None, task=None, timeout_in_minutes=None): + super(BuildDefinitionStep, self).__init__() + self.always_run = always_run + self.condition = condition + self.continue_on_error = continue_on_error + self.display_name = display_name + self.enabled = enabled + self.environment = environment + self.inputs = inputs + self.ref_name = ref_name + self.task = task + self.timeout_in_minutes = timeout_in_minutes + + +class BuildDefinitionTemplate(Model): + """ + Represents a template from which new build definitions can be created. + + :param can_delete: Indicates whether the template can be deleted. + :type can_delete: bool + :param category: The template category. + :type category: str + :param default_hosted_queue: An optional hosted agent queue for the template to use by default. + :type default_hosted_queue: str + :param description: A description of the template. + :type description: str + :param icons: + :type icons: dict + :param icon_task_id: The ID of the task whose icon is used when showing this template in the UI. + :type icon_task_id: str + :param id: The ID of the template. + :type id: str + :param name: The name of the template. + :type name: str + :param template: The actual template. + :type template: :class:`BuildDefinition ` + """ + + _attribute_map = { + 'can_delete': {'key': 'canDelete', 'type': 'bool'}, + 'category': {'key': 'category', 'type': 'str'}, + 'default_hosted_queue': {'key': 'defaultHostedQueue', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'icons': {'key': 'icons', 'type': '{str}'}, + 'icon_task_id': {'key': 'iconTaskId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'template': {'key': 'template', 'type': 'BuildDefinition'} + } + + def __init__(self, can_delete=None, category=None, default_hosted_queue=None, description=None, icons=None, icon_task_id=None, id=None, name=None, template=None): + super(BuildDefinitionTemplate, self).__init__() + self.can_delete = can_delete + self.category = category + self.default_hosted_queue = default_hosted_queue + self.description = description + self.icons = icons + self.icon_task_id = icon_task_id + self.id = id + self.name = name + self.template = template + + +class BuildDefinitionTemplate3_2(Model): + """ + For back-compat with extensions that use the old Steps format instead of Process and Phases + + :param can_delete: + :type can_delete: bool + :param category: + :type category: str + :param default_hosted_queue: + :type default_hosted_queue: str + :param description: + :type description: str + :param icons: + :type icons: dict + :param icon_task_id: + :type icon_task_id: str + :param id: + :type id: str + :param name: + :type name: str + :param template: + :type template: :class:`BuildDefinition3_2 ` + """ + + _attribute_map = { + 'can_delete': {'key': 'canDelete', 'type': 'bool'}, + 'category': {'key': 'category', 'type': 'str'}, + 'default_hosted_queue': {'key': 'defaultHostedQueue', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'icons': {'key': 'icons', 'type': '{str}'}, + 'icon_task_id': {'key': 'iconTaskId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'template': {'key': 'template', 'type': 'BuildDefinition3_2'} + } + + def __init__(self, can_delete=None, category=None, default_hosted_queue=None, description=None, icons=None, icon_task_id=None, id=None, name=None, template=None): + super(BuildDefinitionTemplate3_2, self).__init__() + self.can_delete = can_delete + self.category = category + self.default_hosted_queue = default_hosted_queue + self.description = description + self.icons = icons + self.icon_task_id = icon_task_id + self.id = id + self.name = name + self.template = template + + +class BuildDefinitionVariable(Model): + """ + Represents a variable used by a build definition. + + :param allow_override: Indicates whether the value can be set at queue time. + :type allow_override: bool + :param is_secret: Indicates whether the variable's value is a secret. + :type is_secret: bool + :param value: The value of the variable. + :type value: str + """ + + _attribute_map = { + 'allow_override': {'key': 'allowOverride', 'type': 'bool'}, + 'is_secret': {'key': 'isSecret', 'type': 'bool'}, + 'value': {'key': 'value', 'type': 'str'} + } + + def __init__(self, allow_override=None, is_secret=None, value=None): + super(BuildDefinitionVariable, self).__init__() + self.allow_override = allow_override + self.is_secret = is_secret + self.value = value + + +class BuildLogReference(Model): + """ + Represents a reference to a build log. + + :param id: The ID of the log. + :type id: int + :param type: The type of the log location. + :type type: str + :param url: A full link to the log resource. + :type url: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'type': {'key': 'type', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'} + } + + def __init__(self, id=None, type=None, url=None): + super(BuildLogReference, self).__init__() + self.id = id + self.type = type + self.url = url + + +class BuildMetric(Model): + """ + Represents metadata about builds in the system. + + :param date: The date for the scope. + :type date: datetime + :param int_value: The value. + :type int_value: int + :param name: The name of the metric. + :type name: str + :param scope: The scope. + :type scope: str + """ + + _attribute_map = { + 'date': {'key': 'date', 'type': 'iso-8601'}, + 'int_value': {'key': 'intValue', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'scope': {'key': 'scope', 'type': 'str'} + } + + def __init__(self, date=None, int_value=None, name=None, scope=None): + super(BuildMetric, self).__init__() + self.date = date + self.int_value = int_value + self.name = name + self.scope = scope + + +class BuildOption(Model): + """ + Represents the application of an optional behavior to a build definition. + + :param definition: A reference to the build option. + :type definition: :class:`BuildOptionDefinitionReference ` + :param enabled: Indicates whether the behavior is enabled. + :type enabled: bool + :param inputs: + :type inputs: dict + """ + + _attribute_map = { + 'definition': {'key': 'definition', 'type': 'BuildOptionDefinitionReference'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'inputs': {'key': 'inputs', 'type': '{str}'} + } + + def __init__(self, definition=None, enabled=None, inputs=None): + super(BuildOption, self).__init__() + self.definition = definition + self.enabled = enabled + self.inputs = inputs + + +class BuildOptionDefinitionReference(Model): + """ + Represents a reference to a build option definition. + + :param id: The ID of the referenced build option. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'} + } + + def __init__(self, id=None): + super(BuildOptionDefinitionReference, self).__init__() + self.id = id + + +class BuildOptionGroupDefinition(Model): + """ + Represents a group of inputs for a build option. + + :param display_name: The name of the group to display in the UI. + :type display_name: str + :param is_expanded: Indicates whether the group is initially displayed as expanded in the UI. + :type is_expanded: bool + :param name: The internal name of the group. + :type name: str + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'is_expanded': {'key': 'isExpanded', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'} + } + + def __init__(self, display_name=None, is_expanded=None, name=None): + super(BuildOptionGroupDefinition, self).__init__() + self.display_name = display_name + self.is_expanded = is_expanded + self.name = name + + +class BuildOptionInputDefinition(Model): + """ + Represents an input for a build option. + + :param default_value: The default value. + :type default_value: str + :param group_name: The name of the input group that this input belongs to. + :type group_name: str + :param help: + :type help: dict + :param label: The label for the input. + :type label: str + :param name: The name of the input. + :type name: str + :param options: + :type options: dict + :param required: Indicates whether the input is required to have a value. + :type required: bool + :param type: Indicates the type of the input value. + :type type: object + :param visible_rule: The rule that is applied to determine whether the input is visible in the UI. + :type visible_rule: str + """ + + _attribute_map = { + 'default_value': {'key': 'defaultValue', 'type': 'str'}, + 'group_name': {'key': 'groupName', 'type': 'str'}, + 'help': {'key': 'help', 'type': '{str}'}, + 'label': {'key': 'label', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'options': {'key': 'options', 'type': '{str}'}, + 'required': {'key': 'required', 'type': 'bool'}, + 'type': {'key': 'type', 'type': 'object'}, + 'visible_rule': {'key': 'visibleRule', 'type': 'str'} + } + + def __init__(self, default_value=None, group_name=None, help=None, label=None, name=None, options=None, required=None, type=None, visible_rule=None): + super(BuildOptionInputDefinition, self).__init__() + self.default_value = default_value + self.group_name = group_name + self.help = help + self.label = label + self.name = name + self.options = options + self.required = required + self.type = type + self.visible_rule = visible_rule + + +class BuildReportMetadata(Model): + """ + Represents information about a build report. + + :param build_id: The Id of the build. + :type build_id: int + :param content: The content of the report. + :type content: str + :param type: The type of the report. + :type type: str + """ + + _attribute_map = { + 'build_id': {'key': 'buildId', 'type': 'int'}, + 'content': {'key': 'content', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'} + } + + def __init__(self, build_id=None, content=None, type=None): + super(BuildReportMetadata, self).__init__() + self.build_id = build_id + self.content = content + self.type = type + + +class BuildRepository(Model): + """ + Represents a repository used by a build definition. + + :param checkout_submodules: Indicates whether to checkout submodules. + :type checkout_submodules: bool + :param clean: Indicates whether to clean the target folder when getting code from the repository. + :type clean: str + :param default_branch: The name of the default branch. + :type default_branch: str + :param id: The ID of the repository. + :type id: str + :param name: The friendly name of the repository. + :type name: str + :param properties: + :type properties: dict + :param root_folder: The root folder. + :type root_folder: str + :param type: The type of the repository. + :type type: str + :param url: The URL of the repository. + :type url: str + """ + + _attribute_map = { + 'checkout_submodules': {'key': 'checkoutSubmodules', 'type': 'bool'}, + 'clean': {'key': 'clean', 'type': 'str'}, + 'default_branch': {'key': 'defaultBranch', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'root_folder': {'key': 'rootFolder', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'} + } + + def __init__(self, checkout_submodules=None, clean=None, default_branch=None, id=None, name=None, properties=None, root_folder=None, type=None, url=None): + super(BuildRepository, self).__init__() + self.checkout_submodules = checkout_submodules + self.clean = clean + self.default_branch = default_branch + self.id = id + self.name = name + self.properties = properties + self.root_folder = root_folder + self.type = type + self.url = url + + +class BuildRequestValidationResult(Model): + """ + Represents the result of validating a build request. + + :param message: The message associated with the result. + :type message: str + :param result: The result. + :type result: object + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'result': {'key': 'result', 'type': 'object'} + } + + def __init__(self, message=None, result=None): + super(BuildRequestValidationResult, self).__init__() + self.message = message + self.result = result + + +class BuildResourceUsage(Model): + """ + Represents information about resources used by builds in the system. + + :param distributed_task_agents: The number of build agents. + :type distributed_task_agents: int + :param paid_private_agent_slots: The number of paid private agent slots. + :type paid_private_agent_slots: int + :param total_usage: The total usage. + :type total_usage: int + :param xaml_controllers: The number of XAML controllers. + :type xaml_controllers: int + """ + + _attribute_map = { + 'distributed_task_agents': {'key': 'distributedTaskAgents', 'type': 'int'}, + 'paid_private_agent_slots': {'key': 'paidPrivateAgentSlots', 'type': 'int'}, + 'total_usage': {'key': 'totalUsage', 'type': 'int'}, + 'xaml_controllers': {'key': 'xamlControllers', 'type': 'int'} + } + + def __init__(self, distributed_task_agents=None, paid_private_agent_slots=None, total_usage=None, xaml_controllers=None): + super(BuildResourceUsage, self).__init__() + self.distributed_task_agents = distributed_task_agents + self.paid_private_agent_slots = paid_private_agent_slots + self.total_usage = total_usage + self.xaml_controllers = xaml_controllers + + +class BuildSettings(Model): + """ + Represents system-wide build settings. + + :param days_to_keep_deleted_builds_before_destroy: The number of days to keep records of deleted builds. + :type days_to_keep_deleted_builds_before_destroy: int + :param default_retention_policy: The default retention policy. + :type default_retention_policy: :class:`RetentionPolicy ` + :param maximum_retention_policy: The maximum retention policy. + :type maximum_retention_policy: :class:`RetentionPolicy ` + """ + + _attribute_map = { + 'days_to_keep_deleted_builds_before_destroy': {'key': 'daysToKeepDeletedBuildsBeforeDestroy', 'type': 'int'}, + 'default_retention_policy': {'key': 'defaultRetentionPolicy', 'type': 'RetentionPolicy'}, + 'maximum_retention_policy': {'key': 'maximumRetentionPolicy', 'type': 'RetentionPolicy'} + } + + def __init__(self, days_to_keep_deleted_builds_before_destroy=None, default_retention_policy=None, maximum_retention_policy=None): + super(BuildSettings, self).__init__() + self.days_to_keep_deleted_builds_before_destroy = days_to_keep_deleted_builds_before_destroy + self.default_retention_policy = default_retention_policy + self.maximum_retention_policy = maximum_retention_policy + + +class Change(Model): + """ + Represents a change associated with a build. + + :param author: The author of the change. + :type author: :class:`IdentityRef ` + :param display_uri: The location of a user-friendly representation of the resource. + :type display_uri: str + :param id: The identifier for the change. For a commit, this would be the SHA1. For a TFVC changeset, this would be the changeset ID. + :type id: str + :param location: The location of the full representation of the resource. + :type location: str + :param message: The description of the change. This might be a commit message or changeset description. + :type message: str + :param message_truncated: Indicates whether the message was truncated. + :type message_truncated: bool + :param pusher: The person or process that pushed the change. + :type pusher: str + :param timestamp: The timestamp for the change. + :type timestamp: datetime + :param type: The type of change. "commit", "changeset", etc. + :type type: str + """ + + _attribute_map = { + 'author': {'key': 'author', 'type': 'IdentityRef'}, + 'display_uri': {'key': 'displayUri', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'message_truncated': {'key': 'messageTruncated', 'type': 'bool'}, + 'pusher': {'key': 'pusher', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'type': {'key': 'type', 'type': 'str'} + } + + def __init__(self, author=None, display_uri=None, id=None, location=None, message=None, message_truncated=None, pusher=None, timestamp=None, type=None): + super(Change, self).__init__() + self.author = author + self.display_uri = display_uri + self.id = id + self.location = location + self.message = message + self.message_truncated = message_truncated + self.pusher = pusher + self.timestamp = timestamp + self.type = type + + +class DataSourceBindingBase(Model): + """ + Represents binding of data source for the service endpoint request. + + :param callback_context_template: Pagination format supported by this data source(ContinuationToken/SkipTop). + :type callback_context_template: str + :param callback_required_template: Subsequent calls needed? + :type callback_required_template: str + :param data_source_name: Gets or sets the name of the data source. + :type data_source_name: str + :param endpoint_id: Gets or sets the endpoint Id. + :type endpoint_id: str + :param endpoint_url: Gets or sets the url of the service endpoint. + :type endpoint_url: str + :param headers: Gets or sets the authorization headers. + :type headers: list of :class:`AuthorizationHeader ` + :param initial_context_template: Defines the initial value of the query params + :type initial_context_template: str + :param parameters: Gets or sets the parameters for the data source. + :type parameters: dict + :param request_content: Gets or sets http request body + :type request_content: str + :param request_verb: Gets or sets http request verb + :type request_verb: str + :param result_selector: Gets or sets the result selector. + :type result_selector: str + :param result_template: Gets or sets the result template. + :type result_template: str + :param target: Gets or sets the target of the data source. + :type target: str + """ + + _attribute_map = { + 'callback_context_template': {'key': 'callbackContextTemplate', 'type': 'str'}, + 'callback_required_template': {'key': 'callbackRequiredTemplate', 'type': 'str'}, + 'data_source_name': {'key': 'dataSourceName', 'type': 'str'}, + 'endpoint_id': {'key': 'endpointId', 'type': 'str'}, + 'endpoint_url': {'key': 'endpointUrl', 'type': 'str'}, + 'headers': {'key': 'headers', 'type': '[AuthorizationHeader]'}, + 'initial_context_template': {'key': 'initialContextTemplate', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{str}'}, + 'request_content': {'key': 'requestContent', 'type': 'str'}, + 'request_verb': {'key': 'requestVerb', 'type': 'str'}, + 'result_selector': {'key': 'resultSelector', 'type': 'str'}, + 'result_template': {'key': 'resultTemplate', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'} + } + + def __init__(self, callback_context_template=None, callback_required_template=None, data_source_name=None, endpoint_id=None, endpoint_url=None, headers=None, initial_context_template=None, parameters=None, request_content=None, request_verb=None, result_selector=None, result_template=None, target=None): + super(DataSourceBindingBase, self).__init__() + self.callback_context_template = callback_context_template + self.callback_required_template = callback_required_template + self.data_source_name = data_source_name + self.endpoint_id = endpoint_id + self.endpoint_url = endpoint_url + self.headers = headers + self.initial_context_template = initial_context_template + self.parameters = parameters + self.request_content = request_content + self.request_verb = request_verb + self.result_selector = result_selector + self.result_template = result_template + self.target = target + + +class DefinitionReference(Model): + """ + Represents a reference to a definition. + + :param created_date: The date this version of the definition was created. + :type created_date: datetime + :param id: The ID of the referenced definition. + :type id: int + :param name: The name of the referenced definition. + :type name: str + :param path: The folder path of the definition. + :type path: str + :param project: A reference to the project. + :type project: :class:`TeamProjectReference ` + :param queue_status: A value that indicates whether builds can be queued against this definition. + :type queue_status: object + :param revision: The definition revision number. + :type revision: int + :param type: The type of the definition. + :type type: object + :param uri: The definition's URI. + :type uri: str + :param url: The REST URL of the definition. + :type url: str + """ + + _attribute_map = { + 'created_date': {'key': 'createdDate', 'type': 'iso-8601'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, + 'project': {'key': 'project', 'type': 'TeamProjectReference'}, + 'queue_status': {'key': 'queueStatus', 'type': 'object'}, + 'revision': {'key': 'revision', 'type': 'int'}, + 'type': {'key': 'type', 'type': 'object'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'} + } + + def __init__(self, created_date=None, id=None, name=None, path=None, project=None, queue_status=None, revision=None, type=None, uri=None, url=None): + super(DefinitionReference, self).__init__() + self.created_date = created_date + self.id = id + self.name = name + self.path = path + self.project = project + self.queue_status = queue_status + self.revision = revision + self.type = type + self.uri = uri + self.url = url + + +class DefinitionResourceReference(Model): + """ + :param authorized: Indicates whether the resource is authorized for use. + :type authorized: bool + :param id: The id of the resource. + :type id: str + :param name: A friendly name for the resource. + :type name: str + :param type: The type of the resource. + :type type: str + """ + + _attribute_map = { + 'authorized': {'key': 'authorized', 'type': 'bool'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'} + } + + def __init__(self, authorized=None, id=None, name=None, type=None): + super(DefinitionResourceReference, self).__init__() + self.authorized = authorized + self.id = id + self.name = name + self.type = type + + +class Deployment(Model): + """ + Represents the data from the build information nodes for type "DeploymentInformation" for xaml builds + + :param type: + :type type: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'} + } + + def __init__(self, type=None): + super(Deployment, self).__init__() + self.type = type + + +class Folder(Model): + """ + Represents a folder that contains build definitions. + + :param created_by: The process or person who created the folder. + :type created_by: :class:`IdentityRef ` + :param created_on: The date the folder was created. + :type created_on: datetime + :param description: The description. + :type description: str + :param last_changed_by: The process or person that last changed the folder. + :type last_changed_by: :class:`IdentityRef ` + :param last_changed_date: The date the folder was last changed. + :type last_changed_date: datetime + :param path: The full path. + :type path: str + :param project: The project. + :type project: :class:`TeamProjectReference ` + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'IdentityRef'}, + 'created_on': {'key': 'createdOn', 'type': 'iso-8601'}, + 'description': {'key': 'description', 'type': 'str'}, + 'last_changed_by': {'key': 'lastChangedBy', 'type': 'IdentityRef'}, + 'last_changed_date': {'key': 'lastChangedDate', 'type': 'iso-8601'}, + 'path': {'key': 'path', 'type': 'str'}, + 'project': {'key': 'project', 'type': 'TeamProjectReference'} + } + + def __init__(self, created_by=None, created_on=None, description=None, last_changed_by=None, last_changed_date=None, path=None, project=None): + super(Folder, self).__init__() + self.created_by = created_by + self.created_on = created_on + self.description = description + self.last_changed_by = last_changed_by + self.last_changed_date = last_changed_date + self.path = path + self.project = project + + +class GraphSubjectBase(Model): + """ + :param _links: This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. + :type _links: :class:`ReferenceLinks ` + :param descriptor: The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. + :type descriptor: str + :param display_name: This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider. + :type display_name: str + :param url: This url is the full route to the source resource of this graph subject. + :type url: str + """ + + _attribute_map = { + '_links': {'key': '_links', 'type': 'ReferenceLinks'}, + 'descriptor': {'key': 'descriptor', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'} + } + + def __init__(self, _links=None, descriptor=None, display_name=None, url=None): + super(GraphSubjectBase, self).__init__() + self._links = _links + self.descriptor = descriptor + self.display_name = display_name + self.url = url + + +class IdentityRef(GraphSubjectBase): + """ + :param _links: This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. + :type _links: :class:`ReferenceLinks ` + :param descriptor: The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. + :type descriptor: str + :param display_name: This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider. + :type display_name: str + :param url: This url is the full route to the source resource of this graph subject. + :type url: str + :param directory_alias: Deprecated - Can be retrieved by querying the Graph user referenced in the "self" entry of the IdentityRef "_links" dictionary + :type directory_alias: str + :param id: + :type id: str + :param image_url: Deprecated - Available in the "avatar" entry of the IdentityRef "_links" dictionary + :type image_url: str + :param inactive: Deprecated - Can be retrieved by querying the Graph membership state referenced in the "membershipState" entry of the GraphUser "_links" dictionary + :type inactive: bool + :param is_aad_identity: Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsAadUserType/Descriptor.IsAadGroupType) + :type is_aad_identity: bool + :param is_container: Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsGroupType) + :type is_container: bool + :param is_deleted_in_origin: + :type is_deleted_in_origin: bool + :param profile_url: Deprecated - not in use in most preexisting implementations of ToIdentityRef + :type profile_url: str + :param unique_name: Deprecated - use Domain+PrincipalName instead + :type unique_name: str + """ + + _attribute_map = { + '_links': {'key': '_links', 'type': 'ReferenceLinks'}, + 'descriptor': {'key': 'descriptor', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'directory_alias': {'key': 'directoryAlias', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'image_url': {'key': 'imageUrl', 'type': 'str'}, + 'inactive': {'key': 'inactive', 'type': 'bool'}, + 'is_aad_identity': {'key': 'isAadIdentity', 'type': 'bool'}, + 'is_container': {'key': 'isContainer', 'type': 'bool'}, + 'is_deleted_in_origin': {'key': 'isDeletedInOrigin', 'type': 'bool'}, + 'profile_url': {'key': 'profileUrl', 'type': 'str'}, + 'unique_name': {'key': 'uniqueName', 'type': 'str'} + } + + def __init__(self, _links=None, descriptor=None, display_name=None, url=None, directory_alias=None, id=None, image_url=None, inactive=None, is_aad_identity=None, is_container=None, is_deleted_in_origin=None, profile_url=None, unique_name=None): + super(IdentityRef, self).__init__(_links=_links, descriptor=descriptor, display_name=display_name, url=url) + self.directory_alias = directory_alias + self.id = id + self.image_url = image_url + self.inactive = inactive + self.is_aad_identity = is_aad_identity + self.is_container = is_container + self.is_deleted_in_origin = is_deleted_in_origin + self.profile_url = profile_url + self.unique_name = unique_name + + +class Issue(Model): + """ + Represents an issue (error, warning) associated with a build. + + :param category: The category. + :type category: str + :param data: + :type data: dict + :param message: A description of the issue. + :type message: str + :param type: The type (error, warning) of the issue. + :type type: object + """ + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'data': {'key': 'data', 'type': '{str}'}, + 'message': {'key': 'message', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'object'} + } + + def __init__(self, category=None, data=None, message=None, type=None): + super(Issue, self).__init__() + self.category = category + self.data = data + self.message = message + self.type = type + + +class JsonPatchOperation(Model): + """ + The JSON model for a JSON Patch operation + + :param from_: The path to copy from for the Move/Copy operation. + :type from_: str + :param op: The patch operation + :type op: object + :param path: The path for the operation. In the case of an array, a zero based index can be used to specify the position in the array (e.g. /biscuits/0/name). The "-" character can be used instead of an index to insert at the end of the array (e.g. /biscuits/-). + :type path: str + :param value: The value for the operation. This is either a primitive or a JToken. + :type value: object + """ + + _attribute_map = { + 'from_': {'key': 'from', 'type': 'str'}, + 'op': {'key': 'op', 'type': 'object'}, + 'path': {'key': 'path', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'object'} + } + + def __init__(self, from_=None, op=None, path=None, value=None): + super(JsonPatchOperation, self).__init__() + self.from_ = from_ + self.op = op + self.path = path + self.value = value + + +class ProcessParameters(Model): + """ + :param data_source_bindings: + :type data_source_bindings: list of :class:`DataSourceBindingBase ` + :param inputs: + :type inputs: list of :class:`TaskInputDefinitionBase ` + :param source_definitions: + :type source_definitions: list of :class:`TaskSourceDefinitionBase ` + """ + + _attribute_map = { + 'data_source_bindings': {'key': 'dataSourceBindings', 'type': '[DataSourceBindingBase]'}, + 'inputs': {'key': 'inputs', 'type': '[TaskInputDefinitionBase]'}, + 'source_definitions': {'key': 'sourceDefinitions', 'type': '[TaskSourceDefinitionBase]'} + } + + def __init__(self, data_source_bindings=None, inputs=None, source_definitions=None): + super(ProcessParameters, self).__init__() + self.data_source_bindings = data_source_bindings + self.inputs = inputs + self.source_definitions = source_definitions + + +class PullRequest(Model): + """ + Represents a pull request object. These are retrieved from Source Providers. + + :param _links: The links to other objects related to this object. + :type _links: :class:`ReferenceLinks ` + :param author: Author of the pull request. + :type author: :class:`IdentityRef ` + :param current_state: Current state of the pull request, e.g. open, merged, closed, conflicts, etc. + :type current_state: str + :param description: Description for the pull request. + :type description: str + :param id: Unique identifier for the pull request + :type id: str + :param provider_name: The name of the provider this pull request is associated with. + :type provider_name: str + :param source_branch_ref: Source branch ref of this pull request + :type source_branch_ref: str + :param source_repository_owner: Owner of the source repository of this pull request + :type source_repository_owner: str + :param target_branch_ref: Target branch ref of this pull request + :type target_branch_ref: str + :param target_repository_owner: Owner of the target repository of this pull request + :type target_repository_owner: str + :param title: Title of the pull request. + :type title: str + """ + + _attribute_map = { + '_links': {'key': '_links', 'type': 'ReferenceLinks'}, + 'author': {'key': 'author', 'type': 'IdentityRef'}, + 'current_state': {'key': 'currentState', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'provider_name': {'key': 'providerName', 'type': 'str'}, + 'source_branch_ref': {'key': 'sourceBranchRef', 'type': 'str'}, + 'source_repository_owner': {'key': 'sourceRepositoryOwner', 'type': 'str'}, + 'target_branch_ref': {'key': 'targetBranchRef', 'type': 'str'}, + 'target_repository_owner': {'key': 'targetRepositoryOwner', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'} + } + + def __init__(self, _links=None, author=None, current_state=None, description=None, id=None, provider_name=None, source_branch_ref=None, source_repository_owner=None, target_branch_ref=None, target_repository_owner=None, title=None): + super(PullRequest, self).__init__() + self._links = _links + self.author = author + self.current_state = current_state + self.description = description + self.id = id + self.provider_name = provider_name + self.source_branch_ref = source_branch_ref + self.source_repository_owner = source_repository_owner + self.target_branch_ref = target_branch_ref + self.target_repository_owner = target_repository_owner + self.title = title + + +class ReferenceLinks(Model): + """ + The class to represent a collection of REST reference links. + + :param links: The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only. + :type links: dict + """ + + _attribute_map = { + 'links': {'key': 'links', 'type': '{object}'} + } + + def __init__(self, links=None): + super(ReferenceLinks, self).__init__() + self.links = links + + +class ReleaseReference(Model): + """ + Reference to a release. + + :param attempt: Number of Release Attempt. + :type attempt: int + :param creation_date: Release Creation Date. + :type creation_date: datetime + :param definition_id: Release definition ID. + :type definition_id: int + :param environment_creation_date: Environment creation Date. + :type environment_creation_date: datetime + :param environment_definition_id: Release environment definition ID. + :type environment_definition_id: int + :param environment_definition_name: Release environment definition name. + :type environment_definition_name: str + :param environment_id: Release environment ID. + :type environment_id: int + :param environment_name: Release environment name. + :type environment_name: str + :param id: Release ID. + :type id: int + :param name: Release name. + :type name: str + """ + + _attribute_map = { + 'attempt': {'key': 'attempt', 'type': 'int'}, + 'creation_date': {'key': 'creationDate', 'type': 'iso-8601'}, + 'definition_id': {'key': 'definitionId', 'type': 'int'}, + 'environment_creation_date': {'key': 'environmentCreationDate', 'type': 'iso-8601'}, + 'environment_definition_id': {'key': 'environmentDefinitionId', 'type': 'int'}, + 'environment_definition_name': {'key': 'environmentDefinitionName', 'type': 'str'}, + 'environment_id': {'key': 'environmentId', 'type': 'int'}, + 'environment_name': {'key': 'environmentName', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'} + } + + def __init__(self, attempt=None, creation_date=None, definition_id=None, environment_creation_date=None, environment_definition_id=None, environment_definition_name=None, environment_id=None, environment_name=None, id=None, name=None): + super(ReleaseReference, self).__init__() + self.attempt = attempt + self.creation_date = creation_date + self.definition_id = definition_id + self.environment_creation_date = environment_creation_date + self.environment_definition_id = environment_definition_id + self.environment_definition_name = environment_definition_name + self.environment_id = environment_id + self.environment_name = environment_name + self.id = id + self.name = name + + +class RepositoryWebhook(Model): + """ + Represents a repository's webhook returned from a source provider. + + :param name: The friendly name of the repository. + :type name: str + :param types: + :type types: list of DefinitionTriggerType + :param url: The URL of the repository. + :type url: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'types': {'key': 'types', 'type': '[object]'}, + 'url': {'key': 'url', 'type': 'str'} + } + + def __init__(self, name=None, types=None, url=None): + super(RepositoryWebhook, self).__init__() + self.name = name + self.types = types + self.url = url + + +class ResourceRef(Model): + """ + :param id: + :type id: str + :param url: + :type url: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'} + } + + def __init__(self, id=None, url=None): + super(ResourceRef, self).__init__() + self.id = id + self.url = url + + +class RetentionPolicy(Model): + """ + Represents a retention policy for a build definition. + + :param artifacts: + :type artifacts: list of str + :param artifact_types_to_delete: + :type artifact_types_to_delete: list of str + :param branches: + :type branches: list of str + :param days_to_keep: The number of days to keep builds. + :type days_to_keep: int + :param delete_build_record: Indicates whether the build record itself should be deleted. + :type delete_build_record: bool + :param delete_test_results: Indicates whether to delete test results associated with the build. + :type delete_test_results: bool + :param minimum_to_keep: The minimum number of builds to keep. + :type minimum_to_keep: int + """ + + _attribute_map = { + 'artifacts': {'key': 'artifacts', 'type': '[str]'}, + 'artifact_types_to_delete': {'key': 'artifactTypesToDelete', 'type': '[str]'}, + 'branches': {'key': 'branches', 'type': '[str]'}, + 'days_to_keep': {'key': 'daysToKeep', 'type': 'int'}, + 'delete_build_record': {'key': 'deleteBuildRecord', 'type': 'bool'}, + 'delete_test_results': {'key': 'deleteTestResults', 'type': 'bool'}, + 'minimum_to_keep': {'key': 'minimumToKeep', 'type': 'int'} + } + + def __init__(self, artifacts=None, artifact_types_to_delete=None, branches=None, days_to_keep=None, delete_build_record=None, delete_test_results=None, minimum_to_keep=None): + super(RetentionPolicy, self).__init__() + self.artifacts = artifacts + self.artifact_types_to_delete = artifact_types_to_delete + self.branches = branches + self.days_to_keep = days_to_keep + self.delete_build_record = delete_build_record + self.delete_test_results = delete_test_results + self.minimum_to_keep = minimum_to_keep + + +class SourceProviderAttributes(Model): + """ + :param name: The name of the source provider. + :type name: str + :param supported_capabilities: The capabilities supported by this source provider. + :type supported_capabilities: dict + :param supported_triggers: The types of triggers supported by this source provider. + :type supported_triggers: list of :class:`SupportedTrigger ` + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'supported_capabilities': {'key': 'supportedCapabilities', 'type': '{bool}'}, + 'supported_triggers': {'key': 'supportedTriggers', 'type': '[SupportedTrigger]'} + } + + def __init__(self, name=None, supported_capabilities=None, supported_triggers=None): + super(SourceProviderAttributes, self).__init__() + self.name = name + self.supported_capabilities = supported_capabilities + self.supported_triggers = supported_triggers + + +class SourceRepositories(Model): + """ + A set of repositories returned from the source provider. + + :param continuation_token: A token used to continue this paged request; 'null' if the request is complete + :type continuation_token: str + :param page_length: The number of repositories requested for each page + :type page_length: int + :param repositories: A list of repositories + :type repositories: list of :class:`SourceRepository ` + :param total_page_count: The total number of pages, or '-1' if unknown + :type total_page_count: int + """ + + _attribute_map = { + 'continuation_token': {'key': 'continuationToken', 'type': 'str'}, + 'page_length': {'key': 'pageLength', 'type': 'int'}, + 'repositories': {'key': 'repositories', 'type': '[SourceRepository]'}, + 'total_page_count': {'key': 'totalPageCount', 'type': 'int'} + } + + def __init__(self, continuation_token=None, page_length=None, repositories=None, total_page_count=None): + super(SourceRepositories, self).__init__() + self.continuation_token = continuation_token + self.page_length = page_length + self.repositories = repositories + self.total_page_count = total_page_count + + +class SourceRepository(Model): + """ + Represents a repository returned from a source provider. + + :param default_branch: The name of the default branch. + :type default_branch: str + :param full_name: The full name of the repository. + :type full_name: str + :param id: The ID of the repository. + :type id: str + :param name: The friendly name of the repository. + :type name: str + :param properties: + :type properties: dict + :param source_provider_name: The name of the source provider the repository is from. + :type source_provider_name: str + :param url: The URL of the repository. + :type url: str + """ + + _attribute_map = { + 'default_branch': {'key': 'defaultBranch', 'type': 'str'}, + 'full_name': {'key': 'fullName', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'source_provider_name': {'key': 'sourceProviderName', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'} + } + + def __init__(self, default_branch=None, full_name=None, id=None, name=None, properties=None, source_provider_name=None, url=None): + super(SourceRepository, self).__init__() + self.default_branch = default_branch + self.full_name = full_name + self.id = id + self.name = name + self.properties = properties + self.source_provider_name = source_provider_name + self.url = url + + +class SourceRepositoryItem(Model): + """ + Represents an item in a repository from a source provider. + + :param is_container: Whether the item is able to have sub-items (e.g., is a folder). + :type is_container: bool + :param path: The full path of the item, relative to the root of the repository. + :type path: str + :param type: The type of the item (folder, file, etc). + :type type: str + :param url: The URL of the item. + :type url: str + """ + + _attribute_map = { + 'is_container': {'key': 'isContainer', 'type': 'bool'}, + 'path': {'key': 'path', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'} + } + + def __init__(self, is_container=None, path=None, type=None, url=None): + super(SourceRepositoryItem, self).__init__() + self.is_container = is_container + self.path = path + self.type = type + self.url = url + + +class SupportedTrigger(Model): + """ + :param default_polling_interval: The default interval to wait between polls (only relevant when NotificationType is Polling). + :type default_polling_interval: int + :param notification_type: How the trigger is notified of changes. + :type notification_type: str + :param supported_capabilities: The capabilities supported by this trigger. + :type supported_capabilities: dict + :param type: The type of trigger. + :type type: object + """ + + _attribute_map = { + 'default_polling_interval': {'key': 'defaultPollingInterval', 'type': 'int'}, + 'notification_type': {'key': 'notificationType', 'type': 'str'}, + 'supported_capabilities': {'key': 'supportedCapabilities', 'type': '{object}'}, + 'type': {'key': 'type', 'type': 'object'} + } + + def __init__(self, default_polling_interval=None, notification_type=None, supported_capabilities=None, type=None): + super(SupportedTrigger, self).__init__() + self.default_polling_interval = default_polling_interval + self.notification_type = notification_type + self.supported_capabilities = supported_capabilities + self.type = type + + +class TaskAgentPoolReference(Model): + """ + Represents a reference to an agent pool. + + :param id: The pool ID. + :type id: int + :param is_hosted: A value indicating whether or not this pool is managed by the service. + :type is_hosted: bool + :param name: The pool name. + :type name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'is_hosted': {'key': 'isHosted', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'} + } + + def __init__(self, id=None, is_hosted=None, name=None): + super(TaskAgentPoolReference, self).__init__() + self.id = id + self.is_hosted = is_hosted + self.name = name + + +class TaskDefinitionReference(Model): + """ + A reference to a task definition. + + :param definition_type: The type of task (task or task group). + :type definition_type: str + :param id: The ID of the task. + :type id: str + :param version_spec: The version of the task. + :type version_spec: str + """ + + _attribute_map = { + 'definition_type': {'key': 'definitionType', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'version_spec': {'key': 'versionSpec', 'type': 'str'} + } + + def __init__(self, definition_type=None, id=None, version_spec=None): + super(TaskDefinitionReference, self).__init__() + self.definition_type = definition_type + self.id = id + self.version_spec = version_spec + + +class TaskInputDefinitionBase(Model): + """ + :param aliases: + :type aliases: list of str + :param default_value: + :type default_value: str + :param group_name: + :type group_name: str + :param help_mark_down: + :type help_mark_down: str + :param label: + :type label: str + :param name: + :type name: str + :param options: + :type options: dict + :param properties: + :type properties: dict + :param required: + :type required: bool + :param type: + :type type: str + :param validation: + :type validation: :class:`TaskInputValidation ` + :param visible_rule: + :type visible_rule: str + """ + + _attribute_map = { + 'aliases': {'key': 'aliases', 'type': '[str]'}, + 'default_value': {'key': 'defaultValue', 'type': 'str'}, + 'group_name': {'key': 'groupName', 'type': 'str'}, + 'help_mark_down': {'key': 'helpMarkDown', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'options': {'key': 'options', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'required': {'key': 'required', 'type': 'bool'}, + 'type': {'key': 'type', 'type': 'str'}, + 'validation': {'key': 'validation', 'type': 'TaskInputValidation'}, + 'visible_rule': {'key': 'visibleRule', 'type': 'str'} + } + + def __init__(self, aliases=None, default_value=None, group_name=None, help_mark_down=None, label=None, name=None, options=None, properties=None, required=None, type=None, validation=None, visible_rule=None): + super(TaskInputDefinitionBase, self).__init__() + self.aliases = aliases + self.default_value = default_value + self.group_name = group_name + self.help_mark_down = help_mark_down + self.label = label + self.name = name + self.options = options + self.properties = properties + self.required = required + self.type = type + self.validation = validation + self.visible_rule = visible_rule + + +class TaskInputValidation(Model): + """ + :param expression: Conditional expression + :type expression: str + :param message: Message explaining how user can correct if validation fails + :type message: str + """ + + _attribute_map = { + 'expression': {'key': 'expression', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'} + } + + def __init__(self, expression=None, message=None): + super(TaskInputValidation, self).__init__() + self.expression = expression + self.message = message + + +class TaskOrchestrationPlanReference(Model): + """ + Represents a reference to an orchestration plan. + + :param orchestration_type: The type of the plan. + :type orchestration_type: int + :param plan_id: The ID of the plan. + :type plan_id: str + """ + + _attribute_map = { + 'orchestration_type': {'key': 'orchestrationType', 'type': 'int'}, + 'plan_id': {'key': 'planId', 'type': 'str'} + } + + def __init__(self, orchestration_type=None, plan_id=None): + super(TaskOrchestrationPlanReference, self).__init__() + self.orchestration_type = orchestration_type + self.plan_id = plan_id + + +class TaskReference(Model): + """ + Represents a reference to a task. + + :param id: The ID of the task definition. + :type id: str + :param name: The name of the task definition. + :type name: str + :param version: The version of the task definition. + :type version: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'} + } + + def __init__(self, id=None, name=None, version=None): + super(TaskReference, self).__init__() + self.id = id + self.name = name + self.version = version + + +class TaskSourceDefinitionBase(Model): + """ + :param auth_key: + :type auth_key: str + :param endpoint: + :type endpoint: str + :param key_selector: + :type key_selector: str + :param selector: + :type selector: str + :param target: + :type target: str + """ + + _attribute_map = { + 'auth_key': {'key': 'authKey', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + 'key_selector': {'key': 'keySelector', 'type': 'str'}, + 'selector': {'key': 'selector', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'} + } + + def __init__(self, auth_key=None, endpoint=None, key_selector=None, selector=None, target=None): + super(TaskSourceDefinitionBase, self).__init__() + self.auth_key = auth_key + self.endpoint = endpoint + self.key_selector = key_selector + self.selector = selector + self.target = target + + +class TeamProjectReference(Model): + """ + Represents a shallow reference to a TeamProject. + + :param abbreviation: Project abbreviation. + :type abbreviation: str + :param default_team_image_url: Url to default team identity image. + :type default_team_image_url: str + :param description: The project's description (if any). + :type description: str + :param id: Project identifier. + :type id: str + :param last_update_time: Project last update time. + :type last_update_time: datetime + :param name: Project name. + :type name: str + :param revision: Project revision. + :type revision: long + :param state: Project state. + :type state: object + :param url: Url to the full version of the object. + :type url: str + :param visibility: Project visibility. + :type visibility: object + """ + + _attribute_map = { + 'abbreviation': {'key': 'abbreviation', 'type': 'str'}, + 'default_team_image_url': {'key': 'defaultTeamImageUrl', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'last_update_time': {'key': 'lastUpdateTime', 'type': 'iso-8601'}, + 'name': {'key': 'name', 'type': 'str'}, + 'revision': {'key': 'revision', 'type': 'long'}, + 'state': {'key': 'state', 'type': 'object'}, + 'url': {'key': 'url', 'type': 'str'}, + 'visibility': {'key': 'visibility', 'type': 'object'} + } + + def __init__(self, abbreviation=None, default_team_image_url=None, description=None, id=None, last_update_time=None, name=None, revision=None, state=None, url=None, visibility=None): + super(TeamProjectReference, self).__init__() + self.abbreviation = abbreviation + self.default_team_image_url = default_team_image_url + self.description = description + self.id = id + self.last_update_time = last_update_time + self.name = name + self.revision = revision + self.state = state + self.url = url + self.visibility = visibility + + +class TestResultsContext(Model): + """ + :param build: + :type build: :class:`BuildReference ` + :param context_type: + :type context_type: object + :param release: + :type release: :class:`ReleaseReference ` + """ + + _attribute_map = { + 'build': {'key': 'build', 'type': 'BuildReference'}, + 'context_type': {'key': 'contextType', 'type': 'object'}, + 'release': {'key': 'release', 'type': 'ReleaseReference'} + } + + def __init__(self, build=None, context_type=None, release=None): + super(TestResultsContext, self).__init__() + self.build = build + self.context_type = context_type + self.release = release + + +class TimelineAttempt(Model): + """ + :param attempt: Gets or sets the attempt of the record. + :type attempt: int + :param record_id: Gets or sets the record identifier located within the specified timeline. + :type record_id: str + :param timeline_id: Gets or sets the timeline identifier which owns the record representing this attempt. + :type timeline_id: str + """ + + _attribute_map = { + 'attempt': {'key': 'attempt', 'type': 'int'}, + 'record_id': {'key': 'recordId', 'type': 'str'}, + 'timeline_id': {'key': 'timelineId', 'type': 'str'} + } + + def __init__(self, attempt=None, record_id=None, timeline_id=None): + super(TimelineAttempt, self).__init__() + self.attempt = attempt + self.record_id = record_id + self.timeline_id = timeline_id + + +class TimelineRecord(Model): + """ + Represents an entry in a build's timeline. + + :param _links: + :type _links: :class:`ReferenceLinks ` + :param attempt: Attempt number of record. + :type attempt: int + :param change_id: The change ID. + :type change_id: int + :param current_operation: A string that indicates the current operation. + :type current_operation: str + :param details: A reference to a sub-timeline. + :type details: :class:`TimelineReference ` + :param error_count: The number of errors produced by this operation. + :type error_count: int + :param finish_time: The finish time. + :type finish_time: datetime + :param id: The ID of the record. + :type id: str + :param identifier: String identifier that is consistent across attempts. + :type identifier: str + :param issues: + :type issues: list of :class:`Issue ` + :param last_modified: The time the record was last modified. + :type last_modified: datetime + :param log: A reference to the log produced by this operation. + :type log: :class:`BuildLogReference ` + :param name: The name. + :type name: str + :param order: An ordinal value relative to other records. + :type order: int + :param parent_id: The ID of the record's parent. + :type parent_id: str + :param percent_complete: The current completion percentage. + :type percent_complete: int + :param previous_attempts: + :type previous_attempts: list of :class:`TimelineAttempt ` + :param result: The result. + :type result: object + :param result_code: The result code. + :type result_code: str + :param start_time: The start time. + :type start_time: datetime + :param state: The state of the record. + :type state: object + :param task: A reference to the task represented by this timeline record. + :type task: :class:`TaskReference ` + :param type: The type of the record. + :type type: str + :param url: The REST URL of the timeline record. + :type url: str + :param warning_count: The number of warnings produced by this operation. + :type warning_count: int + :param worker_name: The name of the agent running the operation. + :type worker_name: str + """ + + _attribute_map = { + '_links': {'key': '_links', 'type': 'ReferenceLinks'}, + 'attempt': {'key': 'attempt', 'type': 'int'}, + 'change_id': {'key': 'changeId', 'type': 'int'}, + 'current_operation': {'key': 'currentOperation', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'TimelineReference'}, + 'error_count': {'key': 'errorCount', 'type': 'int'}, + 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, + 'id': {'key': 'id', 'type': 'str'}, + 'identifier': {'key': 'identifier', 'type': 'str'}, + 'issues': {'key': 'issues', 'type': '[Issue]'}, + 'last_modified': {'key': 'lastModified', 'type': 'iso-8601'}, + 'log': {'key': 'log', 'type': 'BuildLogReference'}, + 'name': {'key': 'name', 'type': 'str'}, + 'order': {'key': 'order', 'type': 'int'}, + 'parent_id': {'key': 'parentId', 'type': 'str'}, + 'percent_complete': {'key': 'percentComplete', 'type': 'int'}, + 'previous_attempts': {'key': 'previousAttempts', 'type': '[TimelineAttempt]'}, + 'result': {'key': 'result', 'type': 'object'}, + 'result_code': {'key': 'resultCode', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'state': {'key': 'state', 'type': 'object'}, + 'task': {'key': 'task', 'type': 'TaskReference'}, + 'type': {'key': 'type', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'warning_count': {'key': 'warningCount', 'type': 'int'}, + 'worker_name': {'key': 'workerName', 'type': 'str'} + } + + def __init__(self, _links=None, attempt=None, change_id=None, current_operation=None, details=None, error_count=None, finish_time=None, id=None, identifier=None, issues=None, last_modified=None, log=None, name=None, order=None, parent_id=None, percent_complete=None, previous_attempts=None, result=None, result_code=None, start_time=None, state=None, task=None, type=None, url=None, warning_count=None, worker_name=None): + super(TimelineRecord, self).__init__() + self._links = _links + self.attempt = attempt + self.change_id = change_id + self.current_operation = current_operation + self.details = details + self.error_count = error_count + self.finish_time = finish_time + self.id = id + self.identifier = identifier + self.issues = issues + self.last_modified = last_modified + self.log = log + self.name = name + self.order = order + self.parent_id = parent_id + self.percent_complete = percent_complete + self.previous_attempts = previous_attempts + self.result = result + self.result_code = result_code + self.start_time = start_time + self.state = state + self.task = task + self.type = type + self.url = url + self.warning_count = warning_count + self.worker_name = worker_name + + +class TimelineReference(Model): + """ + Represents a reference to a timeline. + + :param change_id: The change ID. + :type change_id: int + :param id: The ID of the timeline. + :type id: str + :param url: The REST URL of the timeline. + :type url: str + """ + + _attribute_map = { + 'change_id': {'key': 'changeId', 'type': 'int'}, + 'id': {'key': 'id', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'} + } + + def __init__(self, change_id=None, id=None, url=None): + super(TimelineReference, self).__init__() + self.change_id = change_id + self.id = id + self.url = url + + +class VariableGroupReference(Model): + """ + Represents a reference to a variable group. + + :param alias: The Name of the variable group. + :type alias: str + :param id: The ID of the variable group. + :type id: int + """ + + _attribute_map = { + 'alias': {'key': 'alias', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'int'} + } + + def __init__(self, alias=None, id=None): + super(VariableGroupReference, self).__init__() + self.alias = alias + self.id = id + + +class WebApiConnectedServiceRef(Model): + """ + :param id: + :type id: str + :param url: + :type url: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'} + } + + def __init__(self, id=None, url=None): + super(WebApiConnectedServiceRef, self).__init__() + self.id = id + self.url = url + + +class XamlBuildControllerReference(Model): + """ + :param id: Id of the resource + :type id: int + :param name: Name of the linked resource (definition name, controller name, etc.) + :type name: str + :param url: Full http link to the resource + :type url: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'} + } + + def __init__(self, id=None, name=None, url=None): + super(XamlBuildControllerReference, self).__init__() + self.id = id + self.name = name + self.url = url + + +class BuildController(XamlBuildControllerReference): + """ + :param id: Id of the resource + :type id: int + :param name: Name of the linked resource (definition name, controller name, etc.) + :type name: str + :param url: Full http link to the resource + :type url: str + :param _links: + :type _links: :class:`ReferenceLinks ` + :param created_date: The date the controller was created. + :type created_date: datetime + :param description: The description of the controller. + :type description: str + :param enabled: Indicates whether the controller is enabled. + :type enabled: bool + :param status: The status of the controller. + :type status: object + :param updated_date: The date the controller was last updated. + :type updated_date: datetime + :param uri: The controller's URI. + :type uri: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + '_links': {'key': '_links', 'type': 'ReferenceLinks'}, + 'created_date': {'key': 'createdDate', 'type': 'iso-8601'}, + 'description': {'key': 'description', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'status': {'key': 'status', 'type': 'object'}, + 'updated_date': {'key': 'updatedDate', 'type': 'iso-8601'}, + 'uri': {'key': 'uri', 'type': 'str'} + } + + def __init__(self, id=None, name=None, url=None, _links=None, created_date=None, description=None, enabled=None, status=None, updated_date=None, uri=None): + super(BuildController, self).__init__(id=id, name=name, url=url) + self._links = _links + self.created_date = created_date + self.description = description + self.enabled = enabled + self.status = status + self.updated_date = updated_date + self.uri = uri + + +class BuildDefinitionReference(DefinitionReference): + """ + Represents a reference to a build definition. + + :param created_date: The date this version of the definition was created. + :type created_date: datetime + :param id: The ID of the referenced definition. + :type id: int + :param name: The name of the referenced definition. + :type name: str + :param path: The folder path of the definition. + :type path: str + :param project: A reference to the project. + :type project: :class:`TeamProjectReference ` + :param queue_status: A value that indicates whether builds can be queued against this definition. + :type queue_status: object + :param revision: The definition revision number. + :type revision: int + :param type: The type of the definition. + :type type: object + :param uri: The definition's URI. + :type uri: str + :param url: The REST URL of the definition. + :type url: str + :param _links: + :type _links: :class:`ReferenceLinks ` + :param authored_by: The author of the definition. + :type authored_by: :class:`IdentityRef ` + :param draft_of: A reference to the definition that this definition is a draft of, if this is a draft definition. + :type draft_of: :class:`DefinitionReference ` + :param drafts: The list of drafts associated with this definition, if this is not a draft definition. + :type drafts: list of :class:`DefinitionReference ` + :param latest_build: + :type latest_build: :class:`Build ` + :param latest_completed_build: + :type latest_completed_build: :class:`Build ` + :param metrics: + :type metrics: list of :class:`BuildMetric ` + :param quality: The quality of the definition document (draft, etc.) + :type quality: object + :param queue: The default queue for builds run against this definition. + :type queue: :class:`AgentPoolQueue ` + """ + + _attribute_map = { + 'created_date': {'key': 'createdDate', 'type': 'iso-8601'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, + 'project': {'key': 'project', 'type': 'TeamProjectReference'}, + 'queue_status': {'key': 'queueStatus', 'type': 'object'}, + 'revision': {'key': 'revision', 'type': 'int'}, + 'type': {'key': 'type', 'type': 'object'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + '_links': {'key': '_links', 'type': 'ReferenceLinks'}, + 'authored_by': {'key': 'authoredBy', 'type': 'IdentityRef'}, + 'draft_of': {'key': 'draftOf', 'type': 'DefinitionReference'}, + 'drafts': {'key': 'drafts', 'type': '[DefinitionReference]'}, + 'latest_build': {'key': 'latestBuild', 'type': 'Build'}, + 'latest_completed_build': {'key': 'latestCompletedBuild', 'type': 'Build'}, + 'metrics': {'key': 'metrics', 'type': '[BuildMetric]'}, + 'quality': {'key': 'quality', 'type': 'object'}, + 'queue': {'key': 'queue', 'type': 'AgentPoolQueue'} + } + + def __init__(self, created_date=None, id=None, name=None, path=None, project=None, queue_status=None, revision=None, type=None, uri=None, url=None, _links=None, authored_by=None, draft_of=None, drafts=None, latest_build=None, latest_completed_build=None, metrics=None, quality=None, queue=None): + super(BuildDefinitionReference, self).__init__(created_date=created_date, id=id, name=name, path=path, project=project, queue_status=queue_status, revision=revision, type=type, uri=uri, url=url) + self._links = _links + self.authored_by = authored_by + self.draft_of = draft_of + self.drafts = drafts + self.latest_build = latest_build + self.latest_completed_build = latest_completed_build + self.metrics = metrics + self.quality = quality + self.queue = queue + + +class BuildDefinitionReference3_2(DefinitionReference): + """ + For back-compat with extensions that use the old Steps format instead of Process and Phases + + :param created_date: The date this version of the definition was created. + :type created_date: datetime + :param id: The ID of the referenced definition. + :type id: int + :param name: The name of the referenced definition. + :type name: str + :param path: The folder path of the definition. + :type path: str + :param project: A reference to the project. + :type project: :class:`TeamProjectReference ` + :param queue_status: A value that indicates whether builds can be queued against this definition. + :type queue_status: object + :param revision: The definition revision number. + :type revision: int + :param type: The type of the definition. + :type type: object + :param uri: The definition's URI. + :type uri: str + :param url: The REST URL of the definition. + :type url: str + :param _links: + :type _links: :class:`ReferenceLinks ` + :param authored_by: The author of the definition. + :type authored_by: :class:`IdentityRef ` + :param draft_of: A reference to the definition that this definition is a draft of, if this is a draft definition. + :type draft_of: :class:`DefinitionReference ` + :param drafts: The list of drafts associated with this definition, if this is not a draft definition. + :type drafts: list of :class:`DefinitionReference ` + :param metrics: + :type metrics: list of :class:`BuildMetric ` + :param quality: The quality of the definition document (draft, etc.) + :type quality: object + :param queue: The default queue for builds run against this definition. + :type queue: :class:`AgentPoolQueue ` + """ + + _attribute_map = { + 'created_date': {'key': 'createdDate', 'type': 'iso-8601'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, + 'project': {'key': 'project', 'type': 'TeamProjectReference'}, + 'queue_status': {'key': 'queueStatus', 'type': 'object'}, + 'revision': {'key': 'revision', 'type': 'int'}, + 'type': {'key': 'type', 'type': 'object'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + '_links': {'key': '_links', 'type': 'ReferenceLinks'}, + 'authored_by': {'key': 'authoredBy', 'type': 'IdentityRef'}, + 'draft_of': {'key': 'draftOf', 'type': 'DefinitionReference'}, + 'drafts': {'key': 'drafts', 'type': '[DefinitionReference]'}, + 'metrics': {'key': 'metrics', 'type': '[BuildMetric]'}, + 'quality': {'key': 'quality', 'type': 'object'}, + 'queue': {'key': 'queue', 'type': 'AgentPoolQueue'} + } + + def __init__(self, created_date=None, id=None, name=None, path=None, project=None, queue_status=None, revision=None, type=None, uri=None, url=None, _links=None, authored_by=None, draft_of=None, drafts=None, metrics=None, quality=None, queue=None): + super(BuildDefinitionReference3_2, self).__init__(created_date=created_date, id=id, name=name, path=path, project=project, queue_status=queue_status, revision=revision, type=type, uri=uri, url=url) + self._links = _links + self.authored_by = authored_by + self.draft_of = draft_of + self.drafts = drafts + self.metrics = metrics + self.quality = quality + self.queue = queue + + +class BuildLog(BuildLogReference): + """ + Represents a build log. + + :param id: The ID of the log. + :type id: int + :param type: The type of the log location. + :type type: str + :param url: A full link to the log resource. + :type url: str + :param created_on: The date and time the log was created. + :type created_on: datetime + :param last_changed_on: The date and time the log was last changed. + :type last_changed_on: datetime + :param line_count: The number of lines in the log. + :type line_count: long + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'type': {'key': 'type', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'created_on': {'key': 'createdOn', 'type': 'iso-8601'}, + 'last_changed_on': {'key': 'lastChangedOn', 'type': 'iso-8601'}, + 'line_count': {'key': 'lineCount', 'type': 'long'} + } + + def __init__(self, id=None, type=None, url=None, created_on=None, last_changed_on=None, line_count=None): + super(BuildLog, self).__init__(id=id, type=type, url=url) + self.created_on = created_on + self.last_changed_on = last_changed_on + self.line_count = line_count + + +class BuildOptionDefinition(BuildOptionDefinitionReference): + """ + Represents an optional behavior that can be applied to a build definition. + + :param id: The ID of the referenced build option. + :type id: str + :param description: The description. + :type description: str + :param groups: The list of input groups defined for the build option. + :type groups: list of :class:`BuildOptionGroupDefinition ` + :param inputs: The list of inputs defined for the build option. + :type inputs: list of :class:`BuildOptionInputDefinition ` + :param name: The name of the build option. + :type name: str + :param ordinal: A value that indicates the relative order in which the behavior should be applied. + :type ordinal: int + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'groups': {'key': 'groups', 'type': '[BuildOptionGroupDefinition]'}, + 'inputs': {'key': 'inputs', 'type': '[BuildOptionInputDefinition]'}, + 'name': {'key': 'name', 'type': 'str'}, + 'ordinal': {'key': 'ordinal', 'type': 'int'} + } + + def __init__(self, id=None, description=None, groups=None, inputs=None, name=None, ordinal=None): + super(BuildOptionDefinition, self).__init__(id=id) + self.description = description + self.groups = groups + self.inputs = inputs + self.name = name + self.ordinal = ordinal + + +class Timeline(TimelineReference): + """ + Represents the timeline of a build. + + :param change_id: The change ID. + :type change_id: int + :param id: The ID of the timeline. + :type id: str + :param url: The REST URL of the timeline. + :type url: str + :param last_changed_by: The process or person that last changed the timeline. + :type last_changed_by: str + :param last_changed_on: The time the timeline was last changed. + :type last_changed_on: datetime + :param records: + :type records: list of :class:`TimelineRecord ` + """ + + _attribute_map = { + 'change_id': {'key': 'changeId', 'type': 'int'}, + 'id': {'key': 'id', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'last_changed_by': {'key': 'lastChangedBy', 'type': 'str'}, + 'last_changed_on': {'key': 'lastChangedOn', 'type': 'iso-8601'}, + 'records': {'key': 'records', 'type': '[TimelineRecord]'} + } + + def __init__(self, change_id=None, id=None, url=None, last_changed_by=None, last_changed_on=None, records=None): + super(Timeline, self).__init__(change_id=change_id, id=id, url=url) + self.last_changed_by = last_changed_by + self.last_changed_on = last_changed_on + self.records = records + + +class VariableGroup(VariableGroupReference): + """ + Represents a variable group. + + :param alias: The Name of the variable group. + :type alias: str + :param id: The ID of the variable group. + :type id: int + :param description: The description. + :type description: str + :param name: The name of the variable group. + :type name: str + :param type: The type of the variable group. + :type type: str + :param variables: + :type variables: dict + """ + + _attribute_map = { + 'alias': {'key': 'alias', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'int'}, + 'description': {'key': 'description', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'variables': {'key': 'variables', 'type': '{BuildDefinitionVariable}'} + } + + def __init__(self, alias=None, id=None, description=None, name=None, type=None, variables=None): + super(VariableGroup, self).__init__(alias=alias, id=id) + self.description = description + self.name = name + self.type = type + self.variables = variables + + +class BuildDefinition(BuildDefinitionReference): + """ + Represents a build definition. + + :param created_date: The date this version of the definition was created. + :type created_date: datetime + :param id: The ID of the referenced definition. + :type id: int + :param name: The name of the referenced definition. + :type name: str + :param path: The folder path of the definition. + :type path: str + :param project: A reference to the project. + :type project: :class:`TeamProjectReference ` + :param queue_status: A value that indicates whether builds can be queued against this definition. + :type queue_status: object + :param revision: The definition revision number. + :type revision: int + :param type: The type of the definition. + :type type: object + :param uri: The definition's URI. + :type uri: str + :param url: The REST URL of the definition. + :type url: str + :param _links: + :type _links: :class:`ReferenceLinks ` + :param authored_by: The author of the definition. + :type authored_by: :class:`IdentityRef ` + :param draft_of: A reference to the definition that this definition is a draft of, if this is a draft definition. + :type draft_of: :class:`DefinitionReference ` + :param drafts: The list of drafts associated with this definition, if this is not a draft definition. + :type drafts: list of :class:`DefinitionReference ` + :param latest_build: + :type latest_build: :class:`Build ` + :param latest_completed_build: + :type latest_completed_build: :class:`Build ` + :param metrics: + :type metrics: list of :class:`BuildMetric ` + :param quality: The quality of the definition document (draft, etc.) + :type quality: object + :param queue: The default queue for builds run against this definition. + :type queue: :class:`AgentPoolQueue ` + :param badge_enabled: Indicates whether badges are enabled for this definition. + :type badge_enabled: bool + :param build_number_format: The build number format. + :type build_number_format: str + :param comment: A save-time comment for the definition. + :type comment: str + :param demands: + :type demands: list of :class:`object ` + :param description: The description. + :type description: str + :param drop_location: The drop location for the definition. + :type drop_location: str + :param job_authorization_scope: The job authorization scope for builds queued against this definition. + :type job_authorization_scope: object + :param job_cancel_timeout_in_minutes: The job cancel timeout (in minutes) for builds cancelled by user for this definition. + :type job_cancel_timeout_in_minutes: int + :param job_timeout_in_minutes: The job execution timeout (in minutes) for builds queued against this definition. + :type job_timeout_in_minutes: int + :param options: + :type options: list of :class:`BuildOption ` + :param process: The build process. + :type process: :class:`object ` + :param process_parameters: The process parameters for this definition. + :type process_parameters: :class:`ProcessParameters ` + :param properties: + :type properties: :class:`object ` + :param repository: The repository. + :type repository: :class:`BuildRepository ` + :param retention_rules: + :type retention_rules: list of :class:`RetentionPolicy ` + :param tags: + :type tags: list of str + :param triggers: + :type triggers: list of :class:`object ` + :param variable_groups: + :type variable_groups: list of :class:`VariableGroup ` + :param variables: + :type variables: dict + """ + + _attribute_map = { + 'created_date': {'key': 'createdDate', 'type': 'iso-8601'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, + 'project': {'key': 'project', 'type': 'TeamProjectReference'}, + 'queue_status': {'key': 'queueStatus', 'type': 'object'}, + 'revision': {'key': 'revision', 'type': 'int'}, + 'type': {'key': 'type', 'type': 'object'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + '_links': {'key': '_links', 'type': 'ReferenceLinks'}, + 'authored_by': {'key': 'authoredBy', 'type': 'IdentityRef'}, + 'draft_of': {'key': 'draftOf', 'type': 'DefinitionReference'}, + 'drafts': {'key': 'drafts', 'type': '[DefinitionReference]'}, + 'latest_build': {'key': 'latestBuild', 'type': 'Build'}, + 'latest_completed_build': {'key': 'latestCompletedBuild', 'type': 'Build'}, + 'metrics': {'key': 'metrics', 'type': '[BuildMetric]'}, + 'quality': {'key': 'quality', 'type': 'object'}, + 'queue': {'key': 'queue', 'type': 'AgentPoolQueue'}, + 'badge_enabled': {'key': 'badgeEnabled', 'type': 'bool'}, + 'build_number_format': {'key': 'buildNumberFormat', 'type': 'str'}, + 'comment': {'key': 'comment', 'type': 'str'}, + 'demands': {'key': 'demands', 'type': '[object]'}, + 'description': {'key': 'description', 'type': 'str'}, + 'drop_location': {'key': 'dropLocation', 'type': 'str'}, + 'job_authorization_scope': {'key': 'jobAuthorizationScope', 'type': 'object'}, + 'job_cancel_timeout_in_minutes': {'key': 'jobCancelTimeoutInMinutes', 'type': 'int'}, + 'job_timeout_in_minutes': {'key': 'jobTimeoutInMinutes', 'type': 'int'}, + 'options': {'key': 'options', 'type': '[BuildOption]'}, + 'process': {'key': 'process', 'type': 'object'}, + 'process_parameters': {'key': 'processParameters', 'type': 'ProcessParameters'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'repository': {'key': 'repository', 'type': 'BuildRepository'}, + 'retention_rules': {'key': 'retentionRules', 'type': '[RetentionPolicy]'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + 'triggers': {'key': 'triggers', 'type': '[object]'}, + 'variable_groups': {'key': 'variableGroups', 'type': '[VariableGroup]'}, + 'variables': {'key': 'variables', 'type': '{BuildDefinitionVariable}'} + } + + def __init__(self, created_date=None, id=None, name=None, path=None, project=None, queue_status=None, revision=None, type=None, uri=None, url=None, _links=None, authored_by=None, draft_of=None, drafts=None, latest_build=None, latest_completed_build=None, metrics=None, quality=None, queue=None, badge_enabled=None, build_number_format=None, comment=None, demands=None, description=None, drop_location=None, job_authorization_scope=None, job_cancel_timeout_in_minutes=None, job_timeout_in_minutes=None, options=None, process=None, process_parameters=None, properties=None, repository=None, retention_rules=None, tags=None, triggers=None, variable_groups=None, variables=None): + super(BuildDefinition, self).__init__(created_date=created_date, id=id, name=name, path=path, project=project, queue_status=queue_status, revision=revision, type=type, uri=uri, url=url, _links=_links, authored_by=authored_by, draft_of=draft_of, drafts=drafts, latest_build=latest_build, latest_completed_build=latest_completed_build, metrics=metrics, quality=quality, queue=queue) + self.badge_enabled = badge_enabled + self.build_number_format = build_number_format + self.comment = comment + self.demands = demands + self.description = description + self.drop_location = drop_location + self.job_authorization_scope = job_authorization_scope + self.job_cancel_timeout_in_minutes = job_cancel_timeout_in_minutes + self.job_timeout_in_minutes = job_timeout_in_minutes + self.options = options + self.process = process + self.process_parameters = process_parameters + self.properties = properties + self.repository = repository + self.retention_rules = retention_rules + self.tags = tags + self.triggers = triggers + self.variable_groups = variable_groups + self.variables = variables + + +class BuildDefinition3_2(BuildDefinitionReference3_2): + """ + For back-compat with extensions that use the old Steps format instead of Process and Phases + + :param created_date: The date this version of the definition was created. + :type created_date: datetime + :param id: The ID of the referenced definition. + :type id: int + :param name: The name of the referenced definition. + :type name: str + :param path: The folder path of the definition. + :type path: str + :param project: A reference to the project. + :type project: :class:`TeamProjectReference ` + :param queue_status: A value that indicates whether builds can be queued against this definition. + :type queue_status: object + :param revision: The definition revision number. + :type revision: int + :param type: The type of the definition. + :type type: object + :param uri: The definition's URI. + :type uri: str + :param url: The REST URL of the definition. + :type url: str + :param _links: + :type _links: :class:`ReferenceLinks ` + :param authored_by: The author of the definition. + :type authored_by: :class:`IdentityRef ` + :param draft_of: A reference to the definition that this definition is a draft of, if this is a draft definition. + :type draft_of: :class:`DefinitionReference ` + :param drafts: The list of drafts associated with this definition, if this is not a draft definition. + :type drafts: list of :class:`DefinitionReference ` + :param metrics: + :type metrics: list of :class:`BuildMetric ` + :param quality: The quality of the definition document (draft, etc.) + :type quality: object + :param queue: The default queue for builds run against this definition. + :type queue: :class:`AgentPoolQueue ` + :param badge_enabled: Indicates whether badges are enabled for this definition + :type badge_enabled: bool + :param build: + :type build: list of :class:`BuildDefinitionStep ` + :param build_number_format: The build number format + :type build_number_format: str + :param comment: The comment entered when saving the definition + :type comment: str + :param demands: + :type demands: list of :class:`object ` + :param description: The description + :type description: str + :param drop_location: The drop location for the definition + :type drop_location: str + :param job_authorization_scope: The job authorization scope for builds which are queued against this definition + :type job_authorization_scope: object + :param job_cancel_timeout_in_minutes: The job cancel timeout in minutes for builds which are cancelled by user for this definition + :type job_cancel_timeout_in_minutes: int + :param job_timeout_in_minutes: The job execution timeout in minutes for builds which are queued against this definition + :type job_timeout_in_minutes: int + :param latest_build: + :type latest_build: :class:`Build ` + :param latest_completed_build: + :type latest_completed_build: :class:`Build ` + :param options: + :type options: list of :class:`BuildOption ` + :param process_parameters: Process Parameters + :type process_parameters: :class:`ProcessParameters ` + :param properties: + :type properties: :class:`object ` + :param repository: The repository + :type repository: :class:`BuildRepository ` + :param retention_rules: + :type retention_rules: list of :class:`RetentionPolicy ` + :param tags: + :type tags: list of str + :param triggers: + :type triggers: list of :class:`object ` + :param variables: + :type variables: dict + """ + + _attribute_map = { + 'created_date': {'key': 'createdDate', 'type': 'iso-8601'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, + 'project': {'key': 'project', 'type': 'TeamProjectReference'}, + 'queue_status': {'key': 'queueStatus', 'type': 'object'}, + 'revision': {'key': 'revision', 'type': 'int'}, + 'type': {'key': 'type', 'type': 'object'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + '_links': {'key': '_links', 'type': 'ReferenceLinks'}, + 'authored_by': {'key': 'authoredBy', 'type': 'IdentityRef'}, + 'draft_of': {'key': 'draftOf', 'type': 'DefinitionReference'}, + 'drafts': {'key': 'drafts', 'type': '[DefinitionReference]'}, + 'metrics': {'key': 'metrics', 'type': '[BuildMetric]'}, + 'quality': {'key': 'quality', 'type': 'object'}, + 'queue': {'key': 'queue', 'type': 'AgentPoolQueue'}, + 'badge_enabled': {'key': 'badgeEnabled', 'type': 'bool'}, + 'build': {'key': 'build', 'type': '[BuildDefinitionStep]'}, + 'build_number_format': {'key': 'buildNumberFormat', 'type': 'str'}, + 'comment': {'key': 'comment', 'type': 'str'}, + 'demands': {'key': 'demands', 'type': '[object]'}, + 'description': {'key': 'description', 'type': 'str'}, + 'drop_location': {'key': 'dropLocation', 'type': 'str'}, + 'job_authorization_scope': {'key': 'jobAuthorizationScope', 'type': 'object'}, + 'job_cancel_timeout_in_minutes': {'key': 'jobCancelTimeoutInMinutes', 'type': 'int'}, + 'job_timeout_in_minutes': {'key': 'jobTimeoutInMinutes', 'type': 'int'}, + 'latest_build': {'key': 'latestBuild', 'type': 'Build'}, + 'latest_completed_build': {'key': 'latestCompletedBuild', 'type': 'Build'}, + 'options': {'key': 'options', 'type': '[BuildOption]'}, + 'process_parameters': {'key': 'processParameters', 'type': 'ProcessParameters'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'repository': {'key': 'repository', 'type': 'BuildRepository'}, + 'retention_rules': {'key': 'retentionRules', 'type': '[RetentionPolicy]'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + 'triggers': {'key': 'triggers', 'type': '[object]'}, + 'variables': {'key': 'variables', 'type': '{BuildDefinitionVariable}'} + } + + def __init__(self, created_date=None, id=None, name=None, path=None, project=None, queue_status=None, revision=None, type=None, uri=None, url=None, _links=None, authored_by=None, draft_of=None, drafts=None, metrics=None, quality=None, queue=None, badge_enabled=None, build=None, build_number_format=None, comment=None, demands=None, description=None, drop_location=None, job_authorization_scope=None, job_cancel_timeout_in_minutes=None, job_timeout_in_minutes=None, latest_build=None, latest_completed_build=None, options=None, process_parameters=None, properties=None, repository=None, retention_rules=None, tags=None, triggers=None, variables=None): + super(BuildDefinition3_2, self).__init__(created_date=created_date, id=id, name=name, path=path, project=project, queue_status=queue_status, revision=revision, type=type, uri=uri, url=url, _links=_links, authored_by=authored_by, draft_of=draft_of, drafts=drafts, metrics=metrics, quality=quality, queue=queue) + self.badge_enabled = badge_enabled + self.build = build + self.build_number_format = build_number_format + self.comment = comment + self.demands = demands + self.description = description + self.drop_location = drop_location + self.job_authorization_scope = job_authorization_scope + self.job_cancel_timeout_in_minutes = job_cancel_timeout_in_minutes + self.job_timeout_in_minutes = job_timeout_in_minutes + self.latest_build = latest_build + self.latest_completed_build = latest_completed_build + self.options = options + self.process_parameters = process_parameters + self.properties = properties + self.repository = repository + self.retention_rules = retention_rules + self.tags = tags + self.triggers = triggers + self.variables = variables + + +__all__ = [ + 'AgentPoolQueue', + 'AgentSpecification', + 'AggregatedResultsAnalysis', + 'AggregatedResultsByOutcome', + 'AggregatedResultsDifference', + 'AggregatedRunsByOutcome', + 'AggregatedRunsByState', + 'ArtifactResource', + 'AssociatedWorkItem', + 'Attachment', + 'AuthorizationHeader', + 'Build', + 'BuildArtifact', + 'BuildBadge', + 'BuildDefinitionRevision', + 'BuildDefinitionStep', + 'BuildDefinitionTemplate', + 'BuildDefinitionTemplate3_2', + 'BuildDefinitionVariable', + 'BuildLogReference', + 'BuildMetric', + 'BuildOption', + 'BuildOptionDefinitionReference', + 'BuildOptionGroupDefinition', + 'BuildOptionInputDefinition', + 'BuildReportMetadata', + 'BuildRepository', + 'BuildRequestValidationResult', + 'BuildResourceUsage', + 'BuildSettings', + 'Change', + 'DataSourceBindingBase', + 'DefinitionReference', + 'DefinitionResourceReference', + 'Deployment', + 'Folder', + 'GraphSubjectBase', + 'IdentityRef', + 'Issue', + 'JsonPatchOperation', + 'ProcessParameters', + 'PullRequest', + 'ReferenceLinks', + 'ReleaseReference', + 'RepositoryWebhook', + 'ResourceRef', + 'RetentionPolicy', + 'SourceProviderAttributes', + 'SourceRepositories', + 'SourceRepository', + 'SourceRepositoryItem', + 'SupportedTrigger', + 'TaskAgentPoolReference', + 'TaskDefinitionReference', + 'TaskInputDefinitionBase', + 'TaskInputValidation', + 'TaskOrchestrationPlanReference', + 'TaskReference', + 'TaskSourceDefinitionBase', + 'TeamProjectReference', + 'TestResultsContext', + 'TimelineAttempt', + 'TimelineRecord', + 'TimelineReference', + 'VariableGroupReference', + 'WebApiConnectedServiceRef', + 'XamlBuildControllerReference', + 'BuildController', + 'BuildDefinitionReference', + 'BuildDefinitionReference3_2', + 'BuildLog', + 'BuildOptionDefinition', + 'Timeline', + 'VariableGroup', + 'BuildDefinition', + 'BuildDefinition3_2', +] diff --git a/azure-devops/azure/devops/v5_1/cix/__init__.py b/azure-devops/azure/devops/v5_1/cix/__init__.py new file mode 100644 index 00000000..b654a5ef --- /dev/null +++ b/azure-devops/azure/devops/v5_1/cix/__init__.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# 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 .cix_client import CixClient + +__all__ = [ + 'ConfigurationFile', + 'CreatedResources', + 'CreatePipelineConnectionInputs', + 'DetectedBuildFramework', + 'DetectedBuildTarget', + 'Operation', + 'OperationReference', + 'OperationResultReference', + 'PipelineConnection', + 'ReferenceLinks', + 'ResourceCreationParameter', + 'TeamProject', + 'TeamProjectReference', + 'Template', + 'TemplateAsset', + 'TemplateDataSourceBinding', + 'TemplateParameterDefinition', + 'TemplateParameters', + 'WebApiTeamRef', + 'CixClient' +] diff --git a/azure-devops/azure/devops/v5_1/cix/cix_client.py b/azure-devops/azure/devops/v5_1/cix/cix_client.py new file mode 100644 index 00000000..f6e35ae1 --- /dev/null +++ b/azure-devops/azure/devops/v5_1/cix/cix_client.py @@ -0,0 +1,171 @@ +# -------------------------------------------------------------------------------------------- +# 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 CixClient(Client): + """Cix + :param str base_url: Service URL + :param Authentication creds: Authenticated credentials. + """ + + def __init__(self, base_url=None, creds=None): + super(CixClient, 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 = None + + def get_configurations(self, project, repository_type=None, repository_id=None, branch=None, service_connection_id=None): + """GetConfigurations. + [Preview API] Gets a list of existing configuration files for the given repository. + :param str project: Project ID or project name + :param str repository_type: The type of the repository such as GitHub, TfsGit (i.e. Azure Repos), Bitbucket, etc. + :param str repository_id: The vendor-specific identifier or the name of the repository, e.g. Microsoft/vscode (GitHub) or e9d82045-ddba-4e01-a63d-2ab9f040af62 (Azure Repos) + :param str branch: The repository branch where to look for the configuration file. + :param str service_connection_id: If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TfsGit (i.e. Azure Repos). + :rtype: [ConfigurationFile] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if repository_type is not None: + query_parameters['repositoryType'] = self._serialize.query('repository_type', repository_type, 'str') + if repository_id is not None: + query_parameters['repositoryId'] = self._serialize.query('repository_id', repository_id, 'str') + if branch is not None: + query_parameters['branch'] = self._serialize.query('branch', branch, 'str') + if service_connection_id is not None: + query_parameters['serviceConnectionId'] = self._serialize.query('service_connection_id', service_connection_id, 'str') + response = self._send(http_method='GET', + location_id='8fc87684-9ebc-4c37-ab92-f4ac4a58cb3a', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[ConfigurationFile]', self._unwrap_collection(response)) + + def create_project_connection(self, create_connection_inputs, project): + """CreateProjectConnection. + [Preview API] Creates a new Pipeline connection between the provider installation and the specified project. Returns the PipelineConnection object created. + :param :class:` ` create_connection_inputs: + :param str project: + :rtype: :class:` ` + """ + query_parameters = {} + if project is not None: + query_parameters['project'] = self._serialize.query('project', project, 'str') + content = self._serialize.body(create_connection_inputs, 'CreatePipelineConnectionInputs') + response = self._send(http_method='POST', + location_id='00df4879-9216-45d5-b38d-4a487b626b2c', + version='5.1-preview.1', + query_parameters=query_parameters, + content=content) + return self._deserialize('PipelineConnection', response) + + def get_detected_build_frameworks(self, project, repository_type=None, repository_id=None, branch=None, detection_type=None, service_connection_id=None): + """GetDetectedBuildFrameworks. + [Preview API] Returns a list of build frameworks that best match the given repository based on its contents. + :param str project: Project ID or project name + :param str repository_type: The type of the repository such as GitHub, TfsGit (i.e. Azure Repos), Bitbucket, etc. + :param str repository_id: The vendor-specific identifier or the name of the repository, e.g. Microsoft/vscode (GitHub) or e9d82045-ddba-4e01-a63d-2ab9f040af62 (Azure Repos) + :param str branch: The repository branch to detect build frameworks for. + :param str detection_type: + :param str service_connection_id: If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TfsGit (i.e. Azure Repos). + :rtype: [DetectedBuildFramework] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if repository_type is not None: + query_parameters['repositoryType'] = self._serialize.query('repository_type', repository_type, 'str') + if repository_id is not None: + query_parameters['repositoryId'] = self._serialize.query('repository_id', repository_id, 'str') + if branch is not None: + query_parameters['branch'] = self._serialize.query('branch', branch, 'str') + if detection_type is not None: + query_parameters['detectionType'] = self._serialize.query('detection_type', detection_type, 'str') + if service_connection_id is not None: + query_parameters['serviceConnectionId'] = self._serialize.query('service_connection_id', service_connection_id, 'str') + response = self._send(http_method='GET', + location_id='29a30bab-9efb-4652-bf1b-9269baca0980', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[DetectedBuildFramework]', self._unwrap_collection(response)) + + def get_template_recommendations(self, project, repository_type=None, repository_id=None, branch=None, service_connection_id=None): + """GetTemplateRecommendations. + [Preview API] Returns a list of all YAML templates with weighting based on which would best fit the given repository. + :param str project: Project ID or project name + :param str repository_type: The type of the repository such as GitHub, TfsGit (i.e. Azure Repos), Bitbucket, etc. + :param str repository_id: The vendor-specific identifier or the name of the repository, e.g. Microsoft/vscode (GitHub) or e9d82045-ddba-4e01-a63d-2ab9f040af62 (Azure Repos) + :param str branch: The repository branch which to find matching templates for. + :param str service_connection_id: If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TfsGit (i.e. Azure Repos). + :rtype: [Template] + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + query_parameters = {} + if repository_type is not None: + query_parameters['repositoryType'] = self._serialize.query('repository_type', repository_type, 'str') + if repository_id is not None: + query_parameters['repositoryId'] = self._serialize.query('repository_id', repository_id, 'str') + if branch is not None: + query_parameters['branch'] = self._serialize.query('branch', branch, 'str') + if service_connection_id is not None: + query_parameters['serviceConnectionId'] = self._serialize.query('service_connection_id', service_connection_id, 'str') + response = self._send(http_method='GET', + location_id='63ea8f13-b563-4be7-bc31-3a96eda27220', + version='5.1-preview.1', + route_values=route_values, + query_parameters=query_parameters) + return self._deserialize('[Template]', self._unwrap_collection(response)) + + def create_resources(self, creation_parameters, project): + """CreateResources. + [Preview API] + :param {ResourceCreationParameter} creation_parameters: + :param str project: Project ID or project name + :rtype: :class:` ` + """ + route_values = {} + if project is not None: + route_values['project'] = self._serialize.url('project', project, 'str') + content = self._serialize.body(creation_parameters, '{ResourceCreationParameter}') + response = self._send(http_method='POST', + location_id='43201899-7690-4870-9c79-ab69605f21ed', + version='5.1-preview.1', + route_values=route_values, + content=content) + return self._deserialize('CreatedResources', response) + + def render_template(self, template_parameters, template_id): + """RenderTemplate. + [Preview API] + :param :class:` ` template_parameters: + :param str template_id: + :rtype: :class:`