diff --git a/azure-mgmt-authorization/HISTORY.rst b/azure-mgmt-authorization/HISTORY.rst index a82f279a5484..277fe3106ed2 100644 --- a/azure-mgmt-authorization/HISTORY.rst +++ b/azure-mgmt-authorization/HISTORY.rst @@ -3,6 +3,21 @@ Release History =============== +0.40.0 (2018-03-13) ++++++++++++++++++++ + +**Breaking changes** + +- Several properties have been flattened ans "properties" attribute is not needed anymore + (e.g. properties.email_address => email_address) +- Some method signature change (e.g. create_by_id) + +**Features** + +- Adding attributes data_actions / not_data_actions / is_data_actions + +API version is now 2018-01-01-preview + 0.30.0 (2017-04-28) +++++++++++++++++++ diff --git a/azure-mgmt-authorization/README.rst b/azure-mgmt-authorization/README.rst index 88d538fa185f..efa1778dcf2c 100644 --- a/azure-mgmt-authorization/README.rst +++ b/azure-mgmt-authorization/README.rst @@ -6,7 +6,7 @@ This is the Microsoft Azure Authorization Management Client Library. Azure Resource Manager (ARM) is the next generation of management APIs that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.3, 3.4, 3.5 and 3.6. +This package has been tested with Python 2.7, 3.4, 3.5 and 3.6. For the older Azure Service Management (ASM) libraries, see `azure-servicemanagement-legacy `__ library. @@ -37,8 +37,8 @@ Usage ===== For code examples, see `Authorization Management -`__ -on readthedocs.org. +`__ +on docs.microsoft.com. Provide Feedback 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 f0593558014a..e77aa2fa0ef9 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/authorization_management_client.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/authorization_management_client.py @@ -14,8 +14,8 @@ from msrestazure import AzureConfiguration from .version import VERSION from .operations.classic_administrators_operations import ClassicAdministratorsOperations -from .operations.permissions_operations import PermissionsOperations 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 @@ -46,7 +46,7 @@ def __init__( super(AuthorizationManagementClientConfiguration, self).__init__(base_url) - self.add_user_agent('authorizationmanagementclient/{}'.format(VERSION)) + self.add_user_agent('azure-mgmt-authorization/{}'.format(VERSION)) self.add_user_agent('Azure-SDK-For-Python') self.credentials = credentials @@ -61,10 +61,10 @@ class AuthorizationManagementClient(object): :ivar classic_administrators: ClassicAdministrators operations :vartype classic_administrators: azure.mgmt.authorization.operations.ClassicAdministratorsOperations - :ivar permissions: Permissions operations - :vartype permissions: azure.mgmt.authorization.operations.PermissionsOperations :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 @@ -85,16 +85,15 @@ def __init__( self._client = ServiceClient(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.classic_administrators = ClassicAdministratorsOperations( self._client, self.config, self._serialize, self._deserialize) - 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.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( diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/__init__.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/__init__.py index d6929bc116e7..82fb90d7325f 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/__init__.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/__init__.py @@ -9,44 +9,48 @@ # regenerated. # -------------------------------------------------------------------------- -from .role_assignment_filter import RoleAssignmentFilter -from .role_definition_filter import RoleDefinitionFilter -from .classic_administrator_properties import ClassicAdministratorProperties -from .classic_administrator import ClassicAdministrator -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 +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 + from .permission_py3 import Permission + from .role_definition_filter_py3 import RoleDefinitionFilter + from .role_definition_py3 import RoleDefinition + from .role_assignment_filter_py3 import RoleAssignmentFilter + 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 + from .permission import Permission + from .role_definition_filter import RoleDefinitionFilter + from .role_definition import RoleDefinition + 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 .permission_paged import PermissionPaged 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__ = [ - 'RoleAssignmentFilter', - 'RoleDefinitionFilter', - 'ClassicAdministratorProperties', 'ClassicAdministrator', - 'Permission', 'ProviderOperation', 'ResourceType', 'ProviderOperationsMetadata', - 'RoleAssignmentPropertiesWithScope', + 'Permission', + 'RoleDefinitionFilter', + 'RoleDefinition', + 'RoleAssignmentFilter', 'RoleAssignment', - 'RoleAssignmentProperties', 'RoleAssignmentCreateParameters', - 'RoleDefinitionProperties', - 'RoleDefinition', 'ClassicAdministratorPaged', - 'PermissionPaged', 'ProviderOperationsMetadataPaged', + 'PermissionPaged', 'RoleAssignmentPaged', 'RoleDefinitionPaged', ] diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator.py index 25efd96c0bc4..39b18378dd01 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator.py @@ -21,20 +21,24 @@ class ClassicAdministrator(Model): :type name: str :param type: The type of the administrator. :type type: str - :param properties: Properties for the classic administrator. - :type properties: - ~azure.mgmt.authorization.models.ClassicAdministratorProperties + :param email_address: The email address of the administrator. + :type email_address: str + :param role: The role of the administrator. + :type role: str """ _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ClassicAdministratorProperties'}, + 'email_address': {'key': 'properties.emailAddress', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, } - def __init__(self, id=None, name=None, type=None, properties=None): - self.id = id - self.name = name - self.type = type - self.properties = properties + def __init__(self, **kwargs): + super(ClassicAdministrator, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.email_address = kwargs.get('email_address', None) + self.role = kwargs.get('role', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator_py3.py new file mode 100644 index 000000000000..97298cc3e684 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator_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 ClassicAdministrator(Model): + """Classic Administrators. + + :param id: The ID of the administrator. + :type id: str + :param name: The name of the administrator. + :type name: str + :param type: The type of the administrator. + :type type: str + :param email_address: The email address of the administrator. + :type email_address: str + :param role: The role of the administrator. + :type role: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'email_address': {'key': 'properties.emailAddress', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, name: str=None, type: str=None, email_address: str=None, role: str=None, **kwargs) -> None: + super(ClassicAdministrator, self).__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.email_address = email_address + self.role = role diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/permission.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/permission.py index 7efd4cdc6b8e..3c86802d5d9e 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/permission.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/permission.py @@ -19,13 +19,22 @@ class Permission(Model): :type actions: list[str] :param not_actions: Denied actions. :type not_actions: list[str] + :param data_actions: Allowed Data actions. + :type data_actions: list[str] + :param not_data_actions: Denied Data actions. + :type not_data_actions: list[str] """ _attribute_map = { 'actions': {'key': 'actions', 'type': '[str]'}, 'not_actions': {'key': 'notActions', 'type': '[str]'}, + 'data_actions': {'key': 'dataActions', 'type': '[str]'}, + 'not_data_actions': {'key': 'notDataActions', 'type': '[str]'}, } - def __init__(self, actions=None, not_actions=None): - self.actions = actions - self.not_actions = not_actions + def __init__(self, **kwargs): + super(Permission, self).__init__(**kwargs) + self.actions = kwargs.get('actions', None) + self.not_actions = kwargs.get('not_actions', None) + self.data_actions = kwargs.get('data_actions', None) + self.not_data_actions = kwargs.get('not_data_actions', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/permission_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/permission_py3.py new file mode 100644 index 000000000000..1b5a16e6acac --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/permission_py3.py @@ -0,0 +1,40 @@ +# 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] + :param data_actions: Allowed Data actions. + :type data_actions: list[str] + :param not_data_actions: Denied Data actions. + :type not_data_actions: list[str] + """ + + _attribute_map = { + 'actions': {'key': 'actions', 'type': '[str]'}, + 'not_actions': {'key': 'notActions', 'type': '[str]'}, + 'data_actions': {'key': 'dataActions', 'type': '[str]'}, + 'not_data_actions': {'key': 'notDataActions', 'type': '[str]'}, + } + + def __init__(self, *, actions=None, not_actions=None, data_actions=None, not_data_actions=None, **kwargs) -> None: + super(Permission, self).__init__(**kwargs) + self.actions = actions + self.not_actions = not_actions + self.data_actions = data_actions + self.not_data_actions = not_data_actions diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operation.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operation.py index 90fc912b059a..6ffdb218c04c 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operation.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operation.py @@ -25,6 +25,8 @@ class ProviderOperation(Model): :type origin: str :param properties: The operation properties. :type properties: object + :param is_data_action: The dataAction flag to specify the operation type. + :type is_data_action: bool """ _attribute_map = { @@ -33,11 +35,14 @@ class ProviderOperation(Model): 'description': {'key': 'description', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'object'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, } - def __init__(self, name=None, display_name=None, description=None, origin=None, properties=None): - self.name = name - self.display_name = display_name - self.description = description - self.origin = origin - self.properties = properties + 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) + self.is_data_action = kwargs.get('is_data_action', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operation_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operation_py3.py new file mode 100644 index 000000000000..67e16f94b8a7 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operation_py3.py @@ -0,0 +1,48 @@ +# 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 + :param is_data_action: The dataAction flag to specify the operation type. + :type is_data_action: bool + """ + + _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'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + } + + def __init__(self, *, name: str=None, display_name: str=None, description: str=None, origin: str=None, properties=None, is_data_action: bool=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 + self.is_data_action = is_data_action diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata.py index 44e25c5a7d19..8e13bb134567 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata.py @@ -38,10 +38,11 @@ class ProviderOperationsMetadata(Model): 'operations': {'key': 'operations', 'type': '[ProviderOperation]'}, } - def __init__(self, id=None, name=None, type=None, display_name=None, resource_types=None, operations=None): - self.id = id - self.name = name - self.type = type - self.display_name = display_name - self.resource_types = resource_types - self.operations = operations + 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/models/provider_operations_metadata_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata_py3.py new file mode 100644 index 000000000000..f95caeb8b68f --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/provider_operations_metadata_py3.py @@ -0,0 +1,48 @@ +# 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.models.ResourceType] + :param operations: The provider operations. + :type operations: list[~azure.mgmt.authorization.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/models/resource_type.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/resource_type.py index b5e89bef963a..9cc2ab69019f 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/resource_type.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/resource_type.py @@ -29,7 +29,8 @@ class ResourceType(Model): 'operations': {'key': 'operations', 'type': '[ProviderOperation]'}, } - def __init__(self, name=None, display_name=None, operations=None): - self.name = name - self.display_name = display_name - self.operations = operations + 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/models/resource_type_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/resource_type_py3.py new file mode 100644 index 000000000000..78d6a0b98a54 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/resource_type_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 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.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/models/role_assignment.py index f902eccea1a3..599d04d0b2cf 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment.py @@ -15,26 +15,47 @@ class RoleAssignment(Model): """Role Assignments. - :param id: The role assignment ID. - :type id: str - :param name: The role assignment name. - :type name: str - :param type: The role assignment type. - :type type: str - :param properties: Role assignment properties. - :type properties: - ~azure.mgmt.authorization.models.RoleAssignmentPropertiesWithScope + 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 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 + :param can_delegate: The Delegation flag for the roleassignment + :type can_delegate: bool """ + _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'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'can_delegate': {'key': 'properties.canDelegate', 'type': 'bool'}, } - def __init__(self, id=None, name=None, type=None, properties=None): - self.id = id - self.name = name - self.type = type - self.properties = properties + def __init__(self, **kwargs): + super(RoleAssignment, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.scope = kwargs.get('scope', None) + self.role_definition_id = kwargs.get('role_definition_id', None) + self.principal_id = kwargs.get('principal_id', None) + self.can_delegate = kwargs.get('can_delegate', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_create_parameters.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_create_parameters.py index 758231145cbc..5da7259a980e 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_create_parameters.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_create_parameters.py @@ -15,14 +15,26 @@ class RoleAssignmentCreateParameters(Model): """Role assignment create parameters. - :param properties: Role assignment properties. - :type properties: - ~azure.mgmt.authorization.models.RoleAssignmentProperties + :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 + :param can_delegate: The delgation flag used for creating a role + assignment + :type can_delegate: bool """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RoleAssignmentProperties'}, + 'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'can_delegate': {'key': 'properties.canDelegate', 'type': 'bool'}, } - def __init__(self, properties=None): - self.properties = properties + def __init__(self, **kwargs): + super(RoleAssignmentCreateParameters, self).__init__(**kwargs) + self.role_definition_id = kwargs.get('role_definition_id', None) + self.principal_id = kwargs.get('principal_id', None) + self.can_delegate = kwargs.get('can_delegate', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_properties.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_create_parameters_py3.py similarity index 60% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_properties.py rename to azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_create_parameters_py3.py index 1548fe078839..7570e2aa0234 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_properties.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_create_parameters_py3.py @@ -12,8 +12,8 @@ from msrest.serialization import Model -class RoleAssignmentProperties(Model): - """Role assignment properties. +class RoleAssignmentCreateParameters(Model): + """Role assignment create parameters. :param role_definition_id: The role definition ID used in the role assignment. @@ -22,13 +22,19 @@ class RoleAssignmentProperties(Model): the ID inside the Active Directory. It can point to a user, service principal, or security group. :type principal_id: str + :param can_delegate: The delgation flag used for creating a role + assignment + :type can_delegate: bool """ _attribute_map = { - 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'can_delegate': {'key': 'properties.canDelegate', 'type': 'bool'}, } - def __init__(self, role_definition_id=None, principal_id=None): + def __init__(self, *, role_definition_id: str=None, principal_id: str=None, can_delegate: bool=None, **kwargs) -> None: + super(RoleAssignmentCreateParameters, self).__init__(**kwargs) self.role_definition_id = role_definition_id self.principal_id = principal_id + self.can_delegate = can_delegate diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_filter.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_filter.py index 9245c6be8bde..940b6baccc3c 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_filter.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_filter.py @@ -17,11 +17,16 @@ class RoleAssignmentFilter(Model): :param principal_id: Returns role assignment of the specific principal. :type principal_id: str + :param can_delegate: The Delegation flag for the roleassignment + :type can_delegate: bool """ _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'can_delegate': {'key': 'canDelegate', 'type': 'bool'}, } - def __init__(self, principal_id=None): - self.principal_id = principal_id + def __init__(self, **kwargs): + super(RoleAssignmentFilter, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.can_delegate = kwargs.get('can_delegate', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_properties_with_scope.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_filter_py3.py similarity index 54% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_properties_with_scope.py rename to azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_filter_py3.py index 87a5240e9024..cfa2af336134 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_properties_with_scope.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_filter_py3.py @@ -12,24 +12,21 @@ from msrest.serialization import Model -class RoleAssignmentPropertiesWithScope(Model): - """Role assignment properties with scope. +class RoleAssignmentFilter(Model): + """Role Assignments filter. - :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. + :param principal_id: Returns role assignment of the specific principal. :type principal_id: str + :param can_delegate: The Delegation flag for the roleassignment + :type can_delegate: bool """ _attribute_map = { - 'scope': {'key': 'scope', 'type': 'str'}, - 'role_definition_id': {'key': 'roleDefinitionId', 'type': 'str'}, 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'can_delegate': {'key': 'canDelegate', 'type': 'bool'}, } - def __init__(self, scope=None, role_definition_id=None, principal_id=None): - self.scope = scope - self.role_definition_id = role_definition_id + def __init__(self, *, principal_id: str=None, can_delegate: bool=None, **kwargs) -> None: + super(RoleAssignmentFilter, self).__init__(**kwargs) self.principal_id = principal_id + self.can_delegate = can_delegate diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_py3.py new file mode 100644 index 000000000000..15af2402089d --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_py3.py @@ -0,0 +1,61 @@ +# 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 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 + :param can_delegate: The Delegation flag for the roleassignment + :type can_delegate: bool + """ + + _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'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'can_delegate': {'key': 'properties.canDelegate', 'type': 'bool'}, + } + + def __init__(self, *, scope: str=None, role_definition_id: str=None, principal_id: str=None, can_delegate: bool=None, **kwargs) -> None: + super(RoleAssignment, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.scope = scope + self.role_definition_id = role_definition_id + self.principal_id = principal_id + self.can_delegate = can_delegate diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition.py index a4a964be8195..650dfa9d5382 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition.py @@ -15,26 +15,51 @@ class RoleDefinition(Model): """Role definition. - :param id: The role definition ID. - :type id: str - :param name: The role definition name. - :type name: str - :param type: The role definition type. - :type type: str - :param properties: Role definition properties. - :type properties: - ~azure.mgmt.authorization.models.RoleDefinitionProperties + 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 role_name: The role name. + :type role_name: str + :param description: The role definition description. + :type description: str + :param role_type: The role type. + :type role_type: str + :param permissions: Role definition permissions. + :type permissions: list[~azure.mgmt.authorization.models.Permission] + :param assignable_scopes: Role definition assignable scopes. + :type assignable_scopes: list[str] """ + _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'}, + 'role_name': {'key': 'properties.roleName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'role_type': {'key': 'properties.type', 'type': 'str'}, + 'permissions': {'key': 'properties.permissions', 'type': '[Permission]'}, + 'assignable_scopes': {'key': 'properties.assignableScopes', 'type': '[str]'}, } - def __init__(self, id=None, name=None, type=None, properties=None): - self.id = id - self.name = name - self.type = type - self.properties = properties + def __init__(self, **kwargs): + super(RoleDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.role_name = kwargs.get('role_name', None) + self.description = kwargs.get('description', None) + self.role_type = kwargs.get('role_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/models/role_definition_filter.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_filter.py index 4a59d8828754..1fc9ae59aa3a 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_filter.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_filter.py @@ -17,11 +17,16 @@ class RoleDefinitionFilter(Model): :param role_name: Returns role definition with the specific name. :type role_name: str + :param type: Returns role definition with the specific type. + :type type: str """ _attribute_map = { 'role_name': {'key': 'roleName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, role_name=None): - self.role_name = role_name + def __init__(self, **kwargs): + super(RoleDefinitionFilter, self).__init__(**kwargs) + self.role_name = kwargs.get('role_name', None) + self.type = kwargs.get('type', None) diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator_properties.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_filter_py3.py similarity index 50% rename from azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator_properties.py rename to azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_filter_py3.py index b07e4e172d7b..e511adc3df35 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/classic_administrator_properties.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_filter_py3.py @@ -12,20 +12,21 @@ from msrest.serialization import Model -class ClassicAdministratorProperties(Model): - """Classic Administrator properties. +class RoleDefinitionFilter(Model): + """Role Definitions filter. - :param email_address: The email address of the administrator. - :type email_address: str - :param role: The role of the administrator. - :type role: str + :param role_name: Returns role definition with the specific name. + :type role_name: str + :param type: Returns role definition with the specific type. + :type type: str """ _attribute_map = { - 'email_address': {'key': 'emailAddress', 'type': 'str'}, - 'role': {'key': 'role', 'type': 'str'}, + 'role_name': {'key': 'roleName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, email_address=None, role=None): - self.email_address = email_address - self.role = role + def __init__(self, *, role_name: str=None, type: str=None, **kwargs) -> None: + super(RoleDefinitionFilter, self).__init__(**kwargs) + self.role_name = role_name + self.type = type diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_properties.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_properties.py deleted file mode 100644 index 9f6d8c4378a4..000000000000 --- a/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_properties.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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.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=None, description=None, type=None, permissions=None, assignable_scopes=None): - 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/models/role_definition_py3.py b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_py3.py new file mode 100644 index 000000000000..c3533531c8d3 --- /dev/null +++ b/azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_py3.py @@ -0,0 +1,65 @@ +# 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 role_name: The role name. + :type role_name: str + :param description: The role definition description. + :type description: str + :param role_type: The role type. + :type role_type: str + :param permissions: Role definition permissions. + :type permissions: list[~azure.mgmt.authorization.models.Permission] + :param assignable_scopes: Role definition assignable scopes. + :type assignable_scopes: list[str] + """ + + _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'}, + 'role_name': {'key': 'properties.roleName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'role_type': {'key': 'properties.type', 'type': 'str'}, + 'permissions': {'key': 'properties.permissions', 'type': '[Permission]'}, + 'assignable_scopes': {'key': 'properties.assignableScopes', 'type': '[str]'}, + } + + def __init__(self, *, role_name: str=None, description: str=None, role_type: str=None, permissions=None, assignable_scopes=None, **kwargs) -> None: + super(RoleDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.role_name = role_name + self.description = description + self.role_type = role_type + self.permissions = permissions + self.assignable_scopes = assignable_scopes diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/operations/__init__.py b/azure-mgmt-authorization/azure/mgmt/authorization/operations/__init__.py index d0f4cbe64419..98bf8abf8854 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/operations/__init__.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/operations/__init__.py @@ -10,15 +10,15 @@ # -------------------------------------------------------------------------- from .classic_administrators_operations import ClassicAdministratorsOperations -from .permissions_operations import PermissionsOperations 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__ = [ 'ClassicAdministratorsOperations', - 'PermissionsOperations', 'ProviderOperationsMetadataOperations', + 'PermissionsOperations', 'RoleAssignmentsOperations', 'RoleDefinitionsOperations', ] diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/operations/classic_administrators_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/operations/classic_administrators_operations.py index 881f1ca1466c..fc4ed72a0995 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/operations/classic_administrators_operations.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/operations/classic_administrators_operations.py @@ -22,24 +22,26 @@ class ClassicAdministratorsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2015-06-01". """ + models = models + def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer + self.api_version = "2015-06-01" self.config = config def list( - self, api_version, custom_headers=None, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """Gets service administrator, account administrator, and co-administrators for the subscription. - :param api_version: The API version to use for this operation. - :type api_version: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -54,7 +56,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators' + url = self.list.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -62,7 +64,7 @@ def internal_paging(next_link=None, raw=False): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link @@ -81,7 +83,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -99,3 +101,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators'} diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/operations/permissions_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/operations/permissions_operations.py index 9f3fff7f2d2c..95c4ffd59806 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/operations/permissions_operations.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/operations/permissions_operations.py @@ -22,16 +22,18 @@ class PermissionsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2015-07-01". + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2018-01-01-preview". """ + 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.api_version = "2018-01-01-preview" self.config = config @@ -39,8 +41,7 @@ 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. + :param resource_group_name: The name of the resource group. :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 @@ -56,7 +57,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions' + 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') @@ -84,7 +85,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -102,13 +103,13 @@ def internal_paging(next_link=None, raw=False): 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. + :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. @@ -134,7 +135,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions' + 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'), @@ -166,7 +167,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -184,3 +185,4 @@ def internal_paging(next_link=None, raw=False): 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/operations/provider_operations_metadata_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/operations/provider_operations_metadata_operations.py index e65699e3bc63..79b5f349aa78 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/operations/provider_operations_metadata_operations.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/operations/provider_operations_metadata_operations.py @@ -22,26 +22,28 @@ class ProviderOperationsMetadataOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2018-01-01-preview". """ + models = models + def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer + self.api_version = "2018-01-01-preview" self.config = config def get( - self, resource_provider_namespace, api_version, expand="resourceTypes", custom_headers=None, raw=False, **operation_config): + self, resource_provider_namespace, 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 @@ -55,7 +57,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}' + url = self.get.metadata['url'] path_format_arguments = { 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str') } @@ -63,7 +65,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') if expand is not None: query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') @@ -79,7 +81,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -96,13 +98,12 @@ def get( 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): + self, 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 @@ -119,11 +120,11 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/providers/Microsoft.Authorization/providerOperations' + url = self.list.metadata['url'] # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') if expand is not None: query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') @@ -144,7 +145,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -162,3 +163,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/providerOperations'} diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/operations/role_assignments_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/operations/role_assignments_operations.py index df2216cd437c..0e162d28c1ef 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/operations/role_assignments_operations.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/operations/role_assignments_operations.py @@ -22,16 +22,18 @@ class RoleAssignmentsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2015-07-01". + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2018-01-01-preview". """ + 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.api_version = "2018-01-01-preview" self.config = config @@ -70,7 +72,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments' + 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'), @@ -104,7 +106,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -122,6 +124,7 @@ def internal_paging(next_link=None, raw=False): 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): @@ -148,7 +151,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments' + 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') @@ -178,7 +181,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -196,6 +199,7 @@ def internal_paging(next_link=None, raw=False): 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): @@ -217,7 +221,7 @@ def delete( :raises: :class:`CloudError` """ # Construct URL - url = '/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}' + 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') @@ -240,7 +244,7 @@ def delete( # Construct and send request request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -257,9 +261,10 @@ def delete( 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): + self, scope, role_assignment_name, parameters, custom_headers=None, raw=False, **operation_config): """Creates a role assignment. :param scope: The scope of the role assignment to create. The scope @@ -273,9 +278,9 @@ def create( :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.models.RoleAssignmentProperties + :param parameters: Parameters for the role assignment. + :type parameters: + ~azure.mgmt.authorization.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 @@ -286,10 +291,8 @@ def create( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - parameters = models.RoleAssignmentCreateParameters(properties=properties) - # Construct URL - url = '/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}' + 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') @@ -316,7 +319,7 @@ def create( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [201]: exp = CloudError(response) @@ -333,6 +336,7 @@ def create( 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): @@ -353,7 +357,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}' + 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') @@ -376,7 +380,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -393,18 +397,14 @@ def get( 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): + self, role_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 role_id: The ID of the role assignment to delete. + :type role_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 @@ -416,9 +416,9 @@ def delete_by_id( :raises: :class:`CloudError` """ # Construct URL - url = '/{roleAssignmentId}' + url = self.delete_by_id.metadata['url'] path_format_arguments = { - 'roleAssignmentId': self._serialize.url("role_assignment_id", role_assignment_id, 'str', skip_quote=True) + 'roleId': self._serialize.url("role_id", role_id, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -438,7 +438,7 @@ def delete_by_id( # Construct and send request request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -455,21 +455,17 @@ def delete_by_id( return client_raw_response return deserialized + delete_by_id.metadata = {'url': '/{roleId}'} def create_by_id( - self, role_assignment_id, properties=None, custom_headers=None, raw=False, **operation_config): + self, role_id, parameters, 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.models.RoleAssignmentProperties + :param role_id: The ID of the role assignment to create. + :type role_id: str + :param parameters: Parameters for the role assignment. + :type parameters: + ~azure.mgmt.authorization.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 @@ -480,12 +476,10 @@ def create_by_id( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - parameters = models.RoleAssignmentCreateParameters(properties=properties) - # Construct URL - url = '/{roleAssignmentId}' + url = self.create_by_id.metadata['url'] path_format_arguments = { - 'roleAssignmentId': self._serialize.url("role_assignment_id", role_assignment_id, 'str', skip_quote=True) + 'roleId': self._serialize.url("role_id", role_id, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -509,7 +503,7 @@ def create_by_id( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [201]: exp = CloudError(response) @@ -526,18 +520,14 @@ def create_by_id( return client_raw_response return deserialized + create_by_id.metadata = {'url': '/{roleId}'} def get_by_id( - self, role_assignment_id, custom_headers=None, raw=False, **operation_config): + self, role_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 role_id: The ID of the role assignment to get. + :type role_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 @@ -549,9 +539,9 @@ def get_by_id( :raises: :class:`CloudError` """ # Construct URL - url = '/{roleAssignmentId}' + url = self.get_by_id.metadata['url'] path_format_arguments = { - 'roleAssignmentId': self._serialize.url("role_assignment_id", role_assignment_id, 'str', skip_quote=True) + 'roleId': self._serialize.url("role_id", role_id, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -571,7 +561,7 @@ def get_by_id( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -588,6 +578,7 @@ def get_by_id( return client_raw_response return deserialized + get_by_id.metadata = {'url': '/{roleId}'} def list( self, filter=None, custom_headers=None, raw=False, **operation_config): @@ -612,7 +603,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments' + url = self.list.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } @@ -641,7 +632,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -659,6 +650,7 @@ def internal_paging(next_link=None, raw=False): 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): @@ -685,7 +677,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/{scope}/providers/Microsoft.Authorization/roleAssignments' + url = self.list_for_scope.metadata['url'] path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) } @@ -714,7 +706,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -732,3 +724,4 @@ def internal_paging(next_link=None, raw=False): 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/operations/role_definitions_operations.py b/azure-mgmt-authorization/azure/mgmt/authorization/operations/role_definitions_operations.py index f20886e85470..0a20d15ca218 100644 --- a/azure-mgmt-authorization/azure/mgmt/authorization/operations/role_definitions_operations.py +++ b/azure-mgmt-authorization/azure/mgmt/authorization/operations/role_definitions_operations.py @@ -22,16 +22,18 @@ class RoleDefinitionsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2015-07-01". + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2018-01-01-preview". """ + 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.api_version = "2018-01-01-preview" self.config = config @@ -54,7 +56,7 @@ def delete( :raises: :class:`CloudError` """ # Construct URL - url = '/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}' + 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') @@ -77,7 +79,7 @@ def delete( # Construct and send request request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -94,6 +96,7 @@ def delete( 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): @@ -114,7 +117,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}' + 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') @@ -137,7 +140,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -154,6 +157,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}'} def create_or_update( self, scope, role_definition_id, role_definition, custom_headers=None, raw=False, **operation_config): @@ -176,7 +180,7 @@ def create_or_update( :raises: :class:`CloudError` """ # Construct URL - url = '/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}' + 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') @@ -203,7 +207,7 @@ def create_or_update( # Construct and send request request = self._client.put(url, query_parameters) response = self._client.send( - request, header_parameters, body_content, **operation_config) + request, header_parameters, body_content, stream=False, **operation_config) if response.status_code not in [201]: exp = CloudError(response) @@ -220,68 +224,7 @@ def create_or_update( return client_raw_response return deserialized - - 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.models.RoleDefinition or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = '/{roleDefinitionId}' - 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, **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 + create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}'} def list( self, scope, filter=None, custom_headers=None, raw=False, **operation_config): @@ -306,7 +249,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/{scope}/providers/Microsoft.Authorization/roleDefinitions' + url = self.list.metadata['url'] path_format_arguments = { 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) } @@ -335,7 +278,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -353,3 +296,67 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleDefinitions'} + + def get_by_id( + self, role_id, custom_headers=None, raw=False, **operation_config): + """Gets a role definition by ID. + + :param role_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_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.models.RoleDefinition or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'roleId': self._serialize.url("role_id", role_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': '/{roleId}'} diff --git a/azure-mgmt-authorization/azure/mgmt/authorization/version.py b/azure-mgmt-authorization/azure/mgmt/authorization/version.py index b9a4e2bd3544..57866fdf17d0 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.30.0" +VERSION = "0.40.0" diff --git a/azure-mgmt-authorization/setup.py b/azure-mgmt-authorization/setup.py index 44ca935c7241..75101d52addb 100644 --- a/azure-mgmt-authorization/setup.py +++ b/azure-mgmt-authorization/setup.py @@ -61,7 +61,7 @@ long_description=readme + '\n\n' + history, license='MIT License', author='Microsoft Corporation', - author_email='ptvshelp@microsoft.com', + author_email='azpysdkhelp@microsoft.com', url='https://github.com/Azure/azure-sdk-for-python', classifiers=[ 'Development Status :: 4 - Beta', @@ -69,17 +69,16 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'License :: OSI Approved :: MIT License', ], zip_safe=False, - packages=find_packages(), + packages=find_packages(exclude=["tests"]), install_requires=[ - 'msrestazure~=0.4.7', - 'azure-common~=1.1.5', + 'msrestazure>=0.4.20,<2.0.0', + 'azure-common~=1.1', ], cmdclass=cmdclass ) diff --git a/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_authorization.yaml b/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_authorization.yaml new file mode 100644 index 000000000000..915d0409e9da --- /dev/null +++ b/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_authorization.yaml @@ -0,0 +1,32 @@ +interactions: +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.22 azure-mgmt-authorization/0.40.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test_mgmt_authorization_test_authorization7af511a3/providers/Microsoft.Authorization/permissions?api-version=2018-01-01-preview + response: + body: {string: '{"value":[{"actions":["*"],"notActions":[],"dataActions":[],"notDataActions":[]}]}'} + headers: + cache-control: [no-cache] + content-length: ['82'] + content-type: [application/json; charset=utf-8] + date: ['Fri, 09 Mar 2018 01:04:11 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/10.0] + set-cookie: [x-ms-gateway-slice=productionb; path=/; secure; HttpOnly] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-ms-request-charge: ['1'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +version: 1 diff --git a/azure-mgmt/tests/test_mgmt_authorization.py b/azure-mgmt-authorization/tests/test_mgmt_authorization.py similarity index 78% rename from azure-mgmt/tests/test_mgmt_authorization.py rename to azure-mgmt-authorization/tests/test_mgmt_authorization.py index f76bd327007f..47902288516c 100644 --- a/azure-mgmt/tests/test_mgmt_authorization.py +++ b/azure-mgmt-authorization/tests/test_mgmt_authorization.py @@ -8,9 +8,7 @@ import unittest import azure.mgmt.authorization -from testutils.common_recordingtestcase import record -from tests.mgmt_testcase import HttpStatusCode, AzureMgmtTestCase - +from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer class MgmtAuthorizationTest(AzureMgmtTestCase): @@ -19,13 +17,11 @@ def setUp(self): self.authorization_client = self.create_mgmt_client( azure.mgmt.authorization.AuthorizationManagementClient ) - if not self.is_playback(): - self.create_resource_group() - @record - def test_authorization(self): + @ResourceGroupPreparer() + def test_authorization(self, resource_group, location): permissions = self.authorization_client.permissions.list_for_resource_group( - self.group_name + resource_group.name ) permissions = list(permissions) diff --git a/azure-mgmt/tests/recordings/test_mgmt_authorization.test_authorization.yaml b/azure-mgmt/tests/recordings/test_mgmt_authorization.test_authorization.yaml deleted file mode 100644 index ca0808365c63..000000000000 --- a/azure-mgmt/tests/recordings/test_mgmt_authorization.test_authorization.yaml +++ /dev/null @@ -1,206 +0,0 @@ -interactions: -- request: - body: !!binary | - eyJsb2NhdGlvbiI6ICJ3ZXN0dXMiLCAibmFtZSI6ICJ0ZXN0X21nbXRfYXV0aG9yaXphdGlvbl90 - ZXN0X2F1dGhvcml6YXRpb243YWY1MTFhMyJ9 - headers: - Accept: ['*/*'] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['84'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 requests/2.7.0 msrest/0.0.1 msrest_azure/0.0.1 resourcemanagementclient/2015-11-01] - accept-language: [en-US] - x-ms-client-request-id: [556b2854-d0fa-11e5-8b5e-54ee7574ca37] - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test_mgmt_authorization_test_authorization7af511a3?api-version=2015-11-01 - response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_authorization_test_authorization7af511a3","name":"test_mgmt_authorization_test_authorization7af511a3","location":"westus","properties":{"provisioningState":"Succeeded"}}'} - headers: - Cache-Control: [no-cache] - Content-Length: ['253'] - Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 11 Feb 2016 20:02:10 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-correlation-request-id: [386b970f-3a6d-425c-b2d3-0c806166e7ba] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] - x-ms-request-id: [386b970f-3a6d-425c-b2d3-0c806166e7ba] - x-ms-routing-request-id: ['EASTUS:20160211T200211Z:386b970f-3a6d-425c-b2d3-0c806166e7ba'] - status: {code: 201, message: Created} -- request: - body: null - headers: - Accept: ['*/*'] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 requests/2.7.0 msrest/0.0.1 msrest_azure/0.0.1 authorizationmanagementclient/2015-07-01] - accept-language: [en-US] - x-ms-client-request-id: [564ebc62-d0fa-11e5-8a60-54ee7574ca37] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test_mgmt_authorization_test_authorization7af511a3/providers/Microsoft.Authorization/permissions?api-version=2015-07-01 - response: - body: - string: !!binary | - H4sIAAAAAAAEAO29B2AcSZYlJi9tynt/SvVK1+B0oQiAYBMk2JBAEOzBiM3mkuwdaUcjKasqgcpl - VmVdZhZAzO2dvPfee++999577733ujudTif33/8/XGZkAWz2zkrayZ4hgKrIHz9+fB8/In7xR5dZ - uc4/evS9X/xRNm2LatnQ7x9966Pvjz5aVu2x/ej7vwSf5O/a58Xy7UePluuy/CX/DyaRUJA9AAAA - headers: - Cache-Control: [no-cache] - Content-Encoding: [gzip] - Content-Type: [application/json; charset=utf-8] - Date: ['Thu, 11 Feb 2016 20:02:10 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-IIS/8.5] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - X-Content-Type-Options: [nosniff] - X-Powered-By: [ASP.NET] - x-ms-correlation-request-id: [d849f8e5-9bf5-420f-a9e0-2c6afefc39aa] - x-ms-gateway-service-instanceid: [PASFE_IN_2] - x-ms-ratelimit-remaining-subscription-reads: ['14999'] - x-ms-request-id: [a1b42551-9b7f-4d71-8004-75e08fded7a8] - x-ms-routing-request-id: ['EASTUS:20160211T200211Z:d849f8e5-9bf5-420f-a9e0-2c6afefc39aa'] - status: {code: 200, message: OK} -- request: - body: !!binary | - eyJsb2NhdGlvbiI6ICJ3ZXN0dXMiLCAibmFtZSI6ICJ0ZXN0X21nbXRfYXV0aG9yaXphdGlvbl90 - ZXN0X2F1dGhvcml6YXRpb243YWY1MTFhMyJ9 - headers: - Accept: ['*/*'] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['84'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 requests/2.7.0 msrest/0.0.1 msrest_azure/0.0.1 resourcemanagementclient/2015-11-01] - accept-language: [en-US] - x-ms-client-request-id: [87086878-d4da-11e5-a7ec-54ee7574ca37] - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test_mgmt_authorization_test_authorization7af511a3?api-version=2015-11-01 - response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_authorization_test_authorization7af511a3","name":"test_mgmt_authorization_test_authorization7af511a3","location":"westus","properties":{"provisioningState":"Succeeded"}}'} - headers: - Cache-Control: [no-cache] - Content-Length: ['253'] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 16 Feb 2016 18:24:34 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-correlation-request-id: [d14b8470-e74b-43b0-b382-0fdbc8c5116c] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] - x-ms-request-id: [d14b8470-e74b-43b0-b382-0fdbc8c5116c] - x-ms-routing-request-id: ['CENTRALUS:20160216T182434Z:d14b8470-e74b-43b0-b382-0fdbc8c5116c'] - status: {code: 201, message: Created} -- request: - body: null - headers: - Accept: ['*/*'] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 requests/2.7.0 msrest/0.0.1 msrest_azure/0.0.1 authorizationmanagementclient/2015-07-01] - accept-language: [en-US] - x-ms-client-request-id: [879c2c68-d4da-11e5-b170-54ee7574ca37] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test_mgmt_authorization_test_authorization7af511a3/providers/Microsoft.Authorization/permissions?api-version=2015-07-01 - response: - body: - string: !!binary | - H4sIAAAAAAAEAO29B2AcSZYlJi9tynt/SvVK1+B0oQiAYBMk2JBAEOzBiM3mkuwdaUcjKasqgcpl - VmVdZhZAzO2dvPfee++999577733ujudTif33/8/XGZkAWz2zkrayZ4hgKrIHz9+fB8/In7xR5dZ - uc4/evS9X/xRNm2LatnQ7x9966Pvjz5aVu2x/ej7vwSf5O/a58Xy7UePluuy/CX/DyaRUJA9AAAA - headers: - Cache-Control: [no-cache] - Content-Encoding: [gzip] - Content-Type: [application/json; charset=utf-8] - Date: ['Tue, 16 Feb 2016 18:24:35 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-IIS/8.5] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - X-Content-Type-Options: [nosniff] - X-Powered-By: [ASP.NET] - x-ms-correlation-request-id: [3f11888c-9f40-46f4-87ae-dfdef595c678] - x-ms-gateway-service-instanceid: [PASFE_IN_2] - x-ms-ratelimit-remaining-subscription-reads: ['14996'] - x-ms-request-id: [dd31644e-51b5-41ea-b773-94ce3ed9499e] - x-ms-routing-request-id: ['CENTRALUS:20160216T182435Z:3f11888c-9f40-46f4-87ae-dfdef595c678'] - status: {code: 200, message: OK} -- request: - body: !!binary | - eyJuYW1lIjogInRlc3RfbWdtdF9hdXRob3JpemF0aW9uX3Rlc3RfYXV0aG9yaXphdGlvbjdhZjUx - MWEzIiwgImxvY2F0aW9uIjogIndlc3R1cyJ9 - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['84'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 requests/2.7.0 msrest/0.2.0 msrest_azure/0.2.0 resourcemanagementclient/2016-02-01 - Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [2444b26e-f2be-11e5-8f70-54ee7574ca37] - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test_mgmt_authorization_test_authorization7af511a3?api-version=2016-02-01 - response: - body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_authorization_test_authorization7af511a3","name":"test_mgmt_authorization_test_authorization7af511a3","location":"westus","properties":{"provisioningState":"Succeeded"}}'} - headers: - Cache-Control: [no-cache] - Content-Length: ['253'] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 25 Mar 2016 19:16:58 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - x-ms-correlation-request-id: [60737e6b-7000-45d2-b64c-0b0c220828ce] - x-ms-ratelimit-remaining-subscription-writes: ['1197'] - x-ms-request-id: [60737e6b-7000-45d2-b64c-0b0c220828ce] - x-ms-routing-request-id: ['EASTUS:20160325T191658Z:60737e6b-7000-45d2-b64c-0b0c220828ce'] - status: {code: 201, message: Created} -- request: - body: null - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.5.1 requests/2.7.0 msrest/0.2.0 msrest_azure/0.2.0 authorizationmanagementclient/2015-07-01 - Azure-SDK-For-Python] - accept-language: [en-US] - x-ms-client-request-id: [256eaa2e-f2be-11e5-9e3e-54ee7574ca37] - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test_mgmt_authorization_test_authorization7af511a3/providers/Microsoft.Authorization/permissions?api-version=2015-07-01 - response: - body: - string: !!binary | - H4sIAAAAAAAEAO29B2AcSZYlJi9tynt/SvVK1+B0oQiAYBMk2JBAEOzBiM3mkuwdaUcjKasqgcpl - VmVdZhZAzO2dvPfee++999577733ujudTif33/8/XGZkAWz2zkrayZ4hgKrIHz9+fB8/In7xR5dZ - uc4/evS9X/xRNm2LatnQ7x9966Pvjz5aVu2x++iLYlpXTXXejo/X7byqix9k+O7ut+4+zcu8zT8a - bWjy3bqgFt//JYCav2ufF8u3Hz1arsvyl/w/1XpbMIEAAAA= - headers: - Cache-Control: [no-cache] - Content-Encoding: [gzip] - Content-Type: [application/json; charset=utf-8] - Date: ['Fri, 25 Mar 2016 19:16:56 GMT'] - Expires: ['-1'] - Pragma: [no-cache] - Server: [Microsoft-IIS/8.5] - Strict-Transport-Security: [max-age=31536000; includeSubDomains] - Transfer-Encoding: [chunked] - Vary: [Accept-Encoding] - X-Content-Type-Options: [nosniff] - X-Powered-By: [ASP.NET] - x-ms-correlation-request-id: [798487f8-ef9f-48f3-aab2-ec59dfee0e82] - x-ms-gateway-service-instanceid: [PASFE_IN_2] - x-ms-ratelimit-remaining-subscription-reads: ['14997'] - x-ms-request-id: [1dde1189-300c-4886-acb5-f47b5be338b2] - x-ms-routing-request-id: ['EASTUS:20160325T191656Z:798487f8-ef9f-48f3-aab2-ec59dfee0e82'] - status: {code: 200, message: OK} -version: 1