Skip to content

Commit 42a8749

Browse files
authored
Merge pull request #179 from Microsoft/dev
5.0 APIs plus refactor
2 parents ed4f2ec + 8af6e04 commit 42a8749

File tree

2,926 files changed

+163528
-150075
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,926 files changed

+163528
-150075
lines changed

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,5 +296,7 @@ __pycache__/
296296
.vscode/
297297
vsts/build/bdist.win32/
298298

299-
# don't ignore release managment client
300-
!vsts/vsts/release
299+
# don't ignore release management client
300+
!azure-devops/azure/devops/released/release
301+
!azure-devops/azure/devops/v5_0/release
302+
!azure-devops/azure/devops/v5_1/release

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
# Azure DevOps Python API
55

6-
This repository contains Python APIs for interacting with and managing Azure DevOps. These APIs power the Visual Studio Team Services CLI. To learn more about the VSTS CLI, visit the [Microsoft/vsts-cli](https://github.com/Microsoft/vsts-cli) repo.
6+
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.
77

88
## Install
99

1010
```
11-
pip install vsts
11+
pip install azure-devops
1212
```
1313

1414
## Get started
@@ -17,7 +17,7 @@ pip install vsts
1717
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.
1818

1919
```python
20-
from vsts.vss_connection import VssConnection
20+
from azure.devops.connection import Connection
2121
from msrest.authentication import BasicAuthentication
2222
import pprint
2323

@@ -27,10 +27,10 @@ organization_url = 'https://dev.azure.com/YOURORG'
2727

2828
# Create a connection to the org
2929
credentials = BasicAuthentication('', personal_access_token)
30-
connection = VssConnection(base_url=organization_url, creds=credentials)
30+
connection = Connection(base_url=organization_url, creds=credentials)
3131

3232
# Get a client (the "core" client provides access to projects, teams, etc)
33-
core_client = connection.get_client('vsts.core.v4_0.core_client.CoreClient')
33+
core_client = connection.clients.get_core_client()
3434

3535
# Get the list of projects in the org
3636
projects = core_client.get_projects()
File renamed without changes.
File renamed without changes.
File renamed without changes.

azure-devops/azure/devops/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
import pkg_resources
6+
pkg_resources.declare_namespace(__name__)

vsts/vsts/_file_cache.py renamed to azure-devops/azure/devops/_file_cache.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ def _check_for_initial_load(self):
111111

112112

113113
def get_cache_dir():
114-
vsts_cache_dir = os.getenv('VSTS_CACHE_DIR', None) or os.path.expanduser(os.path.join('~', '.vsts', 'python-sdk',
115-
'cache'))
116-
if not os.path.exists(vsts_cache_dir):
117-
os.makedirs(vsts_cache_dir)
118-
return vsts_cache_dir
114+
azure_devops_cache_dir = os.getenv('AZURE_DEVOPS_CACHE_DIR', None)\
115+
or os.path.expanduser(os.path.join('~', '.azure-devops', 'python-sdk', 'cache'))
116+
if not os.path.exists(azure_devops_cache_dir):
117+
os.makedirs(azure_devops_cache_dir)
118+
return azure_devops_cache_dir
119119

120120

121121
DEFAULT_MAX_AGE = 3600 * 12 # 12 hours

azure-devops/azure/devops/_models.py

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Generated file, DO NOT EDIT
4+
# Changes may cause incorrect behavior and will be lost if the code is
5+
# regenerated.
6+
# --------------------------------------------------------------------------
7+
8+
from msrest.serialization import Model
9+
10+
11+
class ApiResourceLocation(Model):
12+
"""ApiResourceLocation.
13+
"""
14+
15+
_attribute_map = {
16+
'id': {'key': 'id', 'type': 'str'},
17+
'area': {'key': 'area', 'type': 'str'},
18+
'resource_name': {'key': 'resourceName', 'type': 'str'},
19+
'route_template': {'key': 'routeTemplate', 'type': 'str'},
20+
'resource_version': {'key': 'resourceVersion', 'type': 'int'},
21+
'min_version': {'key': 'minVersion', 'type': 'float'},
22+
'max_version': {'key': 'maxVersion', 'type': 'float'},
23+
'released_version': {'key': 'releasedVersion', 'type': 'str'},
24+
}
25+
26+
def __init__(self, id=None, area=None, resource_name=None,
27+
route_template=None, resource_version=None,
28+
min_version=None, max_version=None,
29+
released_version=None):
30+
super(ApiResourceLocation, self).__init__()
31+
self.id = id
32+
self.area = area
33+
self.resource_name = resource_name
34+
self.route_template = route_template
35+
self.resource_version = resource_version
36+
self.min_version = min_version
37+
self.max_version = max_version
38+
self.released_version = released_version
39+
40+
41+
class CustomerIntelligenceEvent(Model):
42+
"""CustomerIntelligenceEvent.
43+
44+
:param area:
45+
:type area: str
46+
:param feature:
47+
:type feature: str
48+
:param properties:
49+
:type properties: dict
50+
"""
51+
52+
_attribute_map = {
53+
'area': {'key': 'area', 'type': 'str'},
54+
'feature': {'key': 'feature', 'type': 'str'},
55+
'properties': {'key': 'properties', 'type': '{object}'}
56+
}
57+
58+
def __init__(self, area=None, feature=None, properties=None):
59+
super(CustomerIntelligenceEvent, self).__init__()
60+
self.area = area
61+
self.feature = feature
62+
self.properties = properties
63+
64+
65+
class ImproperException(Model):
66+
"""ImproperException.
67+
:param message:
68+
:type message: str
69+
"""
70+
71+
_attribute_map = {
72+
'message': {'key': 'Message', 'type': 'str'}
73+
}
74+
75+
def __init__(self, message=None):
76+
super(ImproperException, self).__init__()
77+
self.message = message
78+
79+
80+
class ResourceAreaInfo(Model):
81+
"""ResourceAreaInfo.
82+
83+
:param id:
84+
:type id: str
85+
:param location_url:
86+
:type location_url: str
87+
:param name:
88+
:type name: str
89+
"""
90+
91+
_attribute_map = {
92+
'id': {'key': 'id', 'type': 'str'},
93+
'location_url': {'key': 'locationUrl', 'type': 'str'},
94+
'name': {'key': 'name', 'type': 'str'}
95+
}
96+
97+
def __init__(self, id=None, location_url=None, name=None):
98+
super(ResourceAreaInfo, self).__init__()
99+
self.id = id
100+
self.location_url = location_url
101+
self.name = name
102+
103+
104+
class SystemException(Model):
105+
"""SystemException.
106+
:param class_name:
107+
:type class_name: str
108+
:param inner_exception:
109+
:type inner_exception: :class:`SystemException`
110+
:param message:
111+
:type message: str
112+
"""
113+
114+
_attribute_map = {
115+
'class_name': {'key': 'ClassName', 'type': 'str'},
116+
'message': {'key': 'Message', 'type': 'str'},
117+
'inner_exception': {'key': 'InnerException', 'type': 'SystemException'}
118+
}
119+
120+
def __init__(self, class_name=None, message=None, inner_exception=None):
121+
super(SystemException, self).__init__()
122+
self.class_name = class_name
123+
self.message = message
124+
self.inner_exception = inner_exception
125+
126+
127+
class VssJsonCollectionWrapperBase(Model):
128+
"""VssJsonCollectionWrapperBase.
129+
130+
:param count:
131+
:type count: int
132+
"""
133+
134+
_attribute_map = {
135+
'count': {'key': 'count', 'type': 'int'}
136+
}
137+
138+
def __init__(self, count=None):
139+
super(VssJsonCollectionWrapperBase, self).__init__()
140+
self.count = count
141+
142+
143+
class VssJsonCollectionWrapper(VssJsonCollectionWrapperBase):
144+
"""VssJsonCollectionWrapper.
145+
146+
:param count:
147+
:type count: int
148+
:param value:
149+
:type value: object
150+
"""
151+
152+
_attribute_map = {
153+
'count': {'key': 'count', 'type': 'int'},
154+
'value': {'key': 'value', 'type': 'object'}
155+
}
156+
157+
def __init__(self, count=None, value=None):
158+
super(VssJsonCollectionWrapper, self).__init__(count=count)
159+
self.value = value
160+
161+
162+
class WrappedException(Model):
163+
"""WrappedException.
164+
:param exception_id:
165+
:type exception_id: str
166+
:param inner_exception:
167+
:type inner_exception: :class:`WrappedException`
168+
:param message:
169+
:type message: str
170+
:param type_name:
171+
:type type_name: str
172+
:param type_key:
173+
:type type_key: str
174+
:param error_code:
175+
:type error_code: int
176+
:param event_id:
177+
:type event_id: int
178+
:param custom_properties:
179+
:type custom_properties: dict
180+
"""
181+
182+
_attribute_map = {
183+
'exception_id': {'key': '$id', 'type': 'str'},
184+
'inner_exception': {'key': 'innerException', 'type': 'WrappedException'},
185+
'message': {'key': 'message', 'type': 'str'},
186+
'type_name': {'key': 'typeName', 'type': 'str'},
187+
'type_key': {'key': 'typeKey', 'type': 'str'},
188+
'error_code': {'key': 'errorCode', 'type': 'int'},
189+
'event_id': {'key': 'eventId', 'type': 'int'},
190+
'custom_properties': {'key': 'customProperties', 'type': '{object}'}
191+
}
192+
193+
def __init__(self, exception_id=None, inner_exception=None, message=None,
194+
type_name=None, type_key=None, error_code=None, event_id=None, custom_properties=None):
195+
super(WrappedException, self).__init__()
196+
self.exception_id = exception_id
197+
self.inner_exception = inner_exception
198+
self.message = message
199+
self.type_name = type_name
200+
self.type_key = type_key
201+
self.error_code = error_code
202+
self.event_id = event_id
203+
self.custom_properties = custom_properties
204+
205+
206+
__all__ = [
207+
'ApiResourceLocation',
208+
'CustomerIntelligenceEvent',
209+
'ImproperException',
210+
'ResourceAreaInfo',
211+
'SystemException',
212+
'VssJsonCollectionWrapperBase',
213+
'VssJsonCollectionWrapper',
214+
'WrappedException'
215+
]

0 commit comments

Comments
 (0)