Skip to content

Commit b634061

Browse files
authored
[AutoPR resources/resource-manager] Fix ARMViolation Error for Microsoft.Authorization (#3304)
* Generated from b74ebceb22e46a4c6ceb9fd8ab1cb8347f400839 Fix ARMViolation Error for Microsoft.Authorization * Packaging update of azure-mgmt-resource
1 parent e15b933 commit b634061

File tree

11 files changed

+252
-10
lines changed

11 files changed

+252
-10
lines changed

azure-mgmt-resource/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This is the Microsoft Azure Resource Management Client Library.
66
Azure Resource Manager (ARM) is the next generation of management APIs that
77
replace the old Azure Service Management (ASM).
88

9-
This package has been tested with Python 2.7, 3.4, 3.5 and 3.6.
9+
This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7.
1010

1111
For the older Azure Service Management (ASM) libraries, see
1212
`azure-servicemanagement-legacy <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.

azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/management_lock_client.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
from msrest import Serializer, Deserializer
1414
from msrestazure import AzureConfiguration
1515
from .version import VERSION
16+
from msrest.pipeline import ClientRawResponse
17+
from msrestazure.azure_exceptions import CloudError
18+
import uuid
1619
from .operations.management_locks_operations import ManagementLocksOperations
1720
from . import models
1821

@@ -79,3 +82,63 @@ def __init__(
7982

8083
self.management_locks = ManagementLocksOperations(
8184
self._client, self.config, self._serialize, self._deserialize)
85+
86+
def list_operations(
87+
self, custom_headers=None, raw=False, **operation_config):
88+
"""Lists all of the available Microsoft.Authorization REST API operations.
89+
90+
:param dict custom_headers: headers that will be added to the request
91+
:param bool raw: returns the direct response alongside the
92+
deserialized response
93+
:param operation_config: :ref:`Operation configuration
94+
overrides<msrest:optionsforoperations>`.
95+
:return: An iterator like instance of Operation
96+
:rtype:
97+
~azure.mgmt.resource.locks.v2016_09_01.models.OperationPaged[~azure.mgmt.resource.locks.v2016_09_01.models.Operation]
98+
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
99+
"""
100+
def internal_paging(next_link=None, raw=False):
101+
102+
if not next_link:
103+
# Construct URL
104+
url = self.list_operations.metadata['url']
105+
106+
# Construct parameters
107+
query_parameters = {}
108+
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
109+
110+
else:
111+
url = next_link
112+
query_parameters = {}
113+
114+
# Construct headers
115+
header_parameters = {}
116+
header_parameters['Accept'] = 'application/json'
117+
if self.config.generate_client_request_id:
118+
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
119+
if custom_headers:
120+
header_parameters.update(custom_headers)
121+
if self.config.accept_language is not None:
122+
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
123+
124+
# Construct and send request
125+
request = self._client.get(url, query_parameters, header_parameters)
126+
response = self._client.send(request, stream=False, **operation_config)
127+
128+
if response.status_code not in [200]:
129+
exp = CloudError(response)
130+
exp.request_id = response.headers.get('x-ms-request-id')
131+
raise exp
132+
133+
return response
134+
135+
# Deserialize response
136+
deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies)
137+
138+
if raw:
139+
header_dict = {}
140+
client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict)
141+
return client_raw_response
142+
143+
return deserialized
144+
list_operations.metadata = {'url': '/providers/Microsoft.Features/operations'}

azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/models/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@
1212
try:
1313
from .management_lock_owner_py3 import ManagementLockOwner
1414
from .management_lock_object_py3 import ManagementLockObject
15+
from .operation_display_py3 import OperationDisplay
16+
from .operation_py3 import Operation
1517
except (SyntaxError, ImportError):
1618
from .management_lock_owner import ManagementLockOwner
1719
from .management_lock_object import ManagementLockObject
20+
from .operation_display import OperationDisplay
21+
from .operation import Operation
22+
from .operation_paged import OperationPaged
1823
from .management_lock_object_paged import ManagementLockObjectPaged
1924
from .management_lock_client_enums import (
2025
LockLevel,
@@ -23,6 +28,9 @@
2328
__all__ = [
2429
'ManagementLockOwner',
2530
'ManagementLockObject',
31+
'OperationDisplay',
32+
'Operation',
33+
'OperationPaged',
2634
'ManagementLockObjectPaged',
2735
'LockLevel',
2836
]

azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/models/management_lock_object.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ class ManagementLockObject(Model):
3737
:vartype id: str
3838
:ivar type: The resource type of the lock - Microsoft.Authorization/locks.
3939
:vartype type: str
40-
:param name: The name of the lock.
41-
:type name: str
40+
:ivar name: The name of the lock.
41+
:vartype name: str
4242
"""
4343

4444
_validation = {
4545
'level': {'required': True},
4646
'id': {'readonly': True},
4747
'type': {'readonly': True},
48+
'name': {'readonly': True},
4849
}
4950

5051
_attribute_map = {
@@ -63,4 +64,4 @@ def __init__(self, **kwargs):
6364
self.owners = kwargs.get('owners', None)
6465
self.id = None
6566
self.type = None
66-
self.name = kwargs.get('name', None)
67+
self.name = None

azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/models/management_lock_object_py3.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ class ManagementLockObject(Model):
3737
:vartype id: str
3838
:ivar type: The resource type of the lock - Microsoft.Authorization/locks.
3939
:vartype type: str
40-
:param name: The name of the lock.
41-
:type name: str
40+
:ivar name: The name of the lock.
41+
:vartype name: str
4242
"""
4343

4444
_validation = {
4545
'level': {'required': True},
4646
'id': {'readonly': True},
4747
'type': {'readonly': True},
48+
'name': {'readonly': True},
4849
}
4950

5051
_attribute_map = {
@@ -56,11 +57,11 @@ class ManagementLockObject(Model):
5657
'name': {'key': 'name', 'type': 'str'},
5758
}
5859

59-
def __init__(self, *, level, notes: str=None, owners=None, name: str=None, **kwargs) -> None:
60+
def __init__(self, *, level, notes: str=None, owners=None, **kwargs) -> None:
6061
super(ManagementLockObject, self).__init__(**kwargs)
6162
self.level = level
6263
self.notes = notes
6364
self.owners = owners
6465
self.id = None
6566
self.type = None
66-
self.name = name
67+
self.name = None
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.serialization import Model
13+
14+
15+
class Operation(Model):
16+
"""Microsoft.Authorization operation.
17+
18+
:param name: Operation name: {provider}/{resource}/{operation}
19+
:type name: str
20+
:param display: The object that represents the operation.
21+
:type display:
22+
~azure.mgmt.resource.locks.v2016_09_01.models.OperationDisplay
23+
"""
24+
25+
_attribute_map = {
26+
'name': {'key': 'name', 'type': 'str'},
27+
'display': {'key': 'display', 'type': 'OperationDisplay'},
28+
}
29+
30+
def __init__(self, **kwargs):
31+
super(Operation, self).__init__(**kwargs)
32+
self.name = kwargs.get('name', None)
33+
self.display = kwargs.get('display', None)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.serialization import Model
13+
14+
15+
class OperationDisplay(Model):
16+
"""The object that represents the operation.
17+
18+
:param provider: Service provider: Microsoft.Authorization
19+
:type provider: str
20+
:param resource: Resource on which the operation is performed: Profile,
21+
endpoint, etc.
22+
:type resource: str
23+
:param operation: Operation type: Read, write, delete, etc.
24+
:type operation: str
25+
"""
26+
27+
_attribute_map = {
28+
'provider': {'key': 'provider', 'type': 'str'},
29+
'resource': {'key': 'resource', 'type': 'str'},
30+
'operation': {'key': 'operation', 'type': 'str'},
31+
}
32+
33+
def __init__(self, **kwargs):
34+
super(OperationDisplay, self).__init__(**kwargs)
35+
self.provider = kwargs.get('provider', None)
36+
self.resource = kwargs.get('resource', None)
37+
self.operation = kwargs.get('operation', None)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.serialization import Model
13+
14+
15+
class OperationDisplay(Model):
16+
"""The object that represents the operation.
17+
18+
:param provider: Service provider: Microsoft.Authorization
19+
:type provider: str
20+
:param resource: Resource on which the operation is performed: Profile,
21+
endpoint, etc.
22+
:type resource: str
23+
:param operation: Operation type: Read, write, delete, etc.
24+
:type operation: str
25+
"""
26+
27+
_attribute_map = {
28+
'provider': {'key': 'provider', 'type': 'str'},
29+
'resource': {'key': 'resource', 'type': 'str'},
30+
'operation': {'key': 'operation', 'type': 'str'},
31+
}
32+
33+
def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, **kwargs) -> None:
34+
super(OperationDisplay, self).__init__(**kwargs)
35+
self.provider = provider
36+
self.resource = resource
37+
self.operation = operation
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.paging import Paged
13+
14+
15+
class OperationPaged(Paged):
16+
"""
17+
A paging container for iterating over a list of :class:`Operation <azure.mgmt.resource.locks.v2016_09_01.models.Operation>` object
18+
"""
19+
20+
_attribute_map = {
21+
'next_link': {'key': 'nextLink', 'type': 'str'},
22+
'current_page': {'key': 'value', 'type': '[Operation]'}
23+
}
24+
25+
def __init__(self, *args, **kwargs):
26+
27+
super(OperationPaged, self).__init__(*args, **kwargs)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.serialization import Model
13+
14+
15+
class Operation(Model):
16+
"""Microsoft.Authorization operation.
17+
18+
:param name: Operation name: {provider}/{resource}/{operation}
19+
:type name: str
20+
:param display: The object that represents the operation.
21+
:type display:
22+
~azure.mgmt.resource.locks.v2016_09_01.models.OperationDisplay
23+
"""
24+
25+
_attribute_map = {
26+
'name': {'key': 'name', 'type': 'str'},
27+
'display': {'key': 'display', 'type': 'OperationDisplay'},
28+
}
29+
30+
def __init__(self, *, name: str=None, display=None, **kwargs) -> None:
31+
super(Operation, self).__init__(**kwargs)
32+
self.name = name
33+
self.display = display

0 commit comments

Comments
 (0)