Skip to content

Commit f74935e

Browse files
authored
Merge pull request #353 from microsoft/users/tedchamb/5.1pp
add pipelines_permissions_client and pipelines_checks_client
2 parents c21624b + aa2ff63 commit f74935e

File tree

9 files changed

+876
-2
lines changed

9 files changed

+876
-2
lines changed

azure-devops/azure/devops/v5_1/client_factory.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,27 @@ def get_operations_client(self):
204204
"""
205205
return self._connection.get_client('azure.devops.v5_1.operations.operations_client.OperationsClient')
206206

207+
def get_pipeline_permissions_client(self):
208+
"""get_pipeline_permissions_client.
209+
Gets the 5.1 version of the PipelinePermissionsClient
210+
:rtype: :class:`<PipelinePermissionsClient> <azure.devops.v5_1.pipeline_permissions.pipeline_permissions_client.PipelinePermissionsClient>`
211+
"""
212+
return self._connection.get_client('azure.devops.v5_1.pipeline_permissions.pipeline_permissions_client.PipelinePermissionsClient')
213+
207214
def get_pipelines_client(self):
208215
"""get_pipelines_client.
209216
Gets the 5.1 version of the PipelinesClient
210217
:rtype: :class:`<PipelinesClient> <azure.devops.v5_1.pipelines.pipelines_client.PipelinesClient>`
211218
"""
212219
return self._connection.get_client('azure.devops.v5_1.pipelines.pipelines_client.PipelinesClient')
213220

221+
def get_pipelines_checks_client(self):
222+
"""get_pipelines_checks_client.
223+
Gets the 5.1 version of the PipelinesChecksClient
224+
:rtype: :class:`<PipelinesChecksClient> <azure.devops.v5_1.pipelines_checks.pipelines_checks_client.PipelinesChecksClient>`
225+
"""
226+
return self._connection.get_client('azure.devops.v5_1.pipelines_checks.pipelines_checks_client.PipelinesChecksClient')
227+
214228
def get_policy_client(self):
215229
"""get_policy_client.
216230
Gets the 5.1 version of the PolicyClient
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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 .models import *
10+
from .pipeline_permissions_client import PipelinePermissionsClient
11+
12+
__all__ = [
13+
'GraphSubjectBase',
14+
'IdentityRef',
15+
'Permission',
16+
'PipelinePermission',
17+
'ReferenceLinks',
18+
'Resource',
19+
'ResourcePipelinePermissions',
20+
'PipelinePermissionsClient'
21+
]
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
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 GraphSubjectBase(Model):
13+
"""
14+
: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.
15+
:type _links: :class:`ReferenceLinks <azure.devops.v5_1.microsoft._visual_studio._services._web_api.models.ReferenceLinks>`
16+
: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.
17+
:type descriptor: str
18+
: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.
19+
:type display_name: str
20+
:param url: This url is the full route to the source resource of this graph subject.
21+
:type url: str
22+
"""
23+
24+
_attribute_map = {
25+
'_links': {'key': '_links', 'type': 'ReferenceLinks'},
26+
'descriptor': {'key': 'descriptor', 'type': 'str'},
27+
'display_name': {'key': 'displayName', 'type': 'str'},
28+
'url': {'key': 'url', 'type': 'str'}
29+
}
30+
31+
def __init__(self, _links=None, descriptor=None, display_name=None, url=None):
32+
super(GraphSubjectBase, self).__init__()
33+
self._links = _links
34+
self.descriptor = descriptor
35+
self.display_name = display_name
36+
self.url = url
37+
38+
39+
class IdentityRef(GraphSubjectBase):
40+
"""
41+
: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.
42+
:type _links: :class:`ReferenceLinks <azure.devops.v5_1.microsoft._visual_studio._services._web_api.models.ReferenceLinks>`
43+
: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.
44+
:type descriptor: str
45+
: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.
46+
:type display_name: str
47+
:param url: This url is the full route to the source resource of this graph subject.
48+
:type url: str
49+
:param directory_alias: Deprecated - Can be retrieved by querying the Graph user referenced in the "self" entry of the IdentityRef "_links" dictionary
50+
:type directory_alias: str
51+
:param id:
52+
:type id: str
53+
:param image_url: Deprecated - Available in the "avatar" entry of the IdentityRef "_links" dictionary
54+
:type image_url: str
55+
:param inactive: Deprecated - Can be retrieved by querying the Graph membership state referenced in the "membershipState" entry of the GraphUser "_links" dictionary
56+
:type inactive: bool
57+
:param is_aad_identity: Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsAadUserType/Descriptor.IsAadGroupType)
58+
:type is_aad_identity: bool
59+
:param is_container: Deprecated - Can be inferred from the subject type of the descriptor (Descriptor.IsGroupType)
60+
:type is_container: bool
61+
:param is_deleted_in_origin:
62+
:type is_deleted_in_origin: bool
63+
:param profile_url: Deprecated - not in use in most preexisting implementations of ToIdentityRef
64+
:type profile_url: str
65+
:param unique_name: Deprecated - use Domain+PrincipalName instead
66+
:type unique_name: str
67+
"""
68+
69+
_attribute_map = {
70+
'_links': {'key': '_links', 'type': 'ReferenceLinks'},
71+
'descriptor': {'key': 'descriptor', 'type': 'str'},
72+
'display_name': {'key': 'displayName', 'type': 'str'},
73+
'url': {'key': 'url', 'type': 'str'},
74+
'directory_alias': {'key': 'directoryAlias', 'type': 'str'},
75+
'id': {'key': 'id', 'type': 'str'},
76+
'image_url': {'key': 'imageUrl', 'type': 'str'},
77+
'inactive': {'key': 'inactive', 'type': 'bool'},
78+
'is_aad_identity': {'key': 'isAadIdentity', 'type': 'bool'},
79+
'is_container': {'key': 'isContainer', 'type': 'bool'},
80+
'is_deleted_in_origin': {'key': 'isDeletedInOrigin', 'type': 'bool'},
81+
'profile_url': {'key': 'profileUrl', 'type': 'str'},
82+
'unique_name': {'key': 'uniqueName', 'type': 'str'}
83+
}
84+
85+
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):
86+
super(IdentityRef, self).__init__(_links=_links, descriptor=descriptor, display_name=display_name, url=url)
87+
self.directory_alias = directory_alias
88+
self.id = id
89+
self.image_url = image_url
90+
self.inactive = inactive
91+
self.is_aad_identity = is_aad_identity
92+
self.is_container = is_container
93+
self.is_deleted_in_origin = is_deleted_in_origin
94+
self.profile_url = profile_url
95+
self.unique_name = unique_name
96+
97+
98+
class Permission(Model):
99+
"""
100+
:param authorized:
101+
:type authorized: bool
102+
:param authorized_by:
103+
:type authorized_by: :class:`IdentityRef <azure.devops.v5_1.pipeline_permissions.models.IdentityRef>`
104+
:param authorized_on:
105+
:type authorized_on: datetime
106+
"""
107+
108+
_attribute_map = {
109+
'authorized': {'key': 'authorized', 'type': 'bool'},
110+
'authorized_by': {'key': 'authorizedBy', 'type': 'IdentityRef'},
111+
'authorized_on': {'key': 'authorizedOn', 'type': 'iso-8601'}
112+
}
113+
114+
def __init__(self, authorized=None, authorized_by=None, authorized_on=None):
115+
super(Permission, self).__init__()
116+
self.authorized = authorized
117+
self.authorized_by = authorized_by
118+
self.authorized_on = authorized_on
119+
120+
121+
class PipelinePermission(Permission):
122+
"""
123+
:param authorized:
124+
:type authorized: bool
125+
:param authorized_by:
126+
:type authorized_by: :class:`IdentityRef <azure.devops.v5_1.pipeline_permissions.models.IdentityRef>`
127+
:param authorized_on:
128+
:type authorized_on: datetime
129+
:param id:
130+
:type id: int
131+
"""
132+
133+
_attribute_map = {
134+
'authorized': {'key': 'authorized', 'type': 'bool'},
135+
'authorized_by': {'key': 'authorizedBy', 'type': 'IdentityRef'},
136+
'authorized_on': {'key': 'authorizedOn', 'type': 'iso-8601'},
137+
'id': {'key': 'id', 'type': 'int'}
138+
}
139+
140+
def __init__(self, authorized=None, authorized_by=None, authorized_on=None, id=None):
141+
super(PipelinePermission, self).__init__(authorized=authorized, authorized_by=authorized_by, authorized_on=authorized_on)
142+
self.id = id
143+
144+
145+
class ReferenceLinks(Model):
146+
"""
147+
The class to represent a collection of REST reference links.
148+
149+
:param links: The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.
150+
:type links: dict
151+
"""
152+
153+
_attribute_map = {
154+
'links': {'key': 'links', 'type': '{object}'}
155+
}
156+
157+
def __init__(self, links=None):
158+
super(ReferenceLinks, self).__init__()
159+
self.links = links
160+
161+
162+
class Resource(Model):
163+
"""
164+
:param id: Id of the resource.
165+
:type id: str
166+
:param type: Type of the resource.
167+
:type type: str
168+
"""
169+
170+
_attribute_map = {
171+
'id': {'key': 'id', 'type': 'str'},
172+
'type': {'key': 'type', 'type': 'str'}
173+
}
174+
175+
def __init__(self, id=None, type=None):
176+
super(Resource, self).__init__()
177+
self.id = id
178+
self.type = type
179+
180+
181+
class ResourcePipelinePermissions(Model):
182+
"""
183+
:param all_pipelines:
184+
:type all_pipelines: :class:`Permission <azure.devops.v5_1.pipeline_permissions.models.Permission>`
185+
:param pipelines:
186+
:type pipelines: list of :class:`PipelinePermission <azure.devops.v5_1.pipeline_permissions.models.PipelinePermission>`
187+
:param resource:
188+
:type resource: :class:`Resource <azure.devops.v5_1.pipeline_permissions.models.Resource>`
189+
"""
190+
191+
_attribute_map = {
192+
'all_pipelines': {'key': 'allPipelines', 'type': 'Permission'},
193+
'pipelines': {'key': 'pipelines', 'type': '[PipelinePermission]'},
194+
'resource': {'key': 'resource', 'type': 'Resource'}
195+
}
196+
197+
def __init__(self, all_pipelines=None, pipelines=None, resource=None):
198+
super(ResourcePipelinePermissions, self).__init__()
199+
self.all_pipelines = all_pipelines
200+
self.pipelines = pipelines
201+
self.resource = resource
202+
203+
204+
__all__ = [
205+
'GraphSubjectBase',
206+
'IdentityRef',
207+
'Permission',
208+
'PipelinePermission',
209+
'ReferenceLinks',
210+
'Resource',
211+
'ResourcePipelinePermissions',
212+
]
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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 ...client import Client
11+
from . import models
12+
13+
14+
class PipelinePermissionsClient(Client):
15+
"""PipelinePermissions
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(PipelinePermissionsClient, 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 = 'a81a0441-de52-4000-aa15-ff0e07bfbbaa'
27+
28+
def get_pipeline_permissions_for_resource(self, project, resource_type, resource_id):
29+
"""GetPipelinePermissionsForResource.
30+
[Preview API] Given a ResourceType and ResourceId, returns authorized definitions for that resource.
31+
:param str project: Project ID or project name
32+
:param str resource_type:
33+
:param str resource_id:
34+
:rtype: :class:`<ResourcePipelinePermissions> <azure.devops.v5_1.pipeline_permissions.models.ResourcePipelinePermissions>`
35+
"""
36+
route_values = {}
37+
if project is not None:
38+
route_values['project'] = self._serialize.url('project', project, 'str')
39+
if resource_type is not None:
40+
route_values['resourceType'] = self._serialize.url('resource_type', resource_type, 'str')
41+
if resource_id is not None:
42+
route_values['resourceId'] = self._serialize.url('resource_id', resource_id, 'str')
43+
response = self._send(http_method='GET',
44+
location_id='b5b9a4a4-e6cd-4096-853c-ab7d8b0c4eb2',
45+
version='5.1-preview.1',
46+
route_values=route_values)
47+
return self._deserialize('ResourcePipelinePermissions', response)
48+
49+
def update_pipeline_permisions_for_resource(self, resource_authorization, project, resource_type, resource_id):
50+
"""UpdatePipelinePermisionsForResource.
51+
[Preview API] Authorizes/Unauthorizes a list of definitions for a given resource.
52+
:param :class:`<ResourcePipelinePermissions> <azure.devops.v5_1.pipeline_permissions.models.ResourcePipelinePermissions>` resource_authorization:
53+
:param str project: Project ID or project name
54+
:param str resource_type:
55+
:param str resource_id:
56+
:rtype: :class:`<ResourcePipelinePermissions> <azure.devops.v5_1.pipeline_permissions.models.ResourcePipelinePermissions>`
57+
"""
58+
route_values = {}
59+
if project is not None:
60+
route_values['project'] = self._serialize.url('project', project, 'str')
61+
if resource_type is not None:
62+
route_values['resourceType'] = self._serialize.url('resource_type', resource_type, 'str')
63+
if resource_id is not None:
64+
route_values['resourceId'] = self._serialize.url('resource_id', resource_id, 'str')
65+
content = self._serialize.body(resource_authorization, 'ResourcePipelinePermissions')
66+
response = self._send(http_method='PATCH',
67+
location_id='b5b9a4a4-e6cd-4096-853c-ab7d8b0c4eb2',
68+
version='5.1-preview.1',
69+
route_values=route_values,
70+
content=content)
71+
return self._deserialize('ResourcePipelinePermissions', response)
72+
73+
def update_pipeline_permisions_for_resources(self, resource_authorizations, project):
74+
"""UpdatePipelinePermisionsForResources.
75+
[Preview API] Batch API to authorize/unauthorize a list of definitions for a multiple resources.
76+
:param [ResourcePipelinePermissions] resource_authorizations:
77+
:param str project: Project ID or project name
78+
:rtype: [ResourcePipelinePermissions]
79+
"""
80+
route_values = {}
81+
if project is not None:
82+
route_values['project'] = self._serialize.url('project', project, 'str')
83+
content = self._serialize.body(resource_authorizations, '[ResourcePipelinePermissions]')
84+
response = self._send(http_method='PATCH',
85+
location_id='b5b9a4a4-e6cd-4096-853c-ab7d8b0c4eb2',
86+
version='5.1-preview.1',
87+
route_values=route_values,
88+
content=content)
89+
return self._deserialize('[ResourcePipelinePermissions]', self._unwrap_collection(response))
90+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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 .models import *
10+
from .pipelines_checks_client import PipelinesChecksClient
11+
12+
__all__ = [
13+
'CheckConfiguration',
14+
'CheckConfigurationRef',
15+
'CheckRun',
16+
'CheckRunResult',
17+
'CheckSuite',
18+
'CheckSuiteRequest',
19+
'CheckType',
20+
'GraphSubjectBase',
21+
'IdentityRef',
22+
'ReferenceLinks',
23+
'Resource',
24+
'PipelinesChecksClient'
25+
]

0 commit comments

Comments
 (0)