diff --git a/azure-common/HISTORY.rst b/azure-common/HISTORY.rst index 3ed221ea87fa..031a106b30dd 100644 --- a/azure-common/HISTORY.rst +++ b/azure-common/HISTORY.rst @@ -3,6 +3,13 @@ Release History =============== +1.1.12 (2018-05-29) ++++++++++++++++++++ + +**Features** + +- Add Authorization profile definition + 1.1.11 (2018-05-08) +++++++++++++++++++ diff --git a/azure-common/azure/common/__init__.py b/azure-common/azure/common/__init__.py index 08efb6fc35b5..dc2eed38c613 100644 --- a/azure-common/azure/common/__init__.py +++ b/azure-common/azure/common/__init__.py @@ -5,7 +5,7 @@ #-------------------------------------------------------------------------- __author__ = 'Microsoft Corp. ' -__version__ = '1.1.11' +__version__ = '1.1.12' class AzureException(Exception): diff --git a/azure-common/azure/profiles/__init__.py b/azure-common/azure/profiles/__init__.py index cf7165f317da..150e0a14a1d4 100644 --- a/azure-common/azure/profiles/__init__.py +++ b/azure-common/azure/profiles/__init__.py @@ -72,6 +72,9 @@ class KnownProfiles(Enum): latest = ProfileDefinition(None, "latest") v2017_03_09_profile = ProfileDefinition( { + "azure.mgmt.authorization.AuthorizationManagementClient": { + None: "2015-07-01" + }, "azure.mgmt.compute.ComputeManagementClient": { None: "2016-03-30" }, diff --git a/azure-common/setup.py b/azure-common/setup.py index ae5cbf29ba58..bd2f9e6796b6 100644 --- a/azure-common/setup.py +++ b/azure-common/setup.py @@ -39,7 +39,7 @@ setup( name='azure-common', - version='1.1.11', + version='1.1.12', description='Microsoft Azure Client Library for Python (Common)', long_description=readme + '\n\n' + history, license='MIT License', diff --git a/azure-mgmt-authorization/HISTORY.rst b/azure-mgmt-authorization/HISTORY.rst index 277fe3106ed2..6e3dff4dfa52 100644 --- a/azure-mgmt-authorization/HISTORY.rst +++ b/azure-mgmt-authorization/HISTORY.rst @@ -3,12 +3,24 @@ Release History =============== +0.50.0 (2018-05-29) ++++++++++++++++++++ + +**Features** + +- Support Azure Stack (multi API versionning) +- Client class can be used as a context manager to keep the underlying HTTP session open for performance + +**Bugfixes** + +- Compatibility of the sdist with wheel 0.31.0 + 0.40.0 (2018-03-13) +++++++++++++++++++ **Breaking changes** -- Several properties have been flattened ans "properties" attribute is not needed anymore +- Several properties have been flattened and "properties" attribute is not needed anymore (e.g. properties.email_address => email_address) - Some method signature change (e.g. create_by_id) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/authorization_management_client.py b/azure-mgmt-authorization/azure/mgmt/authorization/authorization_management_client.py index e77aa2fa0ef9..edbb71132e28 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/authorization_management_client.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/authorization_management_client.py @@ -9,16 +9,13 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import ServiceClient +from msrest.service_client import SDKClient from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration + +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin from .version import VERSION -from .operations.classic_administrators_operations import ClassicAdministratorsOperations -from .operations.provider_operations_metadata_operations import ProviderOperationsMetadataOperations -from .operations.permissions_operations import PermissionsOperations -from .operations.role_assignments_operations import RoleAssignmentsOperations -from .operations.role_definitions_operations import RoleDefinitionsOperations -from . import models class AuthorizationManagementClientConfiguration(AzureConfiguration): @@ -53,48 +50,151 @@ def __init__( self.subscription_id = subscription_id -class AuthorizationManagementClient(object): +class AuthorizationManagementClient(MultiApiClientMixin, SDKClient): """Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role definitions and role assignments. A role definition describes the set of actions that can be performed on resources. A role assignment grants access to Azure Active Directory users. + This ready contains multiple API versions, to help you deal with all Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, uses latest API version available on public Azure. + For production, you should stick a particular api-version and/or profile. + The profile sets a mapping between the operation group and an API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. + :ivar config: Configuration for client. :vartype config: AuthorizationManagementClientConfiguration - :ivar classic_administrators: ClassicAdministrators operations - :vartype classic_administrators: azure.mgmt.authorization.operations.ClassicAdministratorsOperations - :ivar provider_operations_metadata: ProviderOperationsMetadata operations - :vartype provider_operations_metadata: azure.mgmt.authorization.operations.ProviderOperationsMetadataOperations - :ivar permissions: Permissions operations - :vartype permissions: azure.mgmt.authorization.operations.PermissionsOperations - :ivar role_assignments: RoleAssignments operations - :vartype role_assignments: azure.mgmt.authorization.operations.RoleAssignmentsOperations - :ivar role_definitions: RoleDefinitions operations - :vartype role_definitions: azure.mgmt.authorization.operations.RoleDefinitionsOperations - :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials object` - :param subscription_id: The ID of the target subscription. + :param subscription_id: Subscription credentials which uniquely identify + Microsoft Azure subscription. The subscription ID forms part of the URI + for every service call. :type subscription_id: str + :param str api_version: API version to use if no profile is provided, or if + missing in profile. :param str base_url: Service URL + :param profile: A profile definition, from KnownProfiles to dict. + :type profile: azure.profiles.KnownProfiles """ - def __init__( - self, credentials, subscription_id, base_url=None): - + DEFAULT_API_VERSION='2018-01-01-preview' + _PROFILE_TAG = "azure.mgmt.authorization.AuthorizationManagementClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + 'classic_administrators': '2015-06-01', + None: DEFAULT_API_VERSION + }}, + _PROFILE_TAG + " latest" + ) + + def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default): self.config = AuthorizationManagementClientConfiguration(credentials, subscription_id, base_url) - self._client = ServiceClient(self.config.credentials, self.config) - - 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) - - self.classic_administrators = ClassicAdministratorsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.provider_operations_metadata = ProviderOperationsMetadataOperations( - self._client, self.config, self._serialize, self._deserialize) - self.permissions = PermissionsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.role_assignments = RoleAssignmentsOperations( - self._client, self.config, self._serialize, self._deserialize) - self.role_definitions = RoleDefinitionsOperations( - self._client, self.config, self._serialize, self._deserialize) + super(AuthorizationManagementClient, self).__init__( + credentials, + self.config, + api_version=api_version, + profile=profile + ) + +############ Generated from here ############ + + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2015-06-01: :mod:`v2015_06_01.models` + * 2015-07-01: :mod:`v2015_07_01.models` + * 2018-01-01-preview: :mod:`v2018_01_01_preview.models` + """ + if api_version == '2015-06-01': + from .v2015_06_01 import models + return models + elif api_version == '2015-07-01': + from .v2015_07_01 import models + return models + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview import models + return models + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + + @property + def classic_administrators(self): + """Instance depends on the API version: + + * 2015-06-01: :class:`ClassicAdministratorsOperations` + """ + api_version = self._get_api_version('classic_administrators') + if api_version == '2015-06-01': + from .v2015_06_01.operations import ClassicAdministratorsOperations 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 permissions(self): + """Instance depends on the API version: + + * 2015-07-01: :class:`PermissionsOperations` + * 2018-01-01-preview: :class:`PermissionsOperations` + """ + api_version = self._get_api_version('permissions') + if api_version == '2015-07-01': + from .v2015_07_01.operations import PermissionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import PermissionsOperations 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 provider_operations_metadata(self): + """Instance depends on the API version: + + * 2015-07-01: :class:`ProviderOperationsMetadataOperations` + * 2018-01-01-preview: :class:`ProviderOperationsMetadataOperations` + """ + api_version = self._get_api_version('provider_operations_metadata') + if api_version == '2015-07-01': + from .v2015_07_01.operations import ProviderOperationsMetadataOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import ProviderOperationsMetadataOperations 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 role_assignments(self): + """Instance depends on the API version: + + * 2015-07-01: :class:`RoleAssignmentsOperations` + * 2018-01-01-preview: :class:`RoleAssignmentsOperations` + """ + api_version = self._get_api_version('role_assignments') + if api_version == '2015-07-01': + from .v2015_07_01.operations import RoleAssignmentsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import RoleAssignmentsOperations 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 role_definitions(self): + """Instance depends on the API version: + + * 2015-07-01: :class:`RoleDefinitionsOperations` + * 2018-01-01-preview: :class:`RoleDefinitionsOperations` + """ + api_version = self._get_api_version('role_definitions') + if api_version == '2015-07-01': + from .v2015_07_01.operations import RoleDefinitionsOperations as OperationClass + elif api_version == '2018-01-01-preview': + from .v2018_01_01_preview.operations import RoleDefinitionsOperations 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))) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models.py b/azure-mgmt-authorization/azure/mgmt/authorization/models.py new file mode 100644 index 000000000000..1f0a6e04de3f --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models.py @@ -0,0 +1,8 @@ +# 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. +# -------------------------------------------------------------------------- +from .v2015_07_01.models import * +from .v2018_01_01_preview.models import * \ No newline at end of file diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/__init__.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/__init__.py new file mode 100644 index 000000000000..05f283c292d4 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/__init__.py @@ -0,0 +1,18 @@ +# 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. +# -------------------------------------------------------------------------- + +from .authorization_management_client import AuthorizationManagementClient +from .version import VERSION + +__all__ = ['AuthorizationManagementClient'] + +__version__ = VERSION + diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/authorization_management_client.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/authorization_management_client.py new file mode 100644 index 000000000000..1cbd254f1400 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/authorization_management_client.py @@ -0,0 +1,81 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.classic_administrators_operations import ClassicAdministratorsOperations +from . import models + + +class AuthorizationManagementClientConfiguration(AzureConfiguration): + """Configuration for AuthorizationManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(AuthorizationManagementClientConfiguration, self).__init__(base_url) + + self.add_user_agent('azure-mgmt-authorization/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + + +class AuthorizationManagementClient(SDKClient): + """Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role definitions and role assignments. A role definition describes the set of actions that can be performed on resources. A role assignment grants access to Azure Active Directory users. + + :ivar config: Configuration for client. + :vartype config: AuthorizationManagementClientConfiguration + + :ivar classic_administrators: ClassicAdministrators operations + :vartype classic_administrators: azure.mgmt.authorization.v2015_06_01.operations.ClassicAdministratorsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = AuthorizationManagementClientConfiguration(credentials, subscription_id, base_url) + super(AuthorizationManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2015-06-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.classic_administrators = ClassicAdministratorsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py new file mode 100644 index 000000000000..5320eb595b0b --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py @@ -0,0 +1,21 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from .classic_administrator_py3 import ClassicAdministrator +except (SyntaxError, ImportError): + from .classic_administrator import ClassicAdministrator +from .classic_administrator_paged import ClassicAdministratorPaged + +__all__ = [ + 'ClassicAdministrator', + 'ClassicAdministratorPaged', +] diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/classic_administrator.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/classic_administrator.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator_paged.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/classic_administrator_paged.py similarity index 90% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator_paged.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/classic_administrator_paged.py index 72a9a6c6d23b..9e079d9ecba5 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator_paged.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/classic_administrator_paged.py @@ -14,7 +14,7 @@ class ClassicAdministratorPaged(Paged): """ - A paging container for iterating over a list of :class:`ClassicAdministrator ` object + A paging container for iterating over a list of :class:`ClassicAdministrator ` object """ _attribute_map = { diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/classic_administrator_py3.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator_py3.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/classic_administrator_py3.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/__init__.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/__init__.py new file mode 100644 index 000000000000..d24e912c4df3 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/__init__.py @@ -0,0 +1,16 @@ +# 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. +# -------------------------------------------------------------------------- + +from .classic_administrators_operations import ClassicAdministratorsOperations + +__all__ = [ + 'ClassicAdministratorsOperations', +] diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/operations/classic_administrators_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/classic_administrators_operations.py similarity index 96% rename from azure-mgmt-authorization/azure/mgmt/authorization/operations/classic_administrators_operations.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/classic_administrators_operations.py index fc4ed72a0995..6268edac035c 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/operations/classic_administrators_operations.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/classic_administrators_operations.py @@ -49,7 +49,7 @@ def list( overrides`. :return: An iterator like instance of ClassicAdministrator :rtype: - ~azure.mgmt.authorization.models.ClassicAdministratorPaged[~azure.mgmt.authorization.models.ClassicAdministrator] + ~azure.mgmt.authorization.v2015_06_01.models.ClassicAdministratorPaged[~azure.mgmt.authorization.v2015_06_01.models.ClassicAdministrator] :raises: :class:`CloudError` """ def internal_paging(next_link=None, raw=False): diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/version.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/version.py new file mode 100644 index 000000000000..0b5f7361f182 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "2015-06-01" + diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/__init__.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/__init__.py new file mode 100644 index 000000000000..05f283c292d4 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/__init__.py @@ -0,0 +1,18 @@ +# 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. +# -------------------------------------------------------------------------- + +from .authorization_management_client import AuthorizationManagementClient +from .version import VERSION + +__all__ = ['AuthorizationManagementClient'] + +__version__ = VERSION + diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/authorization_management_client.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/authorization_management_client.py new file mode 100644 index 000000000000..ccf605a68130 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/authorization_management_client.py @@ -0,0 +1,96 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.permissions_operations import PermissionsOperations +from .operations.provider_operations_metadata_operations import ProviderOperationsMetadataOperations +from .operations.role_assignments_operations import RoleAssignmentsOperations +from .operations.role_definitions_operations import RoleDefinitionsOperations +from . import models + + +class AuthorizationManagementClientConfiguration(AzureConfiguration): + """Configuration for AuthorizationManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(AuthorizationManagementClientConfiguration, self).__init__(base_url) + + self.add_user_agent('azure-mgmt-authorization/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + + +class AuthorizationManagementClient(SDKClient): + """Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role definitions and role assignments. A role definition describes the set of actions that can be performed on resources. A role assignment grants access to Azure Active Directory users. + + :ivar config: Configuration for client. + :vartype config: AuthorizationManagementClientConfiguration + + :ivar permissions: Permissions operations + :vartype permissions: azure.mgmt.authorization.v2015_07_01.operations.PermissionsOperations + :ivar provider_operations_metadata: ProviderOperationsMetadata operations + :vartype provider_operations_metadata: azure.mgmt.authorization.v2015_07_01.operations.ProviderOperationsMetadataOperations + :ivar role_assignments: RoleAssignments operations + :vartype role_assignments: azure.mgmt.authorization.v2015_07_01.operations.RoleAssignmentsOperations + :ivar role_definitions: RoleDefinitions operations + :vartype role_definitions: azure.mgmt.authorization.v2015_07_01.operations.RoleDefinitionsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = AuthorizationManagementClientConfiguration(credentials, subscription_id, base_url) + super(AuthorizationManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2015-07-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.permissions = PermissionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.provider_operations_metadata = ProviderOperationsMetadataOperations( + self._client, self.config, self._serialize, self._deserialize) + self.role_assignments = RoleAssignmentsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.role_definitions = RoleDefinitionsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py new file mode 100644 index 000000000000..037a2be41452 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py @@ -0,0 +1,60 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from .role_assignment_filter_py3 import RoleAssignmentFilter + from .role_definition_filter_py3 import RoleDefinitionFilter + from .permission_py3 import Permission + from .provider_operation_py3 import ProviderOperation + from .resource_type_py3 import ResourceType + from .provider_operations_metadata_py3 import ProviderOperationsMetadata + from .role_assignment_properties_with_scope_py3 import RoleAssignmentPropertiesWithScope + from .role_assignment_py3 import RoleAssignment + from .role_assignment_properties_py3 import RoleAssignmentProperties + from .role_assignment_create_parameters_py3 import RoleAssignmentCreateParameters + from .role_definition_properties_py3 import RoleDefinitionProperties + from .role_definition_py3 import RoleDefinition +except (SyntaxError, ImportError): + from .role_assignment_filter import RoleAssignmentFilter + from .role_definition_filter import RoleDefinitionFilter + from .permission import Permission + from .provider_operation import ProviderOperation + from .resource_type import ResourceType + from .provider_operations_metadata import ProviderOperationsMetadata + from .role_assignment_properties_with_scope import RoleAssignmentPropertiesWithScope + from .role_assignment import RoleAssignment + from .role_assignment_properties import RoleAssignmentProperties + from .role_assignment_create_parameters import RoleAssignmentCreateParameters + from .role_definition_properties import RoleDefinitionProperties + from .role_definition import RoleDefinition +from .permission_paged import PermissionPaged +from .provider_operations_metadata_paged import ProviderOperationsMetadataPaged +from .role_assignment_paged import RoleAssignmentPaged +from .role_definition_paged import RoleDefinitionPaged + +__all__ = [ + 'RoleAssignmentFilter', + 'RoleDefinitionFilter', + 'Permission', + 'ProviderOperation', + 'ResourceType', + 'ProviderOperationsMetadata', + 'RoleAssignmentPropertiesWithScope', + 'RoleAssignment', + 'RoleAssignmentProperties', + 'RoleAssignmentCreateParameters', + 'RoleDefinitionProperties', + 'RoleDefinition', + 'PermissionPaged', + 'ProviderOperationsMetadataPaged', + 'RoleAssignmentPaged', + 'RoleDefinitionPaged', +] diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/permission.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/permission.py new file mode 100644 index 000000000000..04939e81ae01 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/permission.py @@ -0,0 +1,32 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Permission(Model): + """Role definition permissions. + + :param actions: Allowed actions. + :type actions: list[str] + :param not_actions: Denied actions. + :type not_actions: list[str] + """ + + _attribute_map = { + 'actions': {'key': 'actions', 'type': '[str]'}, + 'not_actions': {'key': 'notActions', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(Permission, self).__init__(**kwargs) + self.actions = kwargs.get('actions', None) + self.not_actions = kwargs.get('not_actions', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/permission_paged.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/permission_paged.py similarity index 92% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/permission_paged.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/permission_paged.py index 58d020a4ae61..d31a6f5e7b4a 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/permission_paged.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/permission_paged.py @@ -14,7 +14,7 @@ class PermissionPaged(Paged): """ - A paging container for iterating over a list of :class:`Permission ` object + A paging container for iterating over a list of :class:`Permission ` object """ _attribute_map = { diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/permission_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/permission_py3.py new file mode 100644 index 000000000000..dd954ccd837f --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/permission_py3.py @@ -0,0 +1,32 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Permission(Model): + """Role definition permissions. + + :param actions: Allowed actions. + :type actions: list[str] + :param not_actions: Denied actions. + :type not_actions: list[str] + """ + + _attribute_map = { + 'actions': {'key': 'actions', 'type': '[str]'}, + 'not_actions': {'key': 'notActions', 'type': '[str]'}, + } + + def __init__(self, *, actions=None, not_actions=None, **kwargs) -> None: + super(Permission, self).__init__(**kwargs) + self.actions = actions + self.not_actions = not_actions diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operation.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operation.py new file mode 100644 index 000000000000..b1ad79f4b33a --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operation.py @@ -0,0 +1,44 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ProviderOperation(Model): + """Operation. + + :param name: The operation name. + :type name: str + :param display_name: The operation display name. + :type display_name: str + :param description: The operation description. + :type description: str + :param origin: The operation origin. + :type origin: str + :param properties: The operation properties. + :type properties: object + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ProviderOperation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.origin = kwargs.get('origin', None) + self.properties = kwargs.get('properties', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operation_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operation_py3.py new file mode 100644 index 000000000000..ec1e6d6e96d8 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operation_py3.py @@ -0,0 +1,44 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ProviderOperation(Model): + """Operation. + + :param name: The operation name. + :type name: str + :param display_name: The operation display name. + :type display_name: str + :param description: The operation description. + :type description: str + :param origin: The operation origin. + :type origin: str + :param properties: The operation properties. + :type properties: object + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__(self, *, name: str=None, display_name: str=None, description: str=None, origin: str=None, properties=None, **kwargs) -> None: + super(ProviderOperation, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.description = description + self.origin = origin + self.properties = properties diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operations_metadata.py similarity index 90% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operations_metadata.py index 8e13bb134567..6fa0d7d85d36 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operations_metadata.py @@ -24,9 +24,11 @@ class ProviderOperationsMetadata(Model): :param display_name: The provider display name. :type display_name: str :param resource_types: The provider resource types - :type resource_types: list[~azure.mgmt.authorization.models.ResourceType] + :type resource_types: + list[~azure.mgmt.authorization.v2015_07_01.models.ResourceType] :param operations: The provider operations. - :type operations: list[~azure.mgmt.authorization.models.ProviderOperation] + :type operations: + list[~azure.mgmt.authorization.v2015_07_01.models.ProviderOperation] """ _attribute_map = { diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata_paged.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operations_metadata_paged.py similarity index 89% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata_paged.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operations_metadata_paged.py index 5f0daa3df1e0..1948f6bdf2a2 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata_paged.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operations_metadata_paged.py @@ -14,7 +14,7 @@ class ProviderOperationsMetadataPaged(Paged): """ - A paging container for iterating over a list of :class:`ProviderOperationsMetadata ` object + A paging container for iterating over a list of :class:`ProviderOperationsMetadata ` object """ _attribute_map = { diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operations_metadata_py3.py similarity index 90% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata_py3.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operations_metadata_py3.py index f95caeb8b68f..5784a6778f59 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata_py3.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/provider_operations_metadata_py3.py @@ -24,9 +24,11 @@ class ProviderOperationsMetadata(Model): :param display_name: The provider display name. :type display_name: str :param resource_types: The provider resource types - :type resource_types: list[~azure.mgmt.authorization.models.ResourceType] + :type resource_types: + list[~azure.mgmt.authorization.v2015_07_01.models.ResourceType] :param operations: The provider operations. - :type operations: list[~azure.mgmt.authorization.models.ProviderOperation] + :type operations: + list[~azure.mgmt.authorization.v2015_07_01.models.ProviderOperation] """ _attribute_map = { diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/resource_type.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/resource_type.py similarity index 92% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/resource_type.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/resource_type.py index 9cc2ab69019f..93ab8e8bcc72 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/resource_type.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/resource_type.py @@ -20,7 +20,8 @@ class ResourceType(Model): :param display_name: The resource type display name. :type display_name: str :param operations: The resource type operations. - :type operations: list[~azure.mgmt.authorization.models.ProviderOperation] + :type operations: + list[~azure.mgmt.authorization.v2015_07_01.models.ProviderOperation] """ _attribute_map = { diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/resource_type_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/resource_type_py3.py similarity index 92% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/resource_type_py3.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/resource_type_py3.py index 78d6a0b98a54..eb2cdf21f11d 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/resource_type_py3.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/resource_type_py3.py @@ -20,7 +20,8 @@ class ResourceType(Model): :param display_name: The resource type display name. :type display_name: str :param operations: The resource type operations. - :type operations: list[~azure.mgmt.authorization.models.ProviderOperation] + :type operations: + list[~azure.mgmt.authorization.v2015_07_01.models.ProviderOperation] """ _attribute_map = { diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment.py new file mode 100644 index 000000000000..118af3d07412 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment.py @@ -0,0 +1,50 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleAssignment(Model): + """Role Assignments. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The role assignment ID. + :vartype id: str + :ivar name: The role assignment name. + :vartype name: str + :ivar type: The role assignment type. + :vartype type: str + :param properties: Role assignment properties. + :type properties: + ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentPropertiesWithScope + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RoleAssignmentPropertiesWithScope'}, + } + + def __init__(self, **kwargs): + super(RoleAssignment, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs.get('properties', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_create_parameters.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_create_parameters.py new file mode 100644 index 000000000000..38e1fa3dec04 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_create_parameters.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleAssignmentCreateParameters(Model): + """Role assignment create parameters. + + :param properties: Role assignment properties. + :type properties: + ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RoleAssignmentProperties'}, + } + + def __init__(self, **kwargs): + super(RoleAssignmentCreateParameters, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_create_parameters_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_create_parameters_py3.py new file mode 100644 index 000000000000..7c284acd5581 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_create_parameters_py3.py @@ -0,0 +1,29 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleAssignmentCreateParameters(Model): + """Role assignment create parameters. + + :param properties: Role assignment properties. + :type properties: + ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RoleAssignmentProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(RoleAssignmentCreateParameters, self).__init__(**kwargs) + self.properties = properties diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_filter.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_filter.py new file mode 100644 index 000000000000..ece55415b13a --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_filter.py @@ -0,0 +1,28 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleAssignmentFilter(Model): + """Role Assignments filter. + + :param principal_id: Returns role assignment of the specific principal. + :type principal_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RoleAssignmentFilter, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_filter_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_filter_py3.py new file mode 100644 index 000000000000..729820a47424 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_filter_py3.py @@ -0,0 +1,28 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleAssignmentFilter(Model): + """Role Assignments filter. + + :param principal_id: Returns role assignment of the specific principal. + :type principal_id: str + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + } + + def __init__(self, *, principal_id: str=None, **kwargs) -> None: + super(RoleAssignmentFilter, self).__init__(**kwargs) + self.principal_id = principal_id diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_paged.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_paged.py similarity index 91% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_paged.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_paged.py index 08485af32eab..7c00f326bcbc 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_paged.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_paged.py @@ -14,7 +14,7 @@ class RoleAssignmentPaged(Paged): """ - A paging container for iterating over a list of :class:`RoleAssignment ` object + A paging container for iterating over a list of :class:`RoleAssignment ` object """ _attribute_map = { diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_properties.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_properties.py new file mode 100644 index 000000000000..4f50e37e25a4 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_properties.py @@ -0,0 +1,35 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleAssignmentProperties(Model): + """Role assignment properties. + + :param role_definition_id: The role definition ID used in the role + assignment. + :type role_definition_id: str + :param principal_id: The principal ID assigned to the role. This maps to + the ID inside the Active Directory. It can point to a user, service + principal, or security group. + :type principal_id: str + """ + + _attribute_map = { + 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RoleAssignmentProperties, self).__init__(**kwargs) + self.role_definition_id = kwargs.get('role_definition_id', None) + self.principal_id = kwargs.get('principal_id', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_properties_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_properties_py3.py new file mode 100644 index 000000000000..06c65c31878a --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_properties_py3.py @@ -0,0 +1,35 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleAssignmentProperties(Model): + """Role assignment properties. + + :param role_definition_id: The role definition ID used in the role + assignment. + :type role_definition_id: str + :param principal_id: The principal ID assigned to the role. This maps to + the ID inside the Active Directory. It can point to a user, service + principal, or security group. + :type principal_id: str + """ + + _attribute_map = { + 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + } + + def __init__(self, *, role_definition_id: str=None, principal_id: str=None, **kwargs) -> None: + super(RoleAssignmentProperties, self).__init__(**kwargs) + self.role_definition_id = role_definition_id + self.principal_id = principal_id diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_properties_with_scope.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_properties_with_scope.py new file mode 100644 index 000000000000..ada6904725f8 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_properties_with_scope.py @@ -0,0 +1,36 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleAssignmentPropertiesWithScope(Model): + """Role assignment properties with scope. + + :param scope: The role assignment scope. + :type scope: str + :param role_definition_id: The role definition ID. + :type role_definition_id: str + :param principal_id: The principal ID. + :type principal_id: str + """ + + _attribute_map = { + 'scope': {'key': 'scope', 'type': 'str'}, + 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RoleAssignmentPropertiesWithScope, self).__init__(**kwargs) + self.scope = kwargs.get('scope', None) + self.role_definition_id = kwargs.get('role_definition_id', None) + self.principal_id = kwargs.get('principal_id', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_properties_with_scope_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_properties_with_scope_py3.py new file mode 100644 index 000000000000..f73e825d6fce --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_properties_with_scope_py3.py @@ -0,0 +1,36 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleAssignmentPropertiesWithScope(Model): + """Role assignment properties with scope. + + :param scope: The role assignment scope. + :type scope: str + :param role_definition_id: The role definition ID. + :type role_definition_id: str + :param principal_id: The principal ID. + :type principal_id: str + """ + + _attribute_map = { + 'scope': {'key': 'scope', 'type': 'str'}, + 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + } + + def __init__(self, *, scope: str=None, role_definition_id: str=None, principal_id: str=None, **kwargs) -> None: + super(RoleAssignmentPropertiesWithScope, self).__init__(**kwargs) + self.scope = scope + self.role_definition_id = role_definition_id + self.principal_id = principal_id diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_py3.py new file mode 100644 index 000000000000..ea6a1bac7cb0 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_assignment_py3.py @@ -0,0 +1,50 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleAssignment(Model): + """Role Assignments. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The role assignment ID. + :vartype id: str + :ivar name: The role assignment name. + :vartype name: str + :ivar type: The role assignment type. + :vartype type: str + :param properties: Role assignment properties. + :type properties: + ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentPropertiesWithScope + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RoleAssignmentPropertiesWithScope'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(RoleAssignment, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition.py new file mode 100644 index 000000000000..ae600830c73a --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition.py @@ -0,0 +1,50 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleDefinition(Model): + """Role definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The role definition ID. + :vartype id: str + :ivar name: The role definition name. + :vartype name: str + :ivar type: The role definition type. + :vartype type: str + :param properties: Role definition properties. + :type properties: + ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinitionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RoleDefinitionProperties'}, + } + + def __init__(self, **kwargs): + super(RoleDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs.get('properties', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_filter.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_filter.py new file mode 100644 index 000000000000..6212426c86b7 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_filter.py @@ -0,0 +1,28 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleDefinitionFilter(Model): + """Role Definitions filter. + + :param role_name: Returns role definition with the specific name. + :type role_name: str + """ + + _attribute_map = { + 'role_name': {'key': 'roleName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RoleDefinitionFilter, self).__init__(**kwargs) + self.role_name = kwargs.get('role_name', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_filter_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_filter_py3.py new file mode 100644 index 000000000000..44d28a4dfa8d --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_filter_py3.py @@ -0,0 +1,28 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleDefinitionFilter(Model): + """Role Definitions filter. + + :param role_name: Returns role definition with the specific name. + :type role_name: str + """ + + _attribute_map = { + 'role_name': {'key': 'roleName', 'type': 'str'}, + } + + def __init__(self, *, role_name: str=None, **kwargs) -> None: + super(RoleDefinitionFilter, self).__init__(**kwargs) + self.role_name = role_name diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_paged.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_paged.py similarity index 91% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_paged.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_paged.py index 1b082da97e64..916aa9f1c428 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_paged.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_paged.py @@ -14,7 +14,7 @@ class RoleDefinitionPaged(Paged): """ - A paging container for iterating over a list of :class:`RoleDefinition ` object + A paging container for iterating over a list of :class:`RoleDefinition ` object """ _attribute_map = { diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_properties.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_properties.py new file mode 100644 index 000000000000..93c73ab82395 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_properties.py @@ -0,0 +1,45 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleDefinitionProperties(Model): + """Role definition properties. + + :param role_name: The role name. + :type role_name: str + :param description: The role definition description. + :type description: str + :param type: The role type. + :type type: str + :param permissions: Role definition permissions. + :type permissions: + list[~azure.mgmt.authorization.v2015_07_01.models.Permission] + :param assignable_scopes: Role definition assignable scopes. + :type assignable_scopes: list[str] + """ + + _attribute_map = { + 'role_name': {'key': 'roleName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'permissions': {'key': 'permissions', 'type': '[Permission]'}, + 'assignable_scopes': {'key': 'assignableScopes', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(RoleDefinitionProperties, self).__init__(**kwargs) + self.role_name = kwargs.get('role_name', None) + self.description = kwargs.get('description', None) + self.type = kwargs.get('type', None) + self.permissions = kwargs.get('permissions', None) + self.assignable_scopes = kwargs.get('assignable_scopes', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_properties_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_properties_py3.py new file mode 100644 index 000000000000..826f7a16ca50 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_properties_py3.py @@ -0,0 +1,45 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleDefinitionProperties(Model): + """Role definition properties. + + :param role_name: The role name. + :type role_name: str + :param description: The role definition description. + :type description: str + :param type: The role type. + :type type: str + :param permissions: Role definition permissions. + :type permissions: + list[~azure.mgmt.authorization.v2015_07_01.models.Permission] + :param assignable_scopes: Role definition assignable scopes. + :type assignable_scopes: list[str] + """ + + _attribute_map = { + 'role_name': {'key': 'roleName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'permissions': {'key': 'permissions', 'type': '[Permission]'}, + 'assignable_scopes': {'key': 'assignableScopes', 'type': '[str]'}, + } + + def __init__(self, *, role_name: str=None, description: str=None, type: str=None, permissions=None, assignable_scopes=None, **kwargs) -> None: + super(RoleDefinitionProperties, self).__init__(**kwargs) + self.role_name = role_name + self.description = description + self.type = type + self.permissions = permissions + self.assignable_scopes = assignable_scopes diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_py3.py new file mode 100644 index 000000000000..d809210d4df8 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/role_definition_py3.py @@ -0,0 +1,50 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class RoleDefinition(Model): + """Role definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The role definition ID. + :vartype id: str + :ivar name: The role definition name. + :vartype name: str + :ivar type: The role definition type. + :vartype type: str + :param properties: Role definition properties. + :type properties: + ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinitionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RoleDefinitionProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(RoleDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/operations/__init__.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/__init__.py similarity index 88% rename from azure-mgmt-authorization/azure/mgmt/authorization/operations/__init__.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/__init__.py index 98bf8abf8854..5a51d5bf427e 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/operations/__init__.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/__init__.py @@ -9,16 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from .classic_administrators_operations import ClassicAdministratorsOperations -from .provider_operations_metadata_operations import ProviderOperationsMetadataOperations from .permissions_operations import PermissionsOperations +from .provider_operations_metadata_operations import ProviderOperationsMetadataOperations from .role_assignments_operations import RoleAssignmentsOperations from .role_definitions_operations import RoleDefinitionsOperations __all__ = [ - 'ClassicAdministratorsOperations', - 'ProviderOperationsMetadataOperations', 'PermissionsOperations', + 'ProviderOperationsMetadataOperations', 'RoleAssignmentsOperations', 'RoleDefinitionsOperations', ] diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/permissions_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/permissions_operations.py new file mode 100644 index 000000000000..4d494c5e4412 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/permissions_operations.py @@ -0,0 +1,190 @@ +# 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 PermissionsOperations(object): + """PermissionsOperations 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 this operation. Constant value: "2015-07-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-07-01" + + self.config = config + + def list_for_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Gets all permissions the caller has for a resource group. + + :param resource_group_name: The name of the resource group to get the + permissions for. The name is case insensitive. + :type resource_group_name: str + :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 Permission + :rtype: + ~azure.mgmt.authorization.v2015_07_01.models.PermissionPaged[~azure.mgmt.authorization.v2015_07_01.models.Permission] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_for_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, 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.PermissionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.PermissionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions'} + + def list_for_resource( + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers=None, raw=False, **operation_config): + """Gets all permissions the caller has for a resource. + + :param resource_group_name: The name of the resource group containing + the resource. The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource + provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource. + :type resource_type: str + :param resource_name: The name of the resource to get the permissions + for. + :type resource_name: str + :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 Permission + :rtype: + ~azure.mgmt.authorization.v2015_07_01.models.PermissionPaged[~azure.mgmt.authorization.v2015_07_01.models.Permission] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_for_resource.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # 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['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, 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.PermissionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.PermissionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_for_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions'} diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/provider_operations_metadata_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/provider_operations_metadata_operations.py new file mode 100644 index 000000000000..fe29414f06af --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/provider_operations_metadata_operations.py @@ -0,0 +1,169 @@ +# 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 ProviderOperationsMetadataOperations(object): + """ProviderOperationsMetadataOperations 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. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get( + self, resource_provider_namespace, api_version, expand="resourceTypes", custom_headers=None, raw=False, **operation_config): + """Gets provider operations metadata for the specified resource provider. + + :param resource_provider_namespace: The namespace of the resource + provider. + :type resource_provider_namespace: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param expand: Specifies whether to expand the values. + :type expand: str + :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: ProviderOperationsMetadata or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2015_07_01.models.ProviderOperationsMetadata + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send(request, header_parameters, 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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ProviderOperationsMetadata', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}'} + + def list( + self, api_version, expand="resourceTypes", custom_headers=None, raw=False, **operation_config): + """Gets provider operations metadata for all resource providers. + + :param api_version: The API version to use for this operation. + :type api_version: str + :param expand: Specifies whether to expand the values. + :type expand: str + :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 ProviderOperationsMetadata + :rtype: + ~azure.mgmt.authorization.v2015_07_01.models.ProviderOperationsMetadataPaged[~azure.mgmt.authorization.v2015_07_01.models.ProviderOperationsMetadata] + :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("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, 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.ProviderOperationsMetadataPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ProviderOperationsMetadataPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/providerOperations'} diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/role_assignments_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/role_assignments_operations.py new file mode 100644 index 000000000000..da87e79da071 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/role_assignments_operations.py @@ -0,0 +1,746 @@ +# 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 RoleAssignmentsOperations(object): + """RoleAssignmentsOperations 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 this operation. Constant value: "2015-07-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-07-01" + + self.config = config + + def list_for_resource( + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets role assignments for a resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource + provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource. + :type resource_type: str + :param resource_name: The name of the resource to get role assignments + for. + :type resource_name: str + :param filter: The filter to apply on the operation. Use + $filter=atScope() to return all role assignments at or above the + scope. Use $filter=principalId eq {id} to return all role assignments + at, above or below the scope for the specified principal. + :type filter: str + :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 RoleAssignment + :rtype: + ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_for_resource.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, 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.RoleAssignmentPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RoleAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_for_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments'} + + def list_for_resource_group( + self, resource_group_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets role assignments for a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param filter: The filter to apply on the operation. Use + $filter=atScope() to return all role assignments at or above the + scope. Use $filter=principalId eq {id} to return all role assignments + at, above or below the scope for the specified principal. + :type filter: str + :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 RoleAssignment + :rtype: + ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_for_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, 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.RoleAssignmentPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RoleAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments'} + + def delete( + self, scope, role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Deletes a role assignment. + + :param scope: The scope of the role assignment to delete. + :type scope: str + :param role_assignment_name: The name of the role assignment to + delete. + :type role_assignment_name: str + :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: RoleAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'roleAssignmentName': self._serialize.url("role_assignment_name", role_assignment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, 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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + delete.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}'} + + def create( + self, scope, role_assignment_name, properties=None, custom_headers=None, raw=False, **operation_config): + """Creates a role assignment. + + :param scope: The scope of the role assignment to create. The scope + can be any REST resource instance. For example, use + '/subscriptions/{subscription-id}/' for a subscription, + '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' + for a resource group, and + '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + for a resource. + :type scope: str + :param role_assignment_name: The name of the role assignment to + create. It can be any valid GUID. + :type role_assignment_name: str + :param properties: Role assignment properties. + :type properties: + ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentProperties + :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: RoleAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.RoleAssignmentCreateParameters(properties=properties) + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'roleAssignmentName': self._serialize.url("role_assignment_name", role_assignment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(parameters, 'RoleAssignmentCreateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('RoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}'} + + def get( + self, scope, role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Get the specified role assignment. + + :param scope: The scope of the role assignment. + :type scope: str + :param role_assignment_name: The name of the role assignment to get. + :type role_assignment_name: str + :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: RoleAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'roleAssignmentName': self._serialize.url("role_assignment_name", role_assignment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send(request, header_parameters, 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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}'} + + def delete_by_id( + self, role_assignment_id, custom_headers=None, raw=False, **operation_config): + """Deletes a role assignment. + + :param role_assignment_id: The fully qualified ID of the role + assignment, including the scope, resource name and resource type. Use + the format, + /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. + Example: + /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. + :type role_assignment_id: str + :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: RoleAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete_by_id.metadata['url'] + path_format_arguments = { + 'roleAssignmentId': self._serialize.url("role_assignment_id", role_assignment_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, 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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + delete_by_id.metadata = {'url': '/{roleAssignmentId}'} + + def create_by_id( + self, role_assignment_id, properties=None, custom_headers=None, raw=False, **operation_config): + """Creates a role assignment by ID. + + :param role_assignment_id: The fully qualified ID of the role + assignment, including the scope, resource name and resource type. Use + the format, + /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. + Example: + /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. + :type role_assignment_id: str + :param properties: Role assignment properties. + :type properties: + ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentProperties + :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: RoleAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.RoleAssignmentCreateParameters(properties=properties) + + # Construct URL + url = self.create_by_id.metadata['url'] + path_format_arguments = { + 'roleAssignmentId': self._serialize.url("role_assignment_id", role_assignment_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(parameters, 'RoleAssignmentCreateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('RoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_by_id.metadata = {'url': '/{roleAssignmentId}'} + + def get_by_id( + self, role_assignment_id, custom_headers=None, raw=False, **operation_config): + """Gets a role assignment by ID. + + :param role_assignment_id: The fully qualified ID of the role + assignment, including the scope, resource name and resource type. Use + the format, + /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. + Example: + /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. + :type role_assignment_id: str + :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: RoleAssignment or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'roleAssignmentId': self._serialize.url("role_assignment_id", role_assignment_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send(request, header_parameters, 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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/{roleAssignmentId}'} + + def list( + self, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets all role assignments for the subscription. + + :param filter: The filter to apply on the operation. Use + $filter=atScope() to return all role assignments at or above the + scope. Use $filter=principalId eq {id} to return all role assignments + at, above or below the scope for the specified principal. + :type filter: str + :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 RoleAssignment + :rtype: + ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, 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.RoleAssignmentPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RoleAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments'} + + def list_for_scope( + self, scope, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets role assignments for a scope. + + :param scope: The scope of the role assignments. + :type scope: str + :param filter: The filter to apply on the operation. Use + $filter=atScope() to return all role assignments at or above the + scope. Use $filter=principalId eq {id} to return all role assignments + at, above or below the scope for the specified principal. + :type filter: str + :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 RoleAssignment + :rtype: + ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_for_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, 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.RoleAssignmentPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RoleAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_for_scope.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignments'} diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/role_definitions_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/role_definitions_operations.py new file mode 100644 index 000000000000..fcc18e8624ee --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/role_definitions_operations.py @@ -0,0 +1,365 @@ +# 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 RoleDefinitionsOperations(object): + """RoleDefinitionsOperations 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 this operation. Constant value: "2015-07-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-07-01" + + self.config = config + + def delete( + self, scope, role_definition_id, custom_headers=None, raw=False, **operation_config): + """Deletes a role definition. + + :param scope: The scope of the role definition. + :type scope: str + :param role_definition_id: The ID of the role definition to delete. + :type role_definition_id: str + :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: RoleDefinition or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'roleDefinitionId': self._serialize.url("role_definition_id", role_definition_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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.delete(url, query_parameters) + response = self._client.send(request, header_parameters, 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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RoleDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + delete.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}'} + + def get( + self, scope, role_definition_id, custom_headers=None, raw=False, **operation_config): + """Get role definition by name (GUID). + + :param scope: The scope of the role definition. + :type scope: str + :param role_definition_id: The ID of the role definition. + :type role_definition_id: str + :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: RoleDefinition or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'roleDefinitionId': self._serialize.url("role_definition_id", role_definition_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send(request, header_parameters, 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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RoleDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}'} + + def create_or_update( + self, scope, role_definition_id, properties=None, custom_headers=None, raw=False, **operation_config): + """Creates or updates a role definition. + + :param scope: The scope of the role definition. + :type scope: str + :param role_definition_id: The ID of the role definition. + :type role_definition_id: str + :param properties: Role definition properties. + :type properties: + ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinitionProperties + :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: RoleDefinition or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + role_definition = models.RoleDefinition(properties=properties) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'roleDefinitionId': self._serialize.url("role_definition_id", role_definition_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(role_definition, 'RoleDefinition') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('RoleDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}'} + + def list( + self, scope, filter=None, custom_headers=None, raw=False, **operation_config): + """Get all role definitions that are applicable at scope and above. + + :param scope: The scope of the role definition. + :type scope: str + :param filter: The filter to apply on the operation. Use + atScopeAndBelow filter to search below the given scope as well. + :type filter: str + :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 RoleDefinition + :rtype: + ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinitionPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send( + request, header_parameters, 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.RoleDefinitionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.RoleDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleDefinitions'} + + def get_by_id( + self, role_definition_id, custom_headers=None, raw=False, **operation_config): + """Gets a role definition by ID. + + :param role_definition_id: The fully qualified role definition ID. Use + the format, + /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} + for subscription level role definitions, or + /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} + for tenant level role definitions. + :type role_definition_id: str + :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: RoleDefinition or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'roleDefinitionId': self._serialize.url("role_definition_id", role_definition_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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) + response = self._client.send(request, header_parameters, 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 + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('RoleDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/{roleDefinitionId}'} diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/version.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/version.py new file mode 100644 index 000000000000..ccd03e108044 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "2015-07-01" + diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/__init__.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/__init__.py new file mode 100644 index 000000000000..05f283c292d4 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/__init__.py @@ -0,0 +1,18 @@ +# 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. +# -------------------------------------------------------------------------- + +from .authorization_management_client import AuthorizationManagementClient +from .version import VERSION + +__all__ = ['AuthorizationManagementClient'] + +__version__ = VERSION + diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/authorization_management_client.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/authorization_management_client.py new file mode 100644 index 000000000000..a0c0ad7eb534 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/authorization_management_client.py @@ -0,0 +1,96 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.provider_operations_metadata_operations import ProviderOperationsMetadataOperations +from .operations.permissions_operations import PermissionsOperations +from .operations.role_assignments_operations import RoleAssignmentsOperations +from .operations.role_definitions_operations import RoleDefinitionsOperations +from . import models + + +class AuthorizationManagementClientConfiguration(AzureConfiguration): + """Configuration for AuthorizationManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(AuthorizationManagementClientConfiguration, self).__init__(base_url) + + self.add_user_agent('azure-mgmt-authorization/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + + +class AuthorizationManagementClient(SDKClient): + """Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role definitions and role assignments. A role definition describes the set of actions that can be performed on resources. A role assignment grants access to Azure Active Directory users. + + :ivar config: Configuration for client. + :vartype config: AuthorizationManagementClientConfiguration + + :ivar provider_operations_metadata: ProviderOperationsMetadata operations + :vartype provider_operations_metadata: azure.mgmt.authorization.v2018_01_01_preview.operations.ProviderOperationsMetadataOperations + :ivar permissions: Permissions operations + :vartype permissions: azure.mgmt.authorization.v2018_01_01_preview.operations.PermissionsOperations + :ivar role_assignments: RoleAssignments operations + :vartype role_assignments: azure.mgmt.authorization.v2018_01_01_preview.operations.RoleAssignmentsOperations + :ivar role_definitions: RoleDefinitions operations + :vartype role_definitions: azure.mgmt.authorization.v2018_01_01_preview.operations.RoleDefinitionsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = AuthorizationManagementClientConfiguration(credentials, subscription_id, base_url) + super(AuthorizationManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2018-01-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.provider_operations_metadata = ProviderOperationsMetadataOperations( + self._client, self.config, self._serialize, self._deserialize) + self.permissions = PermissionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.role_assignments = RoleAssignmentsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.role_definitions = RoleDefinitionsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/__init__.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py similarity index 89% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/__init__.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py index 82fb90d7325f..9116b671939d 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/__init__.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py @@ -10,7 +10,6 @@ # -------------------------------------------------------------------------- try: - from .classic_administrator_py3 import ClassicAdministrator from .provider_operation_py3 import ProviderOperation from .resource_type_py3 import ResourceType from .provider_operations_metadata_py3 import ProviderOperationsMetadata @@ -21,7 +20,6 @@ from .role_assignment_py3 import RoleAssignment from .role_assignment_create_parameters_py3 import RoleAssignmentCreateParameters except (SyntaxError, ImportError): - from .classic_administrator import ClassicAdministrator from .provider_operation import ProviderOperation from .resource_type import ResourceType from .provider_operations_metadata import ProviderOperationsMetadata @@ -31,14 +29,12 @@ from .role_assignment_filter import RoleAssignmentFilter from .role_assignment import RoleAssignment from .role_assignment_create_parameters import RoleAssignmentCreateParameters -from .classic_administrator_paged import ClassicAdministratorPaged from .provider_operations_metadata_paged import ProviderOperationsMetadataPaged from .permission_paged import PermissionPaged from .role_assignment_paged import RoleAssignmentPaged from .role_definition_paged import RoleDefinitionPaged __all__ = [ - 'ClassicAdministrator', 'ProviderOperation', 'ResourceType', 'ProviderOperationsMetadata', @@ -48,7 +44,6 @@ 'RoleAssignmentFilter', 'RoleAssignment', 'RoleAssignmentCreateParameters', - 'ClassicAdministratorPaged', 'ProviderOperationsMetadataPaged', 'PermissionPaged', 'RoleAssignmentPaged', diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/permission.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/permission.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/permission.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/permission.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/permission_paged.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/permission_paged.py new file mode 100644 index 000000000000..1d4455b7bbd4 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/permission_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class PermissionPaged(Paged): + """ + A paging container for iterating over a list of :class:`Permission ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Permission]'} + } + + def __init__(self, *args, **kwargs): + + super(PermissionPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/permission_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/permission_py3.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/permission_py3.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/permission_py3.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operation.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/provider_operation.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operation.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/provider_operation.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operation_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/provider_operation_py3.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operation_py3.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/provider_operation_py3.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/provider_operations_metadata.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/provider_operations_metadata.py new file mode 100644 index 000000000000..c97a31a3a892 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/provider_operations_metadata.py @@ -0,0 +1,50 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ProviderOperationsMetadata(Model): + """Provider Operations metadata. + + :param id: The provider id. + :type id: str + :param name: The provider name. + :type name: str + :param type: The provider type. + :type type: str + :param display_name: The provider display name. + :type display_name: str + :param resource_types: The provider resource types + :type resource_types: + list[~azure.mgmt.authorization.v2018_01_01_preview.models.ResourceType] + :param operations: The provider operations. + :type operations: + list[~azure.mgmt.authorization.v2018_01_01_preview.models.ProviderOperation] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[ResourceType]'}, + 'operations': {'key': 'operations', 'type': '[ProviderOperation]'}, + } + + def __init__(self, **kwargs): + super(ProviderOperationsMetadata, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.display_name = kwargs.get('display_name', None) + self.resource_types = kwargs.get('resource_types', None) + self.operations = kwargs.get('operations', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/provider_operations_metadata_paged.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/provider_operations_metadata_paged.py new file mode 100644 index 000000000000..40f373b804c2 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/provider_operations_metadata_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ProviderOperationsMetadataPaged(Paged): + """ + A paging container for iterating over a list of :class:`ProviderOperationsMetadata ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ProviderOperationsMetadata]'} + } + + def __init__(self, *args, **kwargs): + + super(ProviderOperationsMetadataPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/provider_operations_metadata_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/provider_operations_metadata_py3.py new file mode 100644 index 000000000000..7b0ba4665704 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/provider_operations_metadata_py3.py @@ -0,0 +1,50 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ProviderOperationsMetadata(Model): + """Provider Operations metadata. + + :param id: The provider id. + :type id: str + :param name: The provider name. + :type name: str + :param type: The provider type. + :type type: str + :param display_name: The provider display name. + :type display_name: str + :param resource_types: The provider resource types + :type resource_types: + list[~azure.mgmt.authorization.v2018_01_01_preview.models.ResourceType] + :param operations: The provider operations. + :type operations: + list[~azure.mgmt.authorization.v2018_01_01_preview.models.ProviderOperation] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[ResourceType]'}, + 'operations': {'key': 'operations', 'type': '[ProviderOperation]'}, + } + + def __init__(self, *, id: str=None, name: str=None, type: str=None, display_name: str=None, resource_types=None, operations=None, **kwargs) -> None: + super(ProviderOperationsMetadata, self).__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.display_name = display_name + self.resource_types = resource_types + self.operations = operations diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/resource_type.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/resource_type.py new file mode 100644 index 000000000000..cc357b9d24fb --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/resource_type.py @@ -0,0 +1,37 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ResourceType(Model): + """Resource Type. + + :param name: The resource type name. + :type name: str + :param display_name: The resource type display name. + :type display_name: str + :param operations: The resource type operations. + :type operations: + list[~azure.mgmt.authorization.v2018_01_01_preview.models.ProviderOperation] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'operations': {'key': 'operations', 'type': '[ProviderOperation]'}, + } + + def __init__(self, **kwargs): + super(ResourceType, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.operations = kwargs.get('operations', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/resource_type_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/resource_type_py3.py new file mode 100644 index 000000000000..57d7488f940c --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/resource_type_py3.py @@ -0,0 +1,37 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ResourceType(Model): + """Resource Type. + + :param name: The resource type name. + :type name: str + :param display_name: The resource type display name. + :type display_name: str + :param operations: The resource type operations. + :type operations: + list[~azure.mgmt.authorization.v2018_01_01_preview.models.ProviderOperation] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'operations': {'key': 'operations', 'type': '[ProviderOperation]'}, + } + + def __init__(self, *, name: str=None, display_name: str=None, operations=None, **kwargs) -> None: + super(ResourceType, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.operations = operations diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_create_parameters.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment_create_parameters.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_create_parameters.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment_create_parameters.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_create_parameters_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment_create_parameters_py3.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_create_parameters_py3.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment_create_parameters_py3.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_filter.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment_filter.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_filter.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment_filter.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_filter_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment_filter_py3.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_filter_py3.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment_filter_py3.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment_paged.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment_paged.py new file mode 100644 index 000000000000..d7b95e0ab534 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class RoleAssignmentPaged(Paged): + """ + A paging container for iterating over a list of :class:`RoleAssignment ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RoleAssignment]'} + } + + def __init__(self, *args, **kwargs): + + super(RoleAssignmentPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment_py3.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_py3.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_assignment_py3.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_definition.py similarity index 96% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_definition.py index 650dfa9d5382..1accd401acf9 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_definition.py @@ -31,7 +31,8 @@ class RoleDefinition(Model): :param role_type: The role type. :type role_type: str :param permissions: Role definition permissions. - :type permissions: list[~azure.mgmt.authorization.models.Permission] + :type permissions: + list[~azure.mgmt.authorization.v2018_01_01_preview.models.Permission] :param assignable_scopes: Role definition assignable scopes. :type assignable_scopes: list[str] """ diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_filter.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_definition_filter.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_filter.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_definition_filter.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_filter_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_definition_filter_py3.py similarity index 100% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_filter_py3.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_definition_filter_py3.py diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_definition_paged.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_definition_paged.py new file mode 100644 index 000000000000..eabd26b56c6b --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_definition_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class RoleDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`RoleDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RoleDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(RoleDefinitionPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_definition_py3.py similarity index 96% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_py3.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_definition_py3.py index c3533531c8d3..1b598ad67b00 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_py3.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/role_definition_py3.py @@ -31,7 +31,8 @@ class RoleDefinition(Model): :param role_type: The role type. :type role_type: str :param permissions: Role definition permissions. - :type permissions: list[~azure.mgmt.authorization.models.Permission] + :type permissions: + list[~azure.mgmt.authorization.v2018_01_01_preview.models.Permission] :param assignable_scopes: Role definition assignable scopes. :type assignable_scopes: list[str] """ diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/__init__.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/__init__.py new file mode 100644 index 000000000000..460a4b779f97 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/__init__.py @@ -0,0 +1,22 @@ +# 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. +# -------------------------------------------------------------------------- + +from .provider_operations_metadata_operations import ProviderOperationsMetadataOperations +from .permissions_operations import PermissionsOperations +from .role_assignments_operations import RoleAssignmentsOperations +from .role_definitions_operations import RoleDefinitionsOperations + +__all__ = [ + 'ProviderOperationsMetadataOperations', + 'PermissionsOperations', + 'RoleAssignmentsOperations', + 'RoleDefinitionsOperations', +] diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/operations/permissions_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/permissions_operations.py similarity index 96% rename from azure-mgmt-authorization/azure/mgmt/authorization/operations/permissions_operations.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/permissions_operations.py index 95c4ffd59806..9badd2c857f0 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/operations/permissions_operations.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/permissions_operations.py @@ -50,7 +50,7 @@ def list_for_resource_group( overrides`. :return: An iterator like instance of Permission :rtype: - ~azure.mgmt.authorization.models.PermissionPaged[~azure.mgmt.authorization.models.Permission] + ~azure.mgmt.authorization.v2018_01_01_preview.models.PermissionPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.Permission] :raises: :class:`CloudError` """ def internal_paging(next_link=None, raw=False): @@ -128,7 +128,7 @@ def list_for_resource( overrides`. :return: An iterator like instance of Permission :rtype: - ~azure.mgmt.authorization.models.PermissionPaged[~azure.mgmt.authorization.models.Permission] + ~azure.mgmt.authorization.v2018_01_01_preview.models.PermissionPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.Permission] :raises: :class:`CloudError` """ def internal_paging(next_link=None, raw=False): diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/operations/provider_operations_metadata_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/provider_operations_metadata_operations.py similarity index 95% rename from azure-mgmt-authorization/azure/mgmt/authorization/operations/provider_operations_metadata_operations.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/provider_operations_metadata_operations.py index 79b5f349aa78..cce8912b95fc 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/operations/provider_operations_metadata_operations.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/provider_operations_metadata_operations.py @@ -52,8 +52,9 @@ def get( :param operation_config: :ref:`Operation configuration overrides`. :return: ProviderOperationsMetadata or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.authorization.models.ProviderOperationsMetadata or - ~msrest.pipeline.ClientRawResponse + :rtype: + ~azure.mgmt.authorization.v2018_01_01_preview.models.ProviderOperationsMetadata + or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ # Construct URL @@ -113,7 +114,7 @@ def list( overrides`. :return: An iterator like instance of ProviderOperationsMetadata :rtype: - ~azure.mgmt.authorization.models.ProviderOperationsMetadataPaged[~azure.mgmt.authorization.models.ProviderOperationsMetadata] + ~azure.mgmt.authorization.v2018_01_01_preview.models.ProviderOperationsMetadataPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.ProviderOperationsMetadata] :raises: :class:`CloudError` """ def internal_paging(next_link=None, raw=False): diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/operations/role_assignments_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/role_assignments_operations.py similarity index 95% rename from azure-mgmt-authorization/azure/mgmt/authorization/operations/role_assignments_operations.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/role_assignments_operations.py index 0e162d28c1ef..e72b81802db5 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/operations/role_assignments_operations.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/role_assignments_operations.py @@ -65,7 +65,7 @@ def list_for_resource( overrides`. :return: An iterator like instance of RoleAssignment :rtype: - ~azure.mgmt.authorization.models.RoleAssignmentPaged[~azure.mgmt.authorization.models.RoleAssignment] + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment] :raises: :class:`CloudError` """ def internal_paging(next_link=None, raw=False): @@ -144,7 +144,7 @@ def list_for_resource_group( overrides`. :return: An iterator like instance of RoleAssignment :rtype: - ~azure.mgmt.authorization.models.RoleAssignmentPaged[~azure.mgmt.authorization.models.RoleAssignment] + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment] :raises: :class:`CloudError` """ def internal_paging(next_link=None, raw=False): @@ -216,7 +216,8 @@ def delete( :param operation_config: :ref:`Operation configuration overrides`. :return: RoleAssignment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.authorization.models.RoleAssignment or + :rtype: + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -280,14 +281,15 @@ def create( :type role_assignment_name: str :param parameters: Parameters for the role assignment. :type parameters: - ~azure.mgmt.authorization.models.RoleAssignmentCreateParameters + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters :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: RoleAssignment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.authorization.models.RoleAssignment or + :rtype: + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -352,7 +354,8 @@ def get( :param operation_config: :ref:`Operation configuration overrides`. :return: RoleAssignment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.authorization.models.RoleAssignment or + :rtype: + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -411,7 +414,8 @@ def delete_by_id( :param operation_config: :ref:`Operation configuration overrides`. :return: RoleAssignment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.authorization.models.RoleAssignment or + :rtype: + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -465,14 +469,15 @@ def create_by_id( :type role_id: str :param parameters: Parameters for the role assignment. :type parameters: - ~azure.mgmt.authorization.models.RoleAssignmentCreateParameters + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentCreateParameters :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: RoleAssignment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.authorization.models.RoleAssignment or + :rtype: + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -534,7 +539,8 @@ def get_by_id( :param operation_config: :ref:`Operation configuration overrides`. :return: RoleAssignment or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.authorization.models.RoleAssignment or + :rtype: + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -596,7 +602,7 @@ def list( overrides`. :return: An iterator like instance of RoleAssignment :rtype: - ~azure.mgmt.authorization.models.RoleAssignmentPaged[~azure.mgmt.authorization.models.RoleAssignment] + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment] :raises: :class:`CloudError` """ def internal_paging(next_link=None, raw=False): @@ -670,7 +676,7 @@ def list_for_scope( overrides`. :return: An iterator like instance of RoleAssignment :rtype: - ~azure.mgmt.authorization.models.RoleAssignmentPaged[~azure.mgmt.authorization.models.RoleAssignment] + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment] :raises: :class:`CloudError` """ def internal_paging(next_link=None, raw=False): diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/operations/role_definitions_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/role_definitions_operations.py similarity index 96% rename from azure-mgmt-authorization/azure/mgmt/authorization/operations/role_definitions_operations.py rename to azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/role_definitions_operations.py index 0a20d15ca218..507c8a36b6cb 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/operations/role_definitions_operations.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/role_definitions_operations.py @@ -51,7 +51,8 @@ def delete( :param operation_config: :ref:`Operation configuration overrides`. :return: RoleDefinition or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.authorization.models.RoleDefinition or + :rtype: + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -112,7 +113,8 @@ def get( :param operation_config: :ref:`Operation configuration overrides`. :return: RoleDefinition or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.authorization.models.RoleDefinition or + :rtype: + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -168,14 +170,16 @@ def create_or_update( :param role_definition_id: The ID of the role definition. :type role_definition_id: str :param role_definition: The values for the role definition. - :type role_definition: ~azure.mgmt.authorization.models.RoleDefinition + :type role_definition: + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition :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: RoleDefinition or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.authorization.models.RoleDefinition or + :rtype: + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -242,7 +246,7 @@ def list( overrides`. :return: An iterator like instance of RoleDefinition :rtype: - ~azure.mgmt.authorization.models.RoleDefinitionPaged[~azure.mgmt.authorization.models.RoleDefinition] + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinitionPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition] :raises: :class:`CloudError` """ def internal_paging(next_link=None, raw=False): @@ -315,7 +319,8 @@ def get_by_id( :param operation_config: :ref:`Operation configuration overrides`. :return: RoleDefinition or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.authorization.models.RoleDefinition or + :rtype: + ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/version.py b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/version.py new file mode 100644 index 000000000000..af6bf850c40f --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "2018-01-01-preview" + diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/version.py b/azure-mgmt-authorization/azure/mgmt/authorization/version.py index 57866fdf17d0..1002e003856c 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/version.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.40.0" +VERSION = "0.50.0" diff --git a/azure-mgmt-authorization/sdk_packaging.toml b/azure-mgmt-authorization/sdk_packaging.toml new file mode 100644 index 000000000000..e6ccb07b628d --- /dev/null +++ b/azure-mgmt-authorization/sdk_packaging.toml @@ -0,0 +1,5 @@ +[packaging] +package_name = "azure-mgmt-authorization" +package_pprint_name = "Authorization Management" +package_doc_id = "authorization" +is_stable = false diff --git a/azure-mgmt-authorization/setup.py b/azure-mgmt-authorization/setup.py index 75101d52addb..a53daab9138c 100644 --- a/azure-mgmt-authorization/setup.py +++ b/azure-mgmt-authorization/setup.py @@ -77,8 +77,8 @@ zip_safe=False, packages=find_packages(exclude=["tests"]), install_requires=[ - 'msrestazure>=0.4.20,<2.0.0', - 'azure-common~=1.1', + 'msrestazure>=0.4.27,<2.0.0', + 'azure-common~=1.1,>=1.1.12', ], cmdclass=cmdclass )