Skip to content

Commit

Permalink
Merge pull request #353 from microsoft/users/tedchamb/5.1pp
Browse files Browse the repository at this point in the history
add pipelines_permissions_client and pipelines_checks_client
  • Loading branch information
tedchamb authored Aug 12, 2020
2 parents c21624b + aa2ff63 commit f74935e
Show file tree
Hide file tree
Showing 9 changed files with 876 additions and 2 deletions.
14 changes: 14 additions & 0 deletions azure-devops/azure/devops/v5_1/client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,27 @@ def get_operations_client(self):
"""
return self._connection.get_client('azure.devops.v5_1.operations.operations_client.OperationsClient')

def get_pipeline_permissions_client(self):
"""get_pipeline_permissions_client.
Gets the 5.1 version of the PipelinePermissionsClient
:rtype: :class:`<PipelinePermissionsClient> <azure.devops.v5_1.pipeline_permissions.pipeline_permissions_client.PipelinePermissionsClient>`
"""
return self._connection.get_client('azure.devops.v5_1.pipeline_permissions.pipeline_permissions_client.PipelinePermissionsClient')

def get_pipelines_client(self):
"""get_pipelines_client.
Gets the 5.1 version of the PipelinesClient
:rtype: :class:`<PipelinesClient> <azure.devops.v5_1.pipelines.pipelines_client.PipelinesClient>`
"""
return self._connection.get_client('azure.devops.v5_1.pipelines.pipelines_client.PipelinesClient')

def get_pipelines_checks_client(self):
"""get_pipelines_checks_client.
Gets the 5.1 version of the PipelinesChecksClient
:rtype: :class:`<PipelinesChecksClient> <azure.devops.v5_1.pipelines_checks.pipelines_checks_client.PipelinesChecksClient>`
"""
return self._connection.get_client('azure.devops.v5_1.pipelines_checks.pipelines_checks_client.PipelinesChecksClient')

def get_policy_client(self):
"""get_policy_client.
Gets the 5.1 version of the PolicyClient
Expand Down
21 changes: 21 additions & 0 deletions azure-devops/azure/devops/v5_1/pipeline_permissions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# --------------------------------------------------------------------------------------------
# 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 .pipeline_permissions_client import PipelinePermissionsClient

__all__ = [
'GraphSubjectBase',
'IdentityRef',
'Permission',
'PipelinePermission',
'ReferenceLinks',
'Resource',
'ResourcePipelinePermissions',
'PipelinePermissionsClient'
]
212 changes: 212 additions & 0 deletions azure-devops/azure/devops/v5_1/pipeline_permissions/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
# --------------------------------------------------------------------------------------------
# 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 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 <azure.devops.v5_1.microsoft._visual_studio._services._web_api.models.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 <azure.devops.v5_1.microsoft._visual_studio._services._web_api.models.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 Permission(Model):
"""
:param authorized:
:type authorized: bool
:param authorized_by:
:type authorized_by: :class:`IdentityRef <azure.devops.v5_1.pipeline_permissions.models.IdentityRef>`
:param authorized_on:
:type authorized_on: datetime
"""

_attribute_map = {
'authorized': {'key': 'authorized', 'type': 'bool'},
'authorized_by': {'key': 'authorizedBy', 'type': 'IdentityRef'},
'authorized_on': {'key': 'authorizedOn', 'type': 'iso-8601'}
}

def __init__(self, authorized=None, authorized_by=None, authorized_on=None):
super(Permission, self).__init__()
self.authorized = authorized
self.authorized_by = authorized_by
self.authorized_on = authorized_on


class PipelinePermission(Permission):
"""
:param authorized:
:type authorized: bool
:param authorized_by:
:type authorized_by: :class:`IdentityRef <azure.devops.v5_1.pipeline_permissions.models.IdentityRef>`
:param authorized_on:
:type authorized_on: datetime
:param id:
:type id: int
"""

_attribute_map = {
'authorized': {'key': 'authorized', 'type': 'bool'},
'authorized_by': {'key': 'authorizedBy', 'type': 'IdentityRef'},
'authorized_on': {'key': 'authorizedOn', 'type': 'iso-8601'},
'id': {'key': 'id', 'type': 'int'}
}

def __init__(self, authorized=None, authorized_by=None, authorized_on=None, id=None):
super(PipelinePermission, self).__init__(authorized=authorized, authorized_by=authorized_by, authorized_on=authorized_on)
self.id = id


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 Resource(Model):
"""
:param id: Id of the resource.
:type id: str
:param type: Type of the resource.
:type type: str
"""

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'}
}

def __init__(self, id=None, type=None):
super(Resource, self).__init__()
self.id = id
self.type = type


