Skip to content

add Members Entitlement Management to manage users. remove user area,… #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
# --------------------------------------------------------------------------------------------
# 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 ...vss_client import VssClient
from . import models


class MemberEntitlementManagementClient(VssClient):
"""MemberEntitlementManagement
:param str base_url: Service URL
:param Authentication creds: Authenticated credentials.
"""

def __init__(self, base_url=None, creds=None):
super(MemberEntitlementManagementClient, 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 add_group_entitlement(self, group_entitlement, rule_option=None):
"""AddGroupEntitlement.
[Preview API] Used to add members to a project in an account. It adds them to groups, assigns licenses, and assigns extensions.
: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.
:param str rule_option:
:rtype: :class:`<GroupEntitlementOperationReference> <member-entitlement-management.v4_0.models.GroupEntitlementOperationReference>`
"""
query_parameters = {}
if rule_option is not None:
query_parameters['ruleOption'] = self._serialize.query('rule_option', rule_option, 'str')
content = self._serialize.body(group_entitlement, 'GroupEntitlement')
response = self._send(http_method='POST',
location_id='ec7fb08f-5dcc-481c-9bf6-122001b1caa6',
version='4.0-preview.1',
query_parameters=query_parameters,
content=content)
return self._deserialize('GroupEntitlementOperationReference', response)

def delete_group_entitlement(self, group_id, rule_option=None):
"""DeleteGroupEntitlement.
[Preview API] Deletes members from an account
:param str group_id: memberId of the member to be removed.
:param str rule_option:
:rtype: :class:`<GroupEntitlementOperationReference> <member-entitlement-management.v4_0.models.GroupEntitlementOperationReference>`
"""
route_values = {}
if group_id is not None:
route_values['groupId'] = self._serialize.url('group_id', group_id, 'str')
query_parameters = {}
if rule_option is not None:
query_parameters['ruleOption'] = self._serialize.query('rule_option', rule_option, 'str')
response = self._send(http_method='DELETE',
location_id='ec7fb08f-5dcc-481c-9bf6-122001b1caa6',
version='4.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('GroupEntitlementOperationReference', response)

def get_group_entitlement(self, group_id):
"""GetGroupEntitlement.
[Preview API] Used to get a group entitlement and its current rules
:param str group_id:
:rtype: :class:`<GroupEntitlement> <member-entitlement-management.v4_0.models.GroupEntitlement>`
"""
route_values = {}
if group_id is not None:
route_values['groupId'] = self._serialize.url('group_id', group_id, 'str')
response = self._send(http_method='GET',
location_id='ec7fb08f-5dcc-481c-9bf6-122001b1caa6',
version='4.0-preview.1',
route_values=route_values)
return self._deserialize('GroupEntitlement', response)

def get_group_entitlements(self):
"""GetGroupEntitlements.
[Preview API] Used to get group entitlement information in an account
:rtype: [GroupEntitlement]
"""
response = self._send(http_method='GET',
location_id='ec7fb08f-5dcc-481c-9bf6-122001b1caa6',
version='4.0-preview.1',
returns_collection=True)
return self._deserialize('[GroupEntitlement]', response)

def update_group_entitlement(self, document, group_id, rule_option=None):
"""UpdateGroupEntitlement.
[Preview API] Used to edit a member in an account. Edits groups, licenses, and extensions.
:param :class:`<[JsonPatchOperation]> <member-entitlement-management.v4_0.models.[JsonPatchOperation]>` document: document of operations to be used
:param str group_id: member Id of the member to be edit
:param str rule_option:
:rtype: :class:`<GroupEntitlementOperationReference> <member-entitlement-management.v4_0.models.GroupEntitlementOperationReference>`
"""
route_values = {}
if group_id is not None:
route_values['groupId'] = self._serialize.url('group_id', group_id, 'str')
query_parameters = {}
if rule_option is not None:
query_parameters['ruleOption'] = self._serialize.query('rule_option', rule_option, 'str')
content = self._serialize.body(document, '[JsonPatchOperation]')
response = self._send(http_method='PATCH',
location_id='ec7fb08f-5dcc-481c-9bf6-122001b1caa6',
version='4.0-preview.1',
route_values=route_values,
query_parameters=query_parameters,
content=content,
media_type='application/json-patch+json')
return self._deserialize('GroupEntitlementOperationReference', response)

def add_member_entitlement(self, member_entitlement):
"""AddMemberEntitlement.
[Preview API] Used to add members to a project in an account. It adds them to project groups, assigns licenses, and assigns extensions.
: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.
:rtype: :class:`<MemberEntitlementsPostResponse> <member-entitlement-management.v4_0.models.MemberEntitlementsPostResponse>`
"""
content = self._serialize.body(member_entitlement, 'MemberEntitlement')
response = self._send(http_method='POST',
location_id='1e8cabfb-1fda-461e-860f-eeeae54d06bb',
version='4.0-preview.1',
content=content)
return self._deserialize('MemberEntitlementsPostResponse', response)

def delete_member_entitlement(self, member_id):
"""DeleteMemberEntitlement.
[Preview API] Deletes members from an account
:param str member_id: memberId of the member to be removed.
"""
route_values = {}
if member_id is not None:
route_values['memberId'] = self._serialize.url('member_id', member_id, 'str')
self._send(http_method='DELETE',
location_id='1e8cabfb-1fda-461e-860f-eeeae54d06bb',
version='4.0-preview.1',
route_values=route_values)

def get_member_entitlement(self, member_id):
"""GetMemberEntitlement.
[Preview API] Used to get member entitlement information in an account
:param str member_id:
:rtype: :class:`<MemberEntitlement> <member-entitlement-management.v4_0.models.MemberEntitlement>`
"""
route_values = {}
if member_id is not None:
route_values['memberId'] = self._serialize.url('member_id', member_id, 'str')
response = self._send(http_method='GET',
location_id='1e8cabfb-1fda-461e-860f-eeeae54d06bb',
version='4.0-preview.1',
route_values=route_values)
return self._deserialize('MemberEntitlement', response)

def get_member_entitlements(self, top, skip, filter=None, select=None):
"""GetMemberEntitlements.
[Preview API] Used to get member entitlement information in an account
:param int top:
:param int skip:
:param str filter:
:param str select:
:rtype: [MemberEntitlement]
"""
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 filter is not None:
query_parameters['filter'] = self._serialize.query('filter', filter, 'str')
if select is not None:
query_parameters['select'] = self._serialize.query('select', select, 'str')
response = self._send(http_method='GET',
location_id='1e8cabfb-1fda-461e-860f-eeeae54d06bb',
version='4.0-preview.1',
query_parameters=query_parameters,
returns_collection=True)
return self._deserialize('[MemberEntitlement]', response)

def update_member_entitlement(self, document, member_id):
"""UpdateMemberEntitlement.
[Preview API] Used to edit a member in an account. Edits groups, licenses, and extensions.
:param :class:`<[JsonPatchOperation]> <member-entitlement-management.v4_0.models.[JsonPatchOperation]>` document: document of operations to be used
:param str member_id: member Id of the member to be edit
:rtype: :class:`<MemberEntitlementsPatchResponse> <member-entitlement-management.v4_0.models.MemberEntitlementsPatchResponse>`
"""
route_values = {}
if member_id is not None:
route_values['memberId'] = self._serialize.url('member_id', member_id, 'str')
content = self._serialize.body(document, '[JsonPatchOperation]')
response = self._send(http_method='PATCH',
location_id='1e8cabfb-1fda-461e-860f-eeeae54d06bb',
version='4.0-preview.1',
route_values=route_values,
content=content,
media_type='application/json-patch+json')
return self._deserialize('MemberEntitlementsPatchResponse', response)

def update_member_entitlements(self, document):
"""UpdateMemberEntitlements.
[Preview API] Used to edit multiple members in an account. Edits groups, licenses, and extensions.
:param :class:`<[JsonPatchOperation]> <member-entitlement-management.v4_0.models.[JsonPatchOperation]>` document: JsonPatch document
:rtype: :class:`<MemberEntitlementOperationReference> <member-entitlement-management.v4_0.models.MemberEntitlementOperationReference>`
"""
content = self._serialize.body(document, '[JsonPatchOperation]')
response = self._send(http_method='PATCH',
location_id='1e8cabfb-1fda-461e-860f-eeeae54d06bb',
version='4.0-preview.1',
content=content,
media_type='application/json-patch+json')
return self._deserialize('MemberEntitlementOperationReference', response)

55 changes: 55 additions & 0 deletions vsts/vsts/member_entitlement_management/v4_0/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# --------------------------------------------------------------------------------------------
# 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 .access_level import AccessLevel
from .base_operation_result import BaseOperationResult
from .extension import Extension
from .graph_group import GraphGroup
from .graph_member import GraphMember
from .graph_subject import GraphSubject
from .group import Group
from .group_entitlement import GroupEntitlement
from .group_entitlement_operation_reference import GroupEntitlementOperationReference
from .group_operation_result import GroupOperationResult
from .json_patch_operation import JsonPatchOperation
from .member_entitlement import MemberEntitlement
from .member_entitlement_operation_reference import MemberEntitlementOperationReference
from .member_entitlements_patch_response import MemberEntitlementsPatchResponse
from .member_entitlements_post_response import MemberEntitlementsPostResponse
from .member_entitlements_response_base import MemberEntitlementsResponseBase
from .operation_reference import OperationReference
from .operation_result import OperationResult
from .project_entitlement import ProjectEntitlement
from .project_ref import ProjectRef
from .reference_links import ReferenceLinks
from .team_ref import TeamRef

__all__ = [
'AccessLevel',
'BaseOperationResult',
'Extension',
'GraphGroup',
'GraphMember',
'GraphSubject',
'Group',
'GroupEntitlement',
'GroupEntitlementOperationReference',
'GroupOperationResult',
'JsonPatchOperation',
'MemberEntitlement',
'MemberEntitlementOperationReference',
'MemberEntitlementsPatchResponse',
'MemberEntitlementsPostResponse',
'MemberEntitlementsResponseBase',
'OperationReference',
'OperationResult',
'ProjectEntitlement',
'ProjectRef',
'ReferenceLinks',
'TeamRef',
]
Original file line number Diff line number Diff line change
@@ -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 msrest.serialization import Model


class AccessLevel(Model):
"""AccessLevel.

:param account_license_type:
:type account_license_type: object
:param assignment_source:
:type assignment_source: object
:param license_display_name:
:type license_display_name: str
:param licensing_source:
:type licensing_source: object
:param msdn_license_type:
:type msdn_license_type: object
:param status:
:type status: object
:param status_message:
:type status_message: str
"""

_attribute_map = {
'account_license_type': {'key': 'accountLicenseType', 'type': 'object'},
'assignment_source': {'key': 'assignmentSource', 'type': 'object'},
'license_display_name': {'key': 'licenseDisplayName', 'type': 'str'},
'licensing_source': {'key': 'licensingSource', 'type': 'object'},
'msdn_license_type': {'key': 'msdnLicenseType', 'type': 'object'},
'status': {'key': 'status', 'type': 'object'},
'status_message': {'key': 'statusMessage', 'type': 'str'}
}

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):
super(AccessLevel, self).__init__()
self.account_license_type = account_license_type
self.assignment_source = assignment_source
self.license_display_name = license_display_name
self.licensing_source = licensing_source
self.msdn_license_type = msdn_license_type
self.status = status
self.status_message = status_message
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
from msrest.serialization import Model


class MailConfirmationParameters(Model):
"""MailConfirmationParameters.
class BaseOperationResult(Model):
"""BaseOperationResult.

:param challenge_code: The unique code that proves ownership of the email address.
:type challenge_code: str
:param mail_address: The email address to be confirmed.
:type mail_address: str
:param errors: List of error codes paired with their corresponding error messages
:type errors: list of { key: int; value: str }
:param is_success: Success status of the operation
:type is_success: bool
"""

_attribute_map = {
'challenge_code': {'key': 'challengeCode', 'type': 'str'},
'mail_address': {'key': 'mailAddress', 'type': 'str'}
'errors': {'key': 'errors', 'type': '[{ key: int; value: str }]'},
'is_success': {'key': 'isSuccess', 'type': 'bool'}
}

def __init__(self, challenge_code=None, mail_address=None):
super(MailConfirmationParameters, self).__init__()
self.challenge_code = challenge_code
self.mail_address = mail_address
def __init__(self, errors=None, is_success=None):
super(BaseOperationResult, self).__init__()
self.errors = errors
self.is_success = is_success
37 changes: 37 additions & 0 deletions vsts/vsts/member_entitlement_management/v4_0/models/extension.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# --------------------------------------------------------------------------------------------
# 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 Extension(Model):
"""Extension.

:param assignment_source: Assignment source for this extension. I.e. explicitly assigned or from a group rule
:type assignment_source: object
:param id: Gallery Id of the Extension
:type id: str
:param name: Friendly name of this extension
:type name: str
:param source: Source of this extension assignment. Ex: msdn, account, none, ect.
:type source: object
"""

_attribute_map = {
'assignment_source': {'key': 'assignmentSource', 'type': 'object'},
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'source': {'key': 'source', 'type': 'object'}
}

def __init__(self, assignment_source=None, id=None, name=None, source=None):
super(Extension, self).__init__()
self.assignment_source = assignment_source
self.id = id
self.name = name
self.source = source
Loading