From 5d277ae7bf0be5d61d25473a381947b8a18863e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E7=AE=AD=E9=A3=9E?= <32889038+chenjianfei2017@users.noreply.github.com> Date: Fri, 14 Aug 2020 12:46:46 +0800 Subject: [PATCH] Authoriaztion release 0814 (#13109) * Generated from 77e263ef8341b9d756874a8015822f11088de88d revise tag of authorization * release authorization * add test * Packaging update of azure-mgmt-authorization Co-authored-by: SDK Automation Co-authored-by: Chenjianfei Co-authored-by: Azure SDK Bot --- .../azure-mgmt-authorization/CHANGELOG.md | 11 + .../azure-mgmt-authorization/README.md | 30 +- .../_authorization_management_client.py | 7 + .../v2020_04_01_preview/__init__.py | 19 + .../_authorization_management_client.py | 49 ++ .../v2020_04_01_preview/_configuration.py | 48 ++ .../v2020_04_01_preview/models/__init__.py | 31 + .../_authorization_management_client_enums.py | 26 + .../v2020_04_01_preview/models/_models.py | 168 ++++ .../v2020_04_01_preview/models/_models_py3.py | 168 ++++ .../models/_paged_models.py | 27 + .../operations/__init__.py | 16 + .../_role_assignments_operations.py | 733 ++++++++++++++++++ .../v2020_04_01_preview/version.py | 13 + .../azure/mgmt/authorization/version.py | 2 +- .../azure-mgmt-authorization/setup.py | 6 +- ...mgmt_authorization.test_authorization.yaml | 61 +- ...mt_authorization.test_role_assignment.yaml | 134 ++-- ...t_authorization.test_role_definitions.yaml | 61 +- 19 files changed, 1495 insertions(+), 115 deletions(-) create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/__init__.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_authorization_management_client.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_configuration.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/__init__.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_authorization_management_client_enums.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models_py3.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_paged_models.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/__init__.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/_role_assignments_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/version.py diff --git a/sdk/authorization/azure-mgmt-authorization/CHANGELOG.md b/sdk/authorization/azure-mgmt-authorization/CHANGELOG.md index 4bbd1e9ac5a1..45e866b1bf52 100644 --- a/sdk/authorization/azure-mgmt-authorization/CHANGELOG.md +++ b/sdk/authorization/azure-mgmt-authorization/CHANGELOG.md @@ -1,5 +1,16 @@ # Release History +## 0.61.0 (2020-08-10) + +**Features** + + - Model RoleAssignmentCreateParameters has a new parameter condition + - Model RoleAssignmentCreateParameters has a new parameter description + - Model RoleAssignmentCreateParameters has a new parameter condition_version + - Model RoleAssignment has a new parameter condition + - Model RoleAssignment has a new parameter description + - Model RoleAssignment has a new parameter condition_version + ## 0.60.0 (2019-06-25) **Breaking changes** diff --git a/sdk/authorization/azure-mgmt-authorization/README.md b/sdk/authorization/azure-mgmt-authorization/README.md index 30f2f63dad42..ce40b99542e8 100644 --- a/sdk/authorization/azure-mgmt-authorization/README.md +++ b/sdk/authorization/azure-mgmt-authorization/README.md @@ -1,29 +1,21 @@ -## Microsoft Azure SDK for Python +# Microsoft Azure SDK for Python This is the Microsoft Azure Authorization Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). -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.4, 3.5, 3.6 and 3.7. +# Usage -For the older Azure Service Management (ASM) libraries, see -[azure-servicemanagement-legacy](https://pypi.python.org/pypi/azure-servicemanagement-legacy) -library. - -For a more complete set of Azure libraries, see the -[azure sdk python release](https://aka.ms/azsdk/python/all). - -## Usage - -For code examples, see [Authorization -Management](https://docs.microsoft.com/python/api/overview/azure/authorization) +For code examples, see [Authorization Management](https://docs.microsoft.com/python/api/overview/azure/authorization) on docs.microsoft.com. -## Provide Feedback -If you encounter any bugs or have suggestions, please file an issue in -the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. -![image](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-authorization%2FREADME.png) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-authorization%2FREADME.png) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_authorization_management_client.py index 5661b57e0ad0..a0f3743f3b87 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_authorization_management_client.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_authorization_management_client.py @@ -83,6 +83,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2018-01-01-preview: :mod:`v2018_01_01_preview.models` * 2018-07-01-preview: :mod:`v2018_07_01_preview.models` * 2018-09-01-preview: :mod:`v2018_09_01_preview.models` + * 2020-04-01-preview: :mod:`v2020_04_01_preview.models` """ if api_version == '2015-06-01': from .v2015_06_01 import models @@ -99,6 +100,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2018-09-01-preview': from .v2018_09_01_preview import models return models + elif api_version == '2020-04-01-preview': + from .v2020_04_01_preview import models + return models raise NotImplementedError("APIVersion {} is not available".format(api_version)) @property @@ -182,6 +186,7 @@ def role_assignments(self): * 2015-07-01: :class:`RoleAssignmentsOperations` * 2018-01-01-preview: :class:`RoleAssignmentsOperations` * 2018-09-01-preview: :class:`RoleAssignmentsOperations` + * 2020-04-01-preview: :class:`RoleAssignmentsOperations` """ api_version = self._get_api_version('role_assignments') if api_version == '2015-07-01': @@ -190,6 +195,8 @@ def role_assignments(self): from .v2018_01_01_preview.operations import RoleAssignmentsOperations as OperationClass elif api_version == '2018-09-01-preview': from .v2018_09_01_preview.operations import RoleAssignmentsOperations as OperationClass + elif api_version == '2020-04-01-preview': + from .v2020_04_01_preview.operations import RoleAssignmentsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/__init__.py new file mode 100644 index 000000000000..e8714b719dfc --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/__init__.py @@ -0,0 +1,19 @@ +# 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 ._configuration import AuthorizationManagementClientConfiguration +from ._authorization_management_client import AuthorizationManagementClient +__all__ = ['AuthorizationManagementClient', 'AuthorizationManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_authorization_management_client.py new file mode 100644 index 000000000000..45c665e99303 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_authorization_management_client.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import AuthorizationManagementClientConfiguration +from .operations import RoleAssignmentsOperations +from . import models + + +class AuthorizationManagementClient(SDKClient): + """Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role assignments. A role assignment grants access to Azure Active Directory users. + + :ivar config: Configuration for client. + :vartype config: AuthorizationManagementClientConfiguration + + :ivar role_assignments: RoleAssignments operations + :vartype role_assignments: azure.mgmt.authorization.v2020_04_01_preview.operations.RoleAssignmentsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = AuthorizationManagementClientConfiguration(credentials, subscription_id, base_url) + super(AuthorizationManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2020-04-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.role_assignments = RoleAssignmentsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_configuration.py new file mode 100644 index 000000000000..c192b8088f15 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_configuration.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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class AuthorizationManagementClientConfiguration(AzureConfiguration): + """Configuration for AuthorizationManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(AuthorizationManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-authorization/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/__init__.py new file mode 100644 index 000000000000..7fa9d33fff9d --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/__init__.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import RoleAssignment + from ._models_py3 import RoleAssignmentCreateParameters + from ._models_py3 import RoleAssignmentFilter +except (SyntaxError, ImportError): + from ._models import RoleAssignment + from ._models import RoleAssignmentCreateParameters + from ._models import RoleAssignmentFilter +from ._paged_models import RoleAssignmentPaged +from ._authorization_management_client_enums import ( + PrincipalType, +) + +__all__ = [ + 'RoleAssignment', + 'RoleAssignmentCreateParameters', + 'RoleAssignmentFilter', + 'RoleAssignmentPaged', + 'PrincipalType', +] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_authorization_management_client_enums.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_authorization_management_client_enums.py new file mode 100644 index 000000000000..470522d4174d --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_authorization_management_client_enums.py @@ -0,0 +1,26 @@ +# 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 enum import Enum + + +class PrincipalType(str, Enum): + + user = "User" + group = "Group" + service_principal = "ServicePrincipal" + unknown = "Unknown" + directory_role_template = "DirectoryRoleTemplate" + foreign_group = "ForeignGroup" + application = "Application" + msi = "MSI" + directory_object_or_group = "DirectoryObjectOrGroup" + everyone = "Everyone" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models.py new file mode 100644 index 000000000000..ca78bb76ffd1 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models.py @@ -0,0 +1,168 @@ +# 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 CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +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 principal_type: The principal type of the assigned principal ID. + Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', + 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', + 'DirectoryObjectOrGroup', 'Everyone' + :type principal_type: str or + ~azure.mgmt.authorization.v2020_04_01_preview.models.PrincipalType + :param can_delegate: The Delegation flag for the role assignment + :type can_delegate: bool + :param description: Description of role assignment + :type description: str + :param condition: The conditions on the role assignment. This limits the + resources it can be assigned to. e.g.: + @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + StringEqualsIgnoreCase 'foo_storage_container' + :type condition: str + :param condition_version: Version of the condition. Currently accepted + values are '1.0' or '2.0' + :type condition_version: 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'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, + 'can_delegate': {'key': 'properties.canDelegate', 'type': 'bool'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'condition': {'key': 'properties.condition', 'type': 'str'}, + 'condition_version': {'key': 'properties.conditionVersion', 'type': 'str'}, + } + + 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.principal_type = kwargs.get('principal_type', None) + self.can_delegate = kwargs.get('can_delegate', None) + self.description = kwargs.get('description', None) + self.condition = kwargs.get('condition', None) + self.condition_version = kwargs.get('condition_version', None) + + +class RoleAssignmentCreateParameters(Model): + """Role assignment create parameters. + + All required parameters must be populated in order to send to Azure. + + :param role_definition_id: Required. The role definition ID used in the + role assignment. + :type role_definition_id: str + :param principal_id: Required. 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 principal_type: The principal type of the assigned principal ID. + Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', + 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', + 'DirectoryObjectOrGroup', 'Everyone' + :type principal_type: str or + ~azure.mgmt.authorization.v2020_04_01_preview.models.PrincipalType + :param can_delegate: The delegation flag used for creating a role + assignment + :type can_delegate: bool + :param description: Description of role assignment + :type description: str + :param condition: The conditions on the role assignment + :type condition: str + :param condition_version: Version of the condition + :type condition_version: str + """ + + _validation = { + 'role_definition_id': {'required': True}, + 'principal_id': {'required': True}, + } + + _attribute_map = { + 'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, + 'can_delegate': {'key': 'properties.canDelegate', 'type': 'bool'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'condition': {'key': 'properties.condition', 'type': 'str'}, + 'condition_version': {'key': 'properties.conditionVersion', 'type': 'str'}, + } + + 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.principal_type = kwargs.get('principal_type', None) + self.can_delegate = kwargs.get('can_delegate', None) + self.description = kwargs.get('description', None) + self.condition = kwargs.get('condition', None) + self.condition_version = kwargs.get('condition_version', None) + + +class RoleAssignmentFilter(Model): + """Role Assignments filter. + + :param principal_id: Returns role assignment of the specific principal. + :type principal_id: str + :param can_delegate: The Delegation flag for the role assignment + :type can_delegate: bool + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'can_delegate': {'key': 'canDelegate', 'type': 'bool'}, + } + + 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/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..2d4acd255fca --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_models_py3.py @@ -0,0 +1,168 @@ +# 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 CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +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 principal_type: The principal type of the assigned principal ID. + Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', + 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', + 'DirectoryObjectOrGroup', 'Everyone' + :type principal_type: str or + ~azure.mgmt.authorization.v2020_04_01_preview.models.PrincipalType + :param can_delegate: The Delegation flag for the role assignment + :type can_delegate: bool + :param description: Description of role assignment + :type description: str + :param condition: The conditions on the role assignment. This limits the + resources it can be assigned to. e.g.: + @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + StringEqualsIgnoreCase 'foo_storage_container' + :type condition: str + :param condition_version: Version of the condition. Currently accepted + values are '1.0' or '2.0' + :type condition_version: 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'}, + 'scope': {'key': 'properties.scope', 'type': 'str'}, + 'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, + 'can_delegate': {'key': 'properties.canDelegate', 'type': 'bool'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'condition': {'key': 'properties.condition', 'type': 'str'}, + 'condition_version': {'key': 'properties.conditionVersion', 'type': 'str'}, + } + + def __init__(self, *, scope: str=None, role_definition_id: str=None, principal_id: str=None, principal_type=None, can_delegate: bool=None, description: str=None, condition: str=None, condition_version: str=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.principal_type = principal_type + self.can_delegate = can_delegate + self.description = description + self.condition = condition + self.condition_version = condition_version + + +class RoleAssignmentCreateParameters(Model): + """Role assignment create parameters. + + All required parameters must be populated in order to send to Azure. + + :param role_definition_id: Required. The role definition ID used in the + role assignment. + :type role_definition_id: str + :param principal_id: Required. 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 principal_type: The principal type of the assigned principal ID. + Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', + 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', + 'DirectoryObjectOrGroup', 'Everyone' + :type principal_type: str or + ~azure.mgmt.authorization.v2020_04_01_preview.models.PrincipalType + :param can_delegate: The delegation flag used for creating a role + assignment + :type can_delegate: bool + :param description: Description of role assignment + :type description: str + :param condition: The conditions on the role assignment + :type condition: str + :param condition_version: Version of the condition + :type condition_version: str + """ + + _validation = { + 'role_definition_id': {'required': True}, + 'principal_id': {'required': True}, + } + + _attribute_map = { + 'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, + 'can_delegate': {'key': 'properties.canDelegate', 'type': 'bool'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'condition': {'key': 'properties.condition', 'type': 'str'}, + 'condition_version': {'key': 'properties.conditionVersion', 'type': 'str'}, + } + + def __init__(self, *, role_definition_id: str, principal_id: str, principal_type=None, can_delegate: bool=None, description: str=None, condition: str=None, condition_version: str=None, **kwargs) -> None: + super(RoleAssignmentCreateParameters, self).__init__(**kwargs) + self.role_definition_id = role_definition_id + self.principal_id = principal_id + self.principal_type = principal_type + self.can_delegate = can_delegate + self.description = description + self.condition = condition + self.condition_version = condition_version + + +class RoleAssignmentFilter(Model): + """Role Assignments filter. + + :param principal_id: Returns role assignment of the specific principal. + :type principal_id: str + :param can_delegate: The Delegation flag for the role assignment + :type can_delegate: bool + """ + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'can_delegate': {'key': 'canDelegate', 'type': 'bool'}, + } + + 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/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_paged_models.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_paged_models.py new file mode 100644 index 000000000000..ffe1ce1a10d7 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/models/_paged_models.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class RoleAssignmentPaged(Paged): + """ + A paging container for iterating over a list of :class:`RoleAssignment ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RoleAssignment]'} + } + + def __init__(self, *args, **kwargs): + + super(RoleAssignmentPaged, self).__init__(*args, **kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/__init__.py new file mode 100644 index 000000000000..b3ff77221063 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._role_assignments_operations import RoleAssignmentsOperations + +__all__ = [ + 'RoleAssignmentsOperations', +] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/_role_assignments_operations.py new file mode 100644 index 000000000000..2fe33743dac8 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/_role_assignments_operations.py @@ -0,0 +1,733 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class RoleAssignmentsOperations(object): + """RoleAssignmentsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2020-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-04-01-preview" + + self.config = config + + def list_for_resource( + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets role assignments for a resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource + provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource. + :type resource_type: str + :param resource_name: The name of the resource to get role assignments + for. + :type resource_name: str + :param filter: The filter to apply on the operation. Use + $filter=atScope() to return all role assignments at or above the + scope. Use $filter=principalId eq {id} to return all role assignments + at, above or below the scope for the specified principal. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of RoleAssignment + :rtype: + ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_for_resource.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.RoleAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_for_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments'} + + def list_for_resource_group( + self, resource_group_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets role assignments for a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param filter: The filter to apply on the operation. Use + $filter=atScope() to return all role assignments at or above the + scope. Use $filter=principalId eq {id} to return all role assignments + at, above or below the scope for the specified principal. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of RoleAssignment + :rtype: + ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_for_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.RoleAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments'} + + def delete( + self, scope, role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Deletes a role assignment. + + :param scope: The scope of the role assignment to delete. + :type scope: str + :param role_assignment_name: The name of the role assignment to + delete. + :type role_assignment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RoleAssignment or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'roleAssignmentName': self._serialize.url("role_assignment_name", role_assignment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + delete.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}'} + + def create( + self, scope, role_assignment_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates a role assignment. + + :param scope: The scope of the role assignment to create. The scope + can be any REST resource instance. For example, use + '/subscriptions/{subscription-id}/' for a subscription, + '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' + for a resource group, and + '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + for a resource. + :type scope: str + :param role_assignment_name: The name of the role assignment to + create. It can be any valid GUID. + :type role_assignment_name: str + :param parameters: Parameters for the role assignment. + :type parameters: + ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignmentCreateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RoleAssignment or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'roleAssignmentName': self._serialize.url("role_assignment_name", role_assignment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'RoleAssignmentCreateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('RoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}'} + + def get( + self, scope, role_assignment_name, custom_headers=None, raw=False, **operation_config): + """Get the specified role assignment. + + :param scope: The scope of the role assignment. + :type scope: str + :param role_assignment_name: The name of the role assignment to get. + :type role_assignment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RoleAssignment or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'roleAssignmentName': self._serialize.url("role_assignment_name", role_assignment_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}'} + + def delete_by_id( + self, role_id, custom_headers=None, raw=False, **operation_config): + """Deletes a role assignment. + + :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 + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RoleAssignment or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete_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['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + delete_by_id.metadata = {'url': '/{roleId}'} + + def create_by_id( + self, role_id, parameters, custom_headers=None, raw=False, **operation_config): + """Creates a role assignment by ID. + + :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.v2020_04_01_preview.models.RoleAssignmentCreateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RoleAssignment or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_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['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'RoleAssignmentCreateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('RoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_by_id.metadata = {'url': '/{roleId}'} + + def get_by_id( + self, role_id, custom_headers=None, raw=False, **operation_config): + """Gets a role assignment by ID. + + :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 + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RoleAssignment or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment 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['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignment', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/{roleId}'} + + def list( + self, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets all role assignments for the subscription. + + :param filter: The filter to apply on the operation. Use + $filter=atScope() to return all role assignments at or above the + scope. Use $filter=principalId eq {id} to return all role assignments + at, above or below the scope for the specified principal. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of RoleAssignment + :rtype: + ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.RoleAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments'} + + def list_for_scope( + self, scope, filter=None, custom_headers=None, raw=False, **operation_config): + """Gets role assignments for a scope. + + :param scope: The scope of the role assignments. + :type scope: str + :param filter: The filter to apply on the operation. Use + $filter=atScope() to return all role assignments at or above the + scope. Use $filter=principalId eq {id} to return all role assignments + at, above or below the scope for the specified principal. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of RoleAssignment + :rtype: + ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_for_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.RoleAssignmentPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_for_scope.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignments'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/version.py new file mode 100644 index 000000000000..3ac3b1800fbe --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2020-04-01-preview" + diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/version.py index e419ae9e141e..7458e6664ad0 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.60.0" +VERSION = "0.61.0" diff --git a/sdk/authorization/azure-mgmt-authorization/setup.py b/sdk/authorization/azure-mgmt-authorization/setup.py index c7b6393c629b..00b0aed8eb99 100644 --- a/sdk/authorization/azure-mgmt-authorization/setup.py +++ b/sdk/authorization/azure-mgmt-authorization/setup.py @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -64,10 +66,10 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'License :: OSI Approved :: MIT License', ], zip_safe=False, diff --git a/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_authorization.yaml b/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_authorization.yaml index 915d0409e9da..7c5586d7dc21 100644 --- a/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_authorization.yaml +++ b/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_authorization.yaml @@ -2,31 +2,46 @@ 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] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-5.3.0-1032-azure-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-authorization/0.52.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":[]}]}'} + body: + string: '{"value":[{"actions":["*"],"notActions":["Microsoft.Authorization/*/Delete","Microsoft.Authorization/*/Write","Microsoft.Authorization/elevateAccess/Action","Microsoft.Blueprint/blueprintAssignments/write","Microsoft.Blueprint/blueprintAssignments/delete"],"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} + cache-control: + - no-cache + content-length: + - '296' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 14 Aug 2020 02:02:59 GMT + expires: + - '-1' + pragma: + - no-cache + set-cookie: + - x-ms-gateway-slice=Production; path=/; SameSite=None; secure; HttpOnly + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK version: 1 diff --git a/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_role_assignment.yaml b/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_role_assignment.yaml index 0cdf76759d25..d19aeabb4024 100644 --- a/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_role_assignment.yaml +++ b/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_role_assignment.yaml @@ -1,63 +1,101 @@ interactions: - request: - body: 'b''b\''b\\\''b\\\\\\\''{"properties": {"roleDefinitionId": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c", - "principalId": "6d33bfc8-e476-11e8-915d-f2801f1b9fd1"}}\\\\\\\''\\\''\''''' + body: 'b''b\''{"properties": {"roleDefinitionId": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c", + "principalId": "c0b47275-7607-4249-a417-af79e7ec1a91"}}\''''' headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['233'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.3 (Windows-10-10.0.17134-SP0) msrest/0.6.0 msrest_azure/0.4.34 - azure-mgmt-authorization/0.50.2 Azure-SDK-For-Python] - accept-language: [en-US] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '233' + Content-Type: + - application/json; charset=utf-8 + User-Agent: + - python/3.6.9 (Linux-5.3.0-1032-azure-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-authorization/0.52.0 Azure-SDK-For-Python + accept-language: + - en-US method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_authorization_test_role_assignment9e52125c/providers/Microsoft.Authorization/roleAssignments/ddfe2dc0-9858-442f-aca3-ac215947a815?api-version=2018-09-01-preview response: - body: {string: '{"properties":{"roleDefinitionId":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c","principalId":"6d33bfc8-e476-11e8-915d-f2801f1b9fd1","principalType":"ServicePrincipal","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_authorization_test_role_assignment9e52125c","createdOn":"2018-11-09T23:22:30.7697296Z","updatedOn":"2018-11-09T23:22:30.7697296Z","createdBy":null,"updatedBy":"6d33bfc8-e476-11e8-915d-f2801f1b9fd1"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_authorization_test_role_assignment9e52125c/providers/Microsoft.Authorization/roleAssignments/ddfe2dc0-9858-442f-aca3-ac215947a815","type":"Microsoft.Authorization/roleAssignments","name":"ddfe2dc0-9858-442f-aca3-ac215947a815"}'} + body: + string: '{"properties":{"roleDefinitionId":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c","principalId":"c0b47275-7607-4249-a417-af79e7ec1a91","principalType":"User","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_authorization_test_role_assignment9e52125c","createdOn":"2020-08-14T02:05:51.7782618Z","updatedOn":"2020-08-14T02:05:51.7782618Z","createdBy":null,"updatedBy":"4faa32fd-963a-464d-b6bf-c12cf48c0317"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_authorization_test_role_assignment9e52125c/providers/Microsoft.Authorization/roleAssignments/ddfe2dc0-9858-442f-aca3-ac215947a815","type":"Microsoft.Authorization/roleAssignments","name":"ddfe2dc0-9858-442f-aca3-ac215947a815"}' headers: - cache-control: [no-cache] - content-length: ['857'] - content-type: [application/json; charset=utf-8] - date: ['Fri, 09 Nov 2018 23:22:31 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] - x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-subscription-writes: ['1199'] - x-ms-request-charge: ['2'] - status: {code: 201, message: Created} + cache-control: + - no-cache + content-length: + - '845' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 14 Aug 2020 02:05:52 GMT + expires: + - '-1' + pragma: + - no-cache + set-cookie: + - x-ms-gateway-slice=Production; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created - request: body: null headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - Content-Length: ['0'] - Cookie: [x-ms-gateway-slice=productionb] - User-Agent: [python/3.6.3 (Windows-10-10.0.17134-SP0) msrest/0.6.0 msrest_azure/0.4.34 - azure-mgmt-authorization/0.50.2 Azure-SDK-For-Python] - accept-language: [en-US] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Cookie: + - x-ms-gateway-slice=Production + User-Agent: + - python/3.6.9 (Linux-5.3.0-1032-azure-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-authorization/0.52.0 Azure-SDK-For-Python + accept-language: + - en-US method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_authorization_test_role_assignment9e52125c/providers/Microsoft.Authorization/roleAssignments/ddfe2dc0-9858-442f-aca3-ac215947a815?api-version=2018-09-01-preview response: - body: {string: '{"properties":{"roleDefinitionId":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c","principalId":"6d33bfc8-e476-11e8-915d-f2801f1b9fd1","principalType":"ServicePrincipal","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_authorization_test_role_assignment9e52125c","createdOn":"2018-11-09T23:22:31.8326536Z","updatedOn":"2018-11-09T23:22:31.8326536Z","createdBy":"6d33bfc8-e476-11e8-915d-f2801f1b9fd1","updatedBy":"6d33bfc8-e476-11e8-915d-f2801f1b9fd1"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_authorization_test_role_assignment9e52125c/providers/Microsoft.Authorization/roleAssignments/ddfe2dc0-9858-442f-aca3-ac215947a815","type":"Microsoft.Authorization/roleAssignments","name":"ddfe2dc0-9858-442f-aca3-ac215947a815"}'} + body: + string: '{"properties":{"roleDefinitionId":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c","principalId":"c0b47275-7607-4249-a417-af79e7ec1a91","principalType":"User","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_authorization_test_role_assignment9e52125c","createdOn":"2020-08-14T02:05:52.0532407Z","updatedOn":"2020-08-14T02:05:52.0532407Z","createdBy":"4faa32fd-963a-464d-b6bf-c12cf48c0317","updatedBy":"4faa32fd-963a-464d-b6bf-c12cf48c0317"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_authorization_test_role_assignment9e52125c/providers/Microsoft.Authorization/roleAssignments/ddfe2dc0-9858-442f-aca3-ac215947a815","type":"Microsoft.Authorization/roleAssignments","name":"ddfe2dc0-9858-442f-aca3-ac215947a815"}' headers: - cache-control: [no-cache] - content-length: ['891'] - content-type: [application/json; charset=utf-8] - date: ['Fri, 09 Nov 2018 23:22:34 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-ratelimit-remaining-subscription-deletes: ['14999'] - x-ms-request-charge: ['2'] - status: {code: 200, message: OK} + cache-control: + - no-cache + content-length: + - '879' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 14 Aug 2020 02:05:53 GMT + expires: + - '-1' + pragma: + - no-cache + set-cookie: + - x-ms-gateway-slice=Production; path=/; secure; HttpOnly; SameSite=None + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + status: + code: 200 + message: OK version: 1 diff --git a/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_role_definitions.yaml b/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_role_definitions.yaml index 3054ab1a7f5f..66f46af722ca 100644 --- a/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_role_definitions.yaml +++ b/sdk/authorization/azure-mgmt-authorization/tests/recordings/test_mgmt_authorization.test_role_definitions.yaml @@ -2,30 +2,47 @@ interactions: - request: body: null headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - Connection: [keep-alive] - User-Agent: [python/3.6.3 (Windows-10-10.0.17134-SP0) msrest/0.6.0 msrest_azure/0.4.34 - azure-mgmt-authorization/0.50.2 Azure-SDK-For-Python] - accept-language: [en-US] + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python/3.6.9 (Linux-5.3.0-1032-azure-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 + msrest_azure/0.6.2 azure-mgmt-authorization/0.52.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_role_definitionsb07e12bf/providers/Microsoft.Authorization/roleDefinitions?$filter=roleName%20eq%20%27Contributor%27&api-version=2018-01-01-preview response: - body: {string: '{"value":[{"properties":{"roleName":"Contributor","type":"BuiltInRole","description":"Lets - you manage everything except access to resources.","assignableScopes":["/"],"permissions":[{"actions":["*"],"notActions":["Microsoft.Authorization/*/Delete","Microsoft.Authorization/*/Write","Microsoft.Authorization/elevateAccess/Action","Microsoft.Blueprint/blueprintAssignments/write","Microsoft.Blueprint/blueprintAssignments/delete"],"dataActions":[],"notDataActions":[]}],"createdOn":"0001-01-01T08:00:00.0000000Z","updatedOn":"2018-05-30T19:22:32.4538167Z","createdBy":null,"updatedBy":null},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c","type":"Microsoft.Authorization/roleDefinitions","name":"b24988ac-6180-42a0-ab88-20f7382dd24c"}]}'} + body: + string: '{"value":[{"properties":{"roleName":"Contributor","type":"BuiltInRole","description":"Lets + you manage everything except access to resources.","assignableScopes":["/"],"permissions":[{"actions":["*"],"notActions":["Microsoft.Authorization/*/Delete","Microsoft.Authorization/*/Write","Microsoft.Authorization/elevateAccess/Action","Microsoft.Blueprint/blueprintAssignments/write","Microsoft.Blueprint/blueprintAssignments/delete"],"dataActions":[],"notDataActions":[]}],"createdOn":"2015-02-02T21:55:09.8806423Z","updatedOn":"2019-02-05T21:24:38.4580610Z","createdBy":null,"updatedBy":null},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c","type":"Microsoft.Authorization/roleDefinitions","name":"b24988ac-6180-42a0-ab88-20f7382dd24c"}]}' headers: - cache-control: [no-cache] - content-length: ['832'] - content-type: [application/json; charset=utf-8] - date: ['Fri, 09 Nov 2018 21:39:29 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'] - status: {code: 200, message: OK} + cache-control: + - no-cache + content-length: + - '832' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 14 Aug 2020 02:05:56 GMT + expires: + - '-1' + pragma: + - no-cache + set-cookie: + - x-ms-gateway-slice=Production; path=/; SameSite=None; secure; HttpOnly + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK version: 1