Skip to content

Commit db587a2

Browse files
authored
Merge pull request #97 from Microsoft/dev
Add Members Entitlement Management to manage users
2 parents eacd6a3 + 6244ecd commit db587a2

File tree

76 files changed

+2881
-691
lines changed

Some content is hidden

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

76 files changed

+2881
-691
lines changed

vsts/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from setuptools import setup, find_packages
77

88
NAME = "vsts"
9-
VERSION = "0.1.10"
9+
VERSION = "0.1.11"
1010

1111
# To install the library, run the following
1212
#
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
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+
# Generated file, DO NOT EDIT
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------------------------
8+
9+
from msrest import Serializer, Deserializer
10+
from ...vss_client import VssClient
11+
from . import models
12+
13+
14+
class MemberEntitlementManagementClient(VssClient):
15+
"""MemberEntitlementManagement
16+
:param str base_url: Service URL
17+
:param Authentication creds: Authenticated credentials.
18+
"""
19+
20+
def __init__(self, base_url=None, creds=None):
21+
super(MemberEntitlementManagementClient, self).__init__(base_url, creds)
22+
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
23+
self._serialize = Serializer(client_models)
24+
self._deserialize = Deserializer(client_models)
25+
26+
resource_area_identifier = None
27+
28+
def add_group_entitlement(self, group_entitlement, rule_option=None):
29+
"""AddGroupEntitlement.
30+
[Preview API] Used to add members to a project in an account. It adds them to groups, assigns licenses, and assigns extensions.
31+
:param :class:`<GroupEntitlement> <member-entitlement-management.v4_0.models.GroupEntitlement>` group_entitlement: Member model for where to add the member and what licenses and extensions they should receive.
32+
:param str rule_option:
33+
:rtype: :class:`<GroupEntitlementOperationReference> <member-entitlement-management.v4_0.models.GroupEntitlementOperationReference>`
34+
"""
35+
query_parameters = {}
36+
if rule_option is not None:
37+
query_parameters['ruleOption'] = self._serialize.query('rule_option', rule_option, 'str')
38+
content = self._serialize.body(group_entitlement, 'GroupEntitlement')
39+
response = self._send(http_method='POST',
40+
location_id='ec7fb08f-5dcc-481c-9bf6-122001b1caa6',
41+
version='4.0-preview.1',
42+
query_parameters=query_parameters,
43+
content=content)
44+
return self._deserialize('GroupEntitlementOperationReference', response)
45+
46+
def delete_group_entitlement(self, group_id, rule_option=None):
47+
"""DeleteGroupEntitlement.
48+
[Preview API] Deletes members from an account
49+
:param str group_id: memberId of the member to be removed.
50+
:param str rule_option:
51+
:rtype: :class:`<GroupEntitlementOperationReference> <member-entitlement-management.v4_0.models.GroupEntitlementOperationReference>`
52+
"""
53+
route_values = {}
54+
if group_id is not None:
55+
route_values['groupId'] = self._serialize.url('group_id', group_id, 'str')
56+
query_parameters = {}
57+
if rule_option is not None:
58+
query_parameters['ruleOption'] = self._serialize.query('rule_option', rule_option, 'str')
59+
response = self._send(http_method='DELETE',
60+
location_id='ec7fb08f-5dcc-481c-9bf6-122001b1caa6',
61+
version='4.0-preview.1',
62+
route_values=route_values,
63+
query_parameters=query_parameters)
64+
return self._deserialize('GroupEntitlementOperationReference', response)
65+
66+
def get_group_entitlement(self, group_id):
67+
"""GetGroupEntitlement.
68+
[Preview API] Used to get a group entitlement and its current rules
69+
:param str group_id:
70+
:rtype: :class:`<GroupEntitlement> <member-entitlement-management.v4_0.models.GroupEntitlement>`
71+
"""
72+
route_values = {}
73+
if group_id is not None:
74+
route_values['groupId'] = self._serialize.url('group_id', group_id, 'str')
75+
response = self._send(http_method='GET',
76+
location_id='ec7fb08f-5dcc-481c-9bf6-122001b1caa6',
77+
version='4.0-preview.1',
78+
route_values=route_values)
79+
return self._deserialize('GroupEntitlement', response)
80+
81+
def get_group_entitlements(self):
82+
"""GetGroupEntitlements.
83+
[Preview API] Used to get group entitlement information in an account
84+
:rtype: [GroupEntitlement]
85+
"""
86+
response = self._send(http_method='GET',
87+
location_id='ec7fb08f-5dcc-481c-9bf6-122001b1caa6',
88+
version='4.0-preview.1',
89+
returns_collection=True)
90+
return self._deserialize('[GroupEntitlement]', response)
91+
92+
def update_group_entitlement(self, document, group_id, rule_option=None):
93+
"""UpdateGroupEntitlement.
94+
[Preview API] Used to edit a member in an account. Edits groups, licenses, and extensions.
95+
:param :class:`<[JsonPatchOperation]> <member-entitlement-management.v4_0.models.[JsonPatchOperation]>` document: document of operations to be used
96+
:param str group_id: member Id of the member to be edit
97+
:param str rule_option:
98+
:rtype: :class:`<GroupEntitlementOperationReference> <member-entitlement-management.v4_0.models.GroupEntitlementOperationReference>`
99+
"""
100+
route_values = {}
101+
if group_id is not None:
102+
route_values['groupId'] = self._serialize.url('group_id', group_id, 'str')
103+
query_parameters = {}
104+
if rule_option is not None:
105+
query_parameters['ruleOption'] = self._serialize.query('rule_option', rule_option, 'str')
106+
content = self._serialize.body(document, '[JsonPatchOperation]')
107+
response = self._send(http_method='PATCH',
108+
location_id='ec7fb08f-5dcc-481c-9bf6-122001b1caa6',
109+
version='4.0-preview.1',
110+
route_values=route_values,
111+
query_parameters=query_parameters,
112+
content=content,
113+
media_type='application/json-patch+json')
114+
return self._deserialize('GroupEntitlementOperationReference', response)
115+
116+
def add_member_entitlement(self, member_entitlement):
117+
"""AddMemberEntitlement.
118+
[Preview API] Used to add members to a project in an account. It adds them to project groups, assigns licenses, and assigns extensions.
119+
:param :class:`<MemberEntitlement> <member-entitlement-management.v4_0.models.MemberEntitlement>` member_entitlement: Member model for where to add the member and what licenses and extensions they should receive.
120+
:rtype: :class:`<MemberEntitlementsPostResponse> <member-entitlement-management.v4_0.models.MemberEntitlementsPostResponse>`
121+
"""
122+
content = self._serialize.body(member_entitlement, 'MemberEntitlement')
123+
response = self._send(http_method='POST',
124+
location_id='1e8cabfb-1fda-461e-860f-eeeae54d06bb',
125+
version='4.0-preview.1',
126+
content=content)
127+
return self._deserialize('MemberEntitlementsPostResponse', response)
128+
129+
def delete_member_entitlement(self, member_id):
130+
"""DeleteMemberEntitlement.
131+
[Preview API] Deletes members from an account
132+
:param str member_id: memberId of the member to be removed.
133+
"""
134+
route_values = {}
135+
if member_id is not None:
136+
route_values['memberId'] = self._serialize.url('member_id', member_id, 'str')
137+
self._send(http_method='DELETE',
138+
location_id='1e8cabfb-1fda-461e-860f-eeeae54d06bb',
139+
version='4.0-preview.1',
140+
route_values=route_values)
141+
142+
def get_member_entitlement(self, member_id):
143+
"""GetMemberEntitlement.
144+
[Preview API] Used to get member entitlement information in an account
145+
:param str member_id:
146+
:rtype: :class:`<MemberEntitlement> <member-entitlement-management.v4_0.models.MemberEntitlement>`
147+
"""
148+
route_values = {}
149+
if member_id is not None:
150+
route_values['memberId'] = self._serialize.url('member_id', member_id, 'str')
151+
response = self._send(http_method='GET',
152+
location_id='1e8cabfb-1fda-461e-860f-eeeae54d06bb',
153+
version='4.0-preview.1',
154+
route_values=route_values)
155+
return self._deserialize('MemberEntitlement', response)
156+
157+
def get_member_entitlements(self, top, skip, filter=None, select=None):
158+
"""GetMemberEntitlements.
159+
[Preview API] Used to get member entitlement information in an account
160+
:param int top:
161+
:param int skip:
162+
:param str filter:
163+
:param str select:
164+
:rtype: [MemberEntitlement]
165+
"""
166+
query_parameters = {}
167+
if top is not None:
168+
query_parameters['top'] = self._serialize.query('top', top, 'int')
169+
if skip is not None:
170+
query_parameters['skip'] = self._serialize.query('skip', skip, 'int')
171+
if filter is not None:
172+
query_parameters['filter'] = self._serialize.query('filter', filter, 'str')
173+
if select is not None:
174+
query_parameters['select'] = self._serialize.query('select', select, 'str')
175+
response = self._send(http_method='GET',
176+
location_id='1e8cabfb-1fda-461e-860f-eeeae54d06bb',
177+
version='4.0-preview.1',
178+
query_parameters=query_parameters,
179+
returns_collection=True)
180+
return self._deserialize('[MemberEntitlement]', response)
181+
182+
def update_member_entitlement(self, document, member_id):
183+
"""UpdateMemberEntitlement.
184+
[Preview API] Used to edit a member in an account. Edits groups, licenses, and extensions.
185+
:param :class:`<[JsonPatchOperation]> <member-entitlement-management.v4_0.models.[JsonPatchOperation]>` document: document of operations to be used
186+
:param str member_id: member Id of the member to be edit
187+
:rtype: :class:`<MemberEntitlementsPatchResponse> <member-entitlement-management.v4_0.models.MemberEntitlementsPatchResponse>`
188+
"""
189+
route_values = {}
190+
if member_id is not None:
191+
route_values['memberId'] = self._serialize.url('member_id', member_id, 'str')
192+
content = self._serialize.body(document, '[JsonPatchOperation]')
193+
response = self._send(http_method='PATCH',
194+
location_id='1e8cabfb-1fda-461e-860f-eeeae54d06bb',
195+
version='4.0-preview.1',
196+
route_values=route_values,
197+
content=content,
198+
media_type='application/json-patch+json')
199+
return self._deserialize('MemberEntitlementsPatchResponse', response)
200+
201+
def update_member_entitlements(self, document):
202+
"""UpdateMemberEntitlements.
203+
[Preview API] Used to edit multiple members in an account. Edits groups, licenses, and extensions.
204+
:param :class:`<[JsonPatchOperation]> <member-entitlement-management.v4_0.models.[JsonPatchOperation]>` document: JsonPatch document
205+
:rtype: :class:`<MemberEntitlementOperationReference> <member-entitlement-management.v4_0.models.MemberEntitlementOperationReference>`
206+
"""
207+
content = self._serialize.body(document, '[JsonPatchOperation]')
208+
response = self._send(http_method='PATCH',
209+
location_id='1e8cabfb-1fda-461e-860f-eeeae54d06bb',
210+
version='4.0-preview.1',
211+
content=content,
212+
media_type='application/json-patch+json')
213+
return self._deserialize('MemberEntitlementOperationReference', response)
214+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
# Generated file, DO NOT EDIT
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------------------------
8+
9+
from .access_level import AccessLevel
10+
from .base_operation_result import BaseOperationResult
11+
from .extension import Extension
12+
from .graph_group import GraphGroup
13+
from .graph_member import GraphMember
14+
from .graph_subject import GraphSubject
15+
from .group import Group
16+
from .group_entitlement import GroupEntitlement
17+
from .group_entitlement_operation_reference import GroupEntitlementOperationReference
18+
from .group_operation_result import GroupOperationResult
19+
from .json_patch_operation import JsonPatchOperation
20+
from .member_entitlement import MemberEntitlement
21+
from .member_entitlement_operation_reference import MemberEntitlementOperationReference
22+
from .member_entitlements_patch_response import MemberEntitlementsPatchResponse
23+
from .member_entitlements_post_response import MemberEntitlementsPostResponse
24+
from .member_entitlements_response_base import MemberEntitlementsResponseBase
25+
from .operation_reference import OperationReference
26+
from .operation_result import OperationResult
27+
from .project_entitlement import ProjectEntitlement
28+
from .project_ref import ProjectRef
29+
from .reference_links import ReferenceLinks
30+
from .team_ref import TeamRef
31+
32+
__all__ = [
33+
'AccessLevel',
34+
'BaseOperationResult',
35+
'Extension',
36+
'GraphGroup',
37+
'GraphMember',
38+
'GraphSubject',
39+
'Group',
40+
'GroupEntitlement',
41+
'GroupEntitlementOperationReference',
42+
'GroupOperationResult',
43+
'JsonPatchOperation',
44+
'MemberEntitlement',
45+
'MemberEntitlementOperationReference',
46+
'MemberEntitlementsPatchResponse',
47+
'MemberEntitlementsPostResponse',
48+
'MemberEntitlementsResponseBase',
49+
'OperationReference',
50+
'OperationResult',
51+
'ProjectEntitlement',
52+
'ProjectRef',
53+
'ReferenceLinks',
54+
'TeamRef',
55+
]
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
# Generated file, DO NOT EDIT
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------------------------
8+
9+
from msrest.serialization import Model
10+
11+
12+
class AccessLevel(Model):
13+
"""AccessLevel.
14+
15+
:param account_license_type:
16+
:type account_license_type: object
17+
:param assignment_source:
18+
:type assignment_source: object
19+
:param license_display_name:
20+
:type license_display_name: str
21+
:param licensing_source:
22+
:type licensing_source: object
23+
:param msdn_license_type:
24+
:type msdn_license_type: object
25+
:param status:
26+
:type status: object
27+
:param status_message:
28+
:type status_message: str
29+
"""
30+
31+
_attribute_map = {
32+
'account_license_type': {'key': 'accountLicenseType', 'type': 'object'},
33+
'assignment_source': {'key': 'assignmentSource', 'type': 'object'},
34+
'license_display_name': {'key': 'licenseDisplayName', 'type': 'str'},
35+
'licensing_source': {'key': 'licensingSource', 'type': 'object'},
36+
'msdn_license_type': {'key': 'msdnLicenseType', 'type': 'object'},
37+
'status': {'key': 'status', 'type': 'object'},
38+
'status_message': {'key': 'statusMessage', 'type': 'str'}
39+
}
40+
41+
def __init__(self, account_license_type=None, assignment_source=None, license_display_name=None, licensing_source=None, msdn_license_type=None, status=None, status_message=None):
42+
super(AccessLevel, self).__init__()
43+
self.account_license_type = account_license_type
44+
self.assignment_source = assignment_source
45+
self.license_display_name = license_display_name
46+
self.licensing_source = licensing_source
47+
self.msdn_license_type = msdn_license_type
48+
self.status = status
49+
self.status_message = status_message

