diff --git a/azure-mgmt-resource/azure/mgmt/resource/locks/management_lock_client.py b/azure-mgmt-resource/azure/mgmt/resource/locks/management_lock_client.py index ba07d13070c9..f16e7b1c5ab0 100644 --- a/azure-mgmt-resource/azure/mgmt/resource/locks/management_lock_client.py +++ b/azure-mgmt-resource/azure/mgmt/resource/locks/management_lock_client.py @@ -107,6 +107,19 @@ def models(cls, api_version=DEFAULT_API_VERSION): return models raise NotImplementedError("APIVersion {} is not available".format(api_version)) + @property + def authorization_operations(self): + """Instance depends on the API version: + + * 2016-09-01: :class:`AuthorizationOperations` + """ + api_version = self._get_api_version('authorization_operations') + if api_version == '2016-09-01': + from .v2016_09_01.operations import AuthorizationOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def management_locks(self): """Instance depends on the API version: diff --git a/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/management_lock_client.py b/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/management_lock_client.py index dbbd77457340..5489aa865263 100644 --- a/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/management_lock_client.py +++ b/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/management_lock_client.py @@ -13,9 +13,7 @@ from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -import uuid +from .operations.authorization_operations import AuthorizationOperations from .operations.management_locks_operations import ManagementLocksOperations from . import models @@ -58,6 +56,8 @@ class ManagementLockClient(SDKClient): :ivar config: Configuration for client. :vartype config: ManagementLockClientConfiguration + :ivar authorization_operations: AuthorizationOperations operations + :vartype authorization_operations: azure.mgmt.resource.locks.v2016_09_01.operations.AuthorizationOperations :ivar management_locks: ManagementLocks operations :vartype management_locks: azure.mgmt.resource.locks.v2016_09_01.operations.ManagementLocksOperations @@ -80,65 +80,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + self.authorization_operations = AuthorizationOperations( + self._client, self.config, self._serialize, self._deserialize) self.management_locks = ManagementLocksOperations( self._client, self.config, self._serialize, self._deserialize) - - def list_operations( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available Microsoft.Authorization REST API operations. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Operation - :rtype: - ~azure.mgmt.resource.locks.v2016_09_01.models.OperationPaged[~azure.mgmt.resource.locks.v2016_09_01.models.Operation] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_operations.metadata['url'] - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_operations.metadata = {'url': '/providers/Microsoft.Authorization/operations'} diff --git a/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/__init__.py b/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/__init__.py index 2bffd473ac4b..89a0150a09b7 100644 --- a/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/__init__.py +++ b/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/__init__.py @@ -9,8 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- +from .authorization_operations import AuthorizationOperations from .management_locks_operations import ManagementLocksOperations __all__ = [ + 'AuthorizationOperations', 'ManagementLocksOperations', ] diff --git a/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/authorization_operations.py b/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/authorization_operations.py new file mode 100644 index 000000000000..e5c8f3d65d55 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/authorization_operations.py @@ -0,0 +1,98 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class AuthorizationOperations(object): + """AuthorizationOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the operation. Constant value: "2016-09-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2016-09-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available Microsoft.Authorization REST API operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.resource.locks.v2016_09_01.models.OperationPaged[~azure.mgmt.resource.locks.v2016_09_01.models.Operation] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/operations'}