class ResourcePipelinePermissions(Model):
"""
:param all_pipelines:
:type all_pipelines: :class:`Permission <azure.devops.v5_1.pipeline_permissions.models.Permission>`
:param pipelines:
:type pipelines: list of :class:`PipelinePermission <azure.devops.v5_1.pipeline_permissions.models.PipelinePermission>`
:param resource:
:type resource: :class:`Resource <azure.devops.v5_1.pipeline_permissions.models.Resource>`
"""

_attribute_map = {
'all_pipelines': {'key': 'allPipelines', 'type': 'Permission'},
'pipelines': {'key': 'pipelines', 'type': '[PipelinePermission]'},
'resource': {'key': 'resource', 'type': 'Resource'}
}

def __init__(self, all_pipelines=None, pipelines=None, resource=None):
super(ResourcePipelinePermissions, self).__init__()
self.all_pipelines = all_pipelines
self.pipelines = pipelines
self.resource = resource


__all__ = [
'GraphSubjectBase',
'IdentityRef',
'Permission',
'PipelinePermission',
'ReferenceLinks',
'Resource',
'ResourcePipelinePermissions',
]
Original file line number Diff line number Diff line change
@@ -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 msrest import Serializer, Deserializer
from ...client import Client
from . import models


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

def __init__(self, base_url=None, creds=None):
super(PipelinePermissionsClient, 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 = 'a81a0441-de52-4000-aa15-ff0e07bfbbaa'

def get_pipeline_permissions_for_resource(self, project, resource_type, resource_id):
"""GetPipelinePermissionsForResource.
[Preview API] Given a ResourceType and ResourceId, returns authorized definitions for that resource.
:param str project: Project ID or project name
:param str resource_type:
:param str resource_id:
:rtype: :class:`<ResourcePipelinePermissions> <azure.devops.v5_1.pipeline_permissions.models.ResourcePipelinePermissions>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if resource_type is not None:
route_values['resourceType'] = self._serialize.url('resource_type', resource_type, 'str')
if resource_id is not None:
route_values['resourceId'] = self._serialize.url('resource_id', resource_id, 'str')
response = self._send(http_method='GET',
location_id='b5b9a4a4-e6cd-4096-853c-ab7d8b0c4eb2',
version='5.1-preview.1',
route_values=route_values)
return self._deserialize('ResourcePipelinePermissions', response)

def update_pipeline_permisions_for_resource(self, resource_authorization, project, resource_type, resource_id):
"""UpdatePipelinePermisionsForResource.
[Preview API] Authorizes/Unauthorizes a list of definitions for a given resource.
:param :class:`<ResourcePipelinePermissions> <azure.devops.v5_1.pipeline_permissions.models.ResourcePipelinePermissions>` resource_authorization:
:param str project: Project ID or project name
:param str resource_type:
:param str resource_id:
:rtype: :class:`<ResourcePipelinePermissions> <azure.devops.v5_1.pipeline_permissions.models.ResourcePipelinePermissions>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if resource_type is not None:
route_values['resourceType'] = self._serialize.url('resource_type', resource_type, 'str')
if resource_id is not None:
route_values['resourceId'] = self._serialize.url('resource_id', resource_id, 'str')
content = self._serialize.body(resource_authorization, 'ResourcePipelinePermissions')
response = self._send(http_method='PATCH',
location_id='b5b9a4a4-e6cd-4096-853c-ab7d8b0c4eb2',
version='5.1-preview.1',
route_values=route_values,
content=content)
return self._deserialize('ResourcePipelinePermissions', response)

def update_pipeline_permisions_for_resources(self, resource_authorizations, project):
"""UpdatePipelinePermisionsForResources.
[Preview API] Batch API to authorize/unauthorize a list of definitions for a multiple resources.
:param [ResourcePipelinePermissions] resource_authorizations:
:param str project: Project ID or project name
:rtype: [ResourcePipelinePermissions]
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
content = self._serialize.body(resource_authorizations, '[ResourcePipelinePermissions]')
response = self._send(http_method='PATCH',
location_id='b5b9a4a4-e6cd-4096-853c-ab7d8b0c4eb2',
version='5.1-preview.1',
route_values=route_values,
content=content)
return self._deserialize('[ResourcePipelinePermissions]', self._unwrap_collection(response))

25 changes: 25 additions & 0 deletions azure-devops/azure/devops/v5_1/pipelines_checks/__init__.py
Original file line number Diff line number Diff line change
@@ -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 .models import *
from .pipelines_checks_client import PipelinesChecksClient

__all__ = [
'CheckConfiguration',
'CheckConfigurationRef',
'CheckRun',
'CheckRunResult',
'CheckSuite',
'CheckSuiteRequest',
'CheckType',
'GraphSubjectBase',
'IdentityRef',
'ReferenceLinks',
'Resource',
'PipelinesChecksClient'
]
Loading

0 comments on commit f74935e

Please sign in to comment.