vsts/vsts/user/v4_1/models/mail_confirmation_parameters.py renamed to vsts/vsts/member_entitlement_management/v4_0/models/base_operation_result.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
from msrest.serialization import Model
1010

1111

12-
class MailConfirmationParameters(Model):
13-
"""MailConfirmationParameters.
12+
class BaseOperationResult(Model):
13+
"""BaseOperationResult.
1414
15-
:param challenge_code: The unique code that proves ownership of the email address.
16-
:type challenge_code: str
17-
:param mail_address: The email address to be confirmed.
18-
:type mail_address: str
15+
:param errors: List of error codes paired with their corresponding error messages
16+
:type errors: list of { key: int; value: str }
17+
:param is_success: Success status of the operation
18+
:type is_success: bool
1919
"""
2020

2121
_attribute_map = {
22-
'challenge_code': {'key': 'challengeCode', 'type': 'str'},
23-
'mail_address': {'key': 'mailAddress', 'type': 'str'}
22+
'errors': {'key': 'errors', 'type': '[{ key: int; value: str }]'},
23+
'is_success': {'key': 'isSuccess', 'type': 'bool'}
2424
}
2525

26-
def __init__(self, challenge_code=None, mail_address=None):
27-
super(MailConfirmationParameters, self).__init__()
28-
self.challenge_code = challenge_code
29-
self.mail_address = mail_address
26+
def __init__(self, errors=None, is_success=None):
27+
super(BaseOperationResult, self).__init__()
28+
self.errors = errors
29+
self.is_success = is_success

0 commit comments

Comments
 (0)