From 5581fec5fae89f34441979b4eac549d38343e6f7 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 6 Apr 2021 07:45:57 +0000 Subject: [PATCH] CodeGen from PR 13786 in Azure/azure-rest-api-specs reference old versions of other apis (#13786) * reference old versions of other apis * remove old files --- .../azure-mgmt-authorization/MANIFEST.in | 1 + .../azure-mgmt-authorization/_meta.json | 8 + .../_authorization_management_client.py | 237 ++++ .../v2015_06_01/models/__init__.py | 9 + .../v2015_06_01/models/_models.py | 106 ++ .../v2015_06_01/models/_models_py3.py | 106 ++ .../_classic_administrators_operations.py | 12 +- .../v2015_07_01/models/__init__.py | 9 + .../v2015_07_01/models/_models.py | 106 ++ .../v2015_07_01/models/_models_py3.py | 106 ++ .../_classic_administrators_operations.py | 12 +- .../_global_administrator_operations.py | 10 +- .../operations/_permissions_operations.py | 35 +- ...provider_operations_metadata_operations.py | 29 +- .../_role_assignments_operations.py | 111 +- .../_role_definitions_operations.py | 48 +- .../v2018_01_01_preview/models/__init__.py | 9 + .../v2018_01_01_preview/models/_models.py | 107 ++ .../v2018_01_01_preview/models/_models_py3.py | 107 ++ .../operations/_permissions_operations.py | 33 +- ...provider_operations_metadata_operations.py | 19 +- .../_role_assignments_operations.py | 111 +- .../_role_definitions_operations.py | 48 +- .../v2018_05_01_preview/__init__.py | 19 + .../_authorization_management_client.py | 89 ++ .../v2018_05_01_preview/_configuration.py | 48 + .../v2018_05_01_preview/models/__init__.py | 95 ++ .../_authorization_management_client_enums.py | 113 ++ .../v2018_05_01_preview/models/_models.py | 1095 ++++++++++++++++ .../v2018_05_01_preview/models/_models_py3.py | 1095 ++++++++++++++++ .../models/_paged_models.py | 66 + .../operations/__init__.py | 32 + ...cess_review_default_settings_operations.py | 156 +++ ...ss_review_instance_decisions_operations.py | 111 ++ ...review_instance_my_decisions_operations.py | 253 ++++ .../_access_review_instance_operations.py | 304 +++++ ...ces_assigned_for_my_approval_operations.py | 168 +++ .../_access_review_instances_operations.py | 170 +++ ...ons_assigned_for_my_approval_operations.py | 100 ++ ..._review_schedule_definitions_operations.py | 331 +++++ .../operations/_operations.py | 100 ++ .../v2018_05_01_preview/version.py | 13 + .../v2018_07_01_preview/models/__init__.py | 9 + .../v2018_07_01_preview/models/_models.py | 107 ++ .../v2018_07_01_preview/models/_models_py3.py | 107 ++ .../_deny_assignments_operations.py | 71 +- .../v2018_09_01_preview/models/__init__.py | 9 + .../v2018_09_01_preview/models/_models.py | 107 ++ .../v2018_09_01_preview/models/_models_py3.py | 107 ++ .../_role_assignments_operations.py | 111 +- .../v2020_04_01_preview/models/__init__.py | 9 + .../v2020_04_01_preview/models/_models.py | 147 ++- .../v2020_04_01_preview/models/_models_py3.py | 149 ++- .../_role_assignments_operations.py | 121 +- .../v2021_01_01_preview/__init__.py | 19 + .../_authorization_management_client.py | 79 ++ .../v2021_01_01_preview/_configuration.py | 48 + .../v2021_01_01_preview/models/__init__.py | 52 + .../_authorization_management_client_enums.py | 37 + .../v2021_01_01_preview/models/_models.py | 379 ++++++ .../v2021_01_01_preview/models/_models_py3.py | 379 ++++++ .../models/_paged_models.py | 40 + .../operations/__init__.py | 28 + .../operations/_operations.py | 100 ++ .../_role_assignment_approval_operations.py | 170 +++ ...ole_assignment_approval_step_operations.py | 233 ++++ ...le_assignment_approval_steps_operations.py | 97 ++ ...ope_role_assignment_approval_operations.py | 179 +++ ...ole_assignment_approval_step_operations.py | 242 ++++ ...le_assignment_approval_steps_operations.py | 100 ++ .../v2021_01_01_preview/version.py | 13 + .../v2021_03_01_preview/__init__.py | 19 + .../_authorization_management_client.py | 89 ++ .../v2021_03_01_preview/_configuration.py | 48 + .../v2021_03_01_preview/models/__init__.py | 95 ++ .../_authorization_management_client_enums.py | 114 ++ .../v2021_03_01_preview/models/_models.py | 1160 +++++++++++++++++ .../v2021_03_01_preview/models/_models_py3.py | 1160 +++++++++++++++++ .../models/_paged_models.py | 66 + .../operations/__init__.py | 32 + ...cess_review_default_settings_operations.py | 156 +++ ...ss_review_instance_decisions_operations.py | 111 ++ ...review_instance_my_decisions_operations.py | 253 ++++ .../_access_review_instance_operations.py | 304 +++++ ...ces_assigned_for_my_approval_operations.py | 168 +++ .../_access_review_instances_operations.py | 170 +++ ...ons_assigned_for_my_approval_operations.py | 100 ++ ..._review_schedule_definitions_operations.py | 331 +++++ .../operations/_operations.py | 100 ++ .../v2021_03_01_preview/version.py | 13 + 90 files changed, 13043 insertions(+), 432 deletions(-) create mode 100644 sdk/authorization/azure-mgmt-authorization/_meta.json create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/__init__.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_authorization_management_client.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_configuration.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/__init__.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_authorization_management_client_enums.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models_py3.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_paged_models.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/__init__.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_default_settings_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_decisions_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_my_decisions_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/version.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/__init__.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_authorization_management_client.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_configuration.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/__init__.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_authorization_management_client_enums.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models_py3.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_paged_models.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/__init__.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_step_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_steps_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_step_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_steps_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/version.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/__init__.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_authorization_management_client.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_configuration.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/__init__.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_authorization_management_client_enums.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models_py3.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_paged_models.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/__init__.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_default_settings_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_decisions_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_my_decisions_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_operations.py create mode 100644 sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/version.py diff --git a/sdk/authorization/azure-mgmt-authorization/MANIFEST.in b/sdk/authorization/azure-mgmt-authorization/MANIFEST.in index a3cb07df87658..3a9b6517412bc 100644 --- a/sdk/authorization/azure-mgmt-authorization/MANIFEST.in +++ b/sdk/authorization/azure-mgmt-authorization/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/authorization/azure-mgmt-authorization/_meta.json b/sdk/authorization/azure-mgmt-authorization/_meta.json new file mode 100644 index 0000000000000..aa6fd8108abc5 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "V2", + "use": "@microsoft.azure/autorest.python@~4.0.71", + "commit": "a80895f851ff857163eaca150d32f9f5c8f67d72", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/authorization/resource-manager/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --use=@microsoft.azure/autorest.python@~4.0.71 --version=V2", + "readme": "specification/authorization/resource-manager/readme.md" +} \ No newline at end of file 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 a0f3743f3b87e..96da4f1ad8134 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 @@ -81,9 +81,12 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2015-06-01: :mod:`v2015_06_01.models` * 2015-07-01: :mod:`v2015_07_01.models` * 2018-01-01-preview: :mod:`v2018_01_01_preview.models` + * 2018-05-01-preview: :mod:`v2018_05_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` + * 2021-01-01-preview: :mod:`v2021_01_01_preview.models` + * 2021-03-01-preview: :mod:`v2021_03_01_preview.models` """ if api_version == '2015-06-01': from .v2015_06_01 import models @@ -94,6 +97,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2018-01-01-preview': from .v2018_01_01_preview import models return models + elif api_version == '2018-05-01-preview': + from .v2018_05_01_preview import models + return models elif api_version == '2018-07-01-preview': from .v2018_07_01_preview import models return models @@ -103,8 +109,142 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-04-01-preview': from .v2020_04_01_preview import models return models + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview import models + return models + elif api_version == '2021-03-01-preview': + from .v2021_03_01_preview import models + return models raise NotImplementedError("APIVersion {} is not available".format(api_version)) + @property + def access_review_default_settings(self): + """Instance depends on the API version: + + * 2018-05-01-preview: :class:`AccessReviewDefaultSettingsOperations` + * 2021-03-01-preview: :class:`AccessReviewDefaultSettingsOperations` + """ + api_version = self._get_api_version('access_review_default_settings') + if api_version == '2018-05-01-preview': + from .v2018_05_01_preview.operations import AccessReviewDefaultSettingsOperations as OperationClass + elif api_version == '2021-03-01-preview': + from .v2021_03_01_preview.operations import AccessReviewDefaultSettingsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def access_review_instance(self): + """Instance depends on the API version: + + * 2018-05-01-preview: :class:`AccessReviewInstanceOperations` + * 2021-03-01-preview: :class:`AccessReviewInstanceOperations` + """ + api_version = self._get_api_version('access_review_instance') + if api_version == '2018-05-01-preview': + from .v2018_05_01_preview.operations import AccessReviewInstanceOperations as OperationClass + elif api_version == '2021-03-01-preview': + from .v2021_03_01_preview.operations import AccessReviewInstanceOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def access_review_instance_decisions(self): + """Instance depends on the API version: + + * 2018-05-01-preview: :class:`AccessReviewInstanceDecisionsOperations` + * 2021-03-01-preview: :class:`AccessReviewInstanceDecisionsOperations` + """ + api_version = self._get_api_version('access_review_instance_decisions') + if api_version == '2018-05-01-preview': + from .v2018_05_01_preview.operations import AccessReviewInstanceDecisionsOperations as OperationClass + elif api_version == '2021-03-01-preview': + from .v2021_03_01_preview.operations import AccessReviewInstanceDecisionsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def access_review_instance_my_decisions(self): + """Instance depends on the API version: + + * 2018-05-01-preview: :class:`AccessReviewInstanceMyDecisionsOperations` + * 2021-03-01-preview: :class:`AccessReviewInstanceMyDecisionsOperations` + """ + api_version = self._get_api_version('access_review_instance_my_decisions') + if api_version == '2018-05-01-preview': + from .v2018_05_01_preview.operations import AccessReviewInstanceMyDecisionsOperations as OperationClass + elif api_version == '2021-03-01-preview': + from .v2021_03_01_preview.operations import AccessReviewInstanceMyDecisionsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def access_review_instances(self): + """Instance depends on the API version: + + * 2018-05-01-preview: :class:`AccessReviewInstancesOperations` + * 2021-03-01-preview: :class:`AccessReviewInstancesOperations` + """ + api_version = self._get_api_version('access_review_instances') + if api_version == '2018-05-01-preview': + from .v2018_05_01_preview.operations import AccessReviewInstancesOperations as OperationClass + elif api_version == '2021-03-01-preview': + from .v2021_03_01_preview.operations import AccessReviewInstancesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def access_review_instances_assigned_for_my_approval(self): + """Instance depends on the API version: + + * 2018-05-01-preview: :class:`AccessReviewInstancesAssignedForMyApprovalOperations` + * 2021-03-01-preview: :class:`AccessReviewInstancesAssignedForMyApprovalOperations` + """ + api_version = self._get_api_version('access_review_instances_assigned_for_my_approval') + if api_version == '2018-05-01-preview': + from .v2018_05_01_preview.operations import AccessReviewInstancesAssignedForMyApprovalOperations as OperationClass + elif api_version == '2021-03-01-preview': + from .v2021_03_01_preview.operations import AccessReviewInstancesAssignedForMyApprovalOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def access_review_schedule_definitions(self): + """Instance depends on the API version: + + * 2018-05-01-preview: :class:`AccessReviewScheduleDefinitionsOperations` + * 2021-03-01-preview: :class:`AccessReviewScheduleDefinitionsOperations` + """ + api_version = self._get_api_version('access_review_schedule_definitions') + if api_version == '2018-05-01-preview': + from .v2018_05_01_preview.operations import AccessReviewScheduleDefinitionsOperations as OperationClass + elif api_version == '2021-03-01-preview': + from .v2021_03_01_preview.operations import AccessReviewScheduleDefinitionsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def access_review_schedule_definitions_assigned_for_my_approval(self): + """Instance depends on the API version: + + * 2018-05-01-preview: :class:`AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations` + * 2021-03-01-preview: :class:`AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations` + """ + api_version = self._get_api_version('access_review_schedule_definitions_assigned_for_my_approval') + if api_version == '2018-05-01-preview': + from .v2018_05_01_preview.operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations as OperationClass + elif api_version == '2021-03-01-preview': + from .v2021_03_01_preview.operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def classic_administrators(self): """Instance depends on the API version: @@ -147,6 +287,25 @@ def global_administrator(self): raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def operations(self): + """Instance depends on the API version: + + * 2018-05-01-preview: :class:`Operations` + * 2021-01-01-preview: :class:`Operations` + * 2021-03-01-preview: :class:`Operations` + """ + api_version = self._get_api_version('operations') + if api_version == '2018-05-01-preview': + from .v2018_05_01_preview.operations import Operations as OperationClass + elif api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import Operations as OperationClass + elif api_version == '2021-03-01-preview': + from .v2021_03_01_preview.operations import Operations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def permissions(self): """Instance depends on the API version: @@ -179,6 +338,45 @@ def provider_operations_metadata(self): raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def role_assignment_approval(self): + """Instance depends on the API version: + + * 2021-01-01-preview: :class:`RoleAssignmentApprovalOperations` + """ + api_version = self._get_api_version('role_assignment_approval') + if api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import RoleAssignmentApprovalOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def role_assignment_approval_step(self): + """Instance depends on the API version: + + * 2021-01-01-preview: :class:`RoleAssignmentApprovalStepOperations` + """ + api_version = self._get_api_version('role_assignment_approval_step') + if api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import RoleAssignmentApprovalStepOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def role_assignment_approval_steps(self): + """Instance depends on the API version: + + * 2021-01-01-preview: :class:`RoleAssignmentApprovalStepsOperations` + """ + api_version = self._get_api_version('role_assignment_approval_steps') + if api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import RoleAssignmentApprovalStepsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def role_assignments(self): """Instance depends on the API version: @@ -216,3 +414,42 @@ def role_definitions(self): else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def scope_role_assignment_approval(self): + """Instance depends on the API version: + + * 2021-01-01-preview: :class:`ScopeRoleAssignmentApprovalOperations` + """ + api_version = self._get_api_version('scope_role_assignment_approval') + if api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import ScopeRoleAssignmentApprovalOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def scope_role_assignment_approval_step(self): + """Instance depends on the API version: + + * 2021-01-01-preview: :class:`ScopeRoleAssignmentApprovalStepOperations` + """ + api_version = self._get_api_version('scope_role_assignment_approval_step') + if api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import ScopeRoleAssignmentApprovalStepOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def scope_role_assignment_approval_steps(self): + """Instance depends on the API version: + + * 2021-01-01-preview: :class:`ScopeRoleAssignmentApprovalStepsOperations` + """ + api_version = self._get_api_version('scope_role_assignment_approval_steps') + if api_version == '2021-01-01-preview': + from .v2021_01_01_preview.operations import ScopeRoleAssignmentApprovalStepsOperations 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/v2015_06_01/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py index 99ccac775f2d1..651c144817782 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/__init__.py @@ -11,11 +11,20 @@ try: from ._models_py3 import ClassicAdministrator + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse, ErrorResponseException except (SyntaxError, ImportError): from ._models import ClassicAdministrator + from ._models import ErrorAdditionalInfo + from ._models import ErrorDetail + from ._models import ErrorResponse, ErrorResponseException from ._paged_models import ClassicAdministratorPaged __all__ = [ 'ClassicAdministrator', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', 'ErrorResponseException', 'ClassicAdministratorPaged', ] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models.py index d14093bb951fe..04689cdf25878 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class ClassicAdministrator(Model): @@ -50,3 +51,108 @@ class CloudError(Model): _attribute_map = { } + + +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.authorization.v2015_06_01.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.authorization.v2015_06_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: ~azure.mgmt.authorization.v2015_06_01.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models_py3.py index b0928e129f56b..3f0298079e643 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/models/_models_py3.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class ClassicAdministrator(Model): @@ -50,3 +51,108 @@ class CloudError(Model): _attribute_map = { } + + +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.authorization.v2015_06_01.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.authorization.v2015_06_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: ~azure.mgmt.authorization.v2015_06_01.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/_classic_administrators_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/_classic_administrators_operations.py index 2f6df9c99e316..8fd078f46f35d 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/_classic_administrators_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/operations/_classic_administrators_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -52,20 +51,21 @@ def list( :return: An iterator like instance of ClassicAdministrator :rtype: ~azure.mgmt.authorization.v2015_06_01.models.ClassicAdministratorPaged[~azure.mgmt.authorization.v2015_06_01.models.ClassicAdministrator] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -91,9 +91,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py index fb1c4770e5ee3..f2ff9071af2b9 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/__init__.py @@ -11,6 +11,9 @@ try: from ._models_py3 import ClassicAdministrator + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import Permission from ._models_py3 import ProviderOperation from ._models_py3 import ProviderOperationsMetadata @@ -24,6 +27,9 @@ from ._models_py3 import RoleDefinitionFilter except (SyntaxError, ImportError): from ._models import ClassicAdministrator + from ._models import ErrorAdditionalInfo + from ._models import ErrorDetail + from ._models import ErrorResponse, ErrorResponseException from ._models import Permission from ._models import ProviderOperation from ._models import ProviderOperationsMetadata @@ -43,6 +49,9 @@ __all__ = [ 'ClassicAdministrator', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', 'ErrorResponseException', 'Permission', 'ProviderOperation', 'ProviderOperationsMetadata', diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models.py index 96194e05896aa..6d3a14f247120 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class ClassicAdministrator(Model): @@ -52,6 +53,111 @@ class CloudError(Model): } +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.authorization.v2015_07_01.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.authorization.v2015_07_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: ~azure.mgmt.authorization.v2015_07_01.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Permission(Model): """Role definition permissions. diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models_py3.py index 9587447a649b4..51277e76abbbc 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/models/_models_py3.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class ClassicAdministrator(Model): @@ -52,6 +53,111 @@ class CloudError(Model): } +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.authorization.v2015_07_01.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.authorization.v2015_07_01.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: ~azure.mgmt.authorization.v2015_07_01.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Permission(Model): """Role definition permissions. diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_classic_administrators_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_classic_administrators_operations.py index fd437331b775a..c65bd154516ac 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_classic_administrators_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_classic_administrators_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -52,20 +51,21 @@ def list( :return: An iterator like instance of ClassicAdministrator :rtype: ~azure.mgmt.authorization.v2015_07_01.models.ClassicAdministratorPaged[~azure.mgmt.authorization.v2015_07_01.models.ClassicAdministrator] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -91,9 +91,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_global_administrator_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_global_administrator_operations.py index 78b1739ca7a7f..6da7b33f60de6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_global_administrator_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_global_administrator_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -50,14 +49,15 @@ def elevate_access( overrides`. :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.elevate_access.metadata['url'] # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -73,9 +73,7 @@ def elevate_access( 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 + raise models.ErrorResponseException(self._deserialize, response) if raw: client_raw_response = ClientRawResponse(None, response) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_permissions_operations.py index bcd40b7ecacf6..6699594dbaf01 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_permissions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_permissions_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -43,8 +42,8 @@ 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. The name + is case insensitive. :type resource_group_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -54,21 +53,22 @@ def list_for_resource_group( :return: An iterator like instance of Permission :rtype: ~azure.mgmt.authorization.v2015_07_01.models.PermissionPaged[~azure.mgmt.authorization.v2015_07_01.models.Permission] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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') + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -94,9 +94,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -113,8 +111,8 @@ 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. The name + is case insensitive. :type resource_group_name: str :param resource_provider_namespace: The namespace of the resource provider. @@ -134,25 +132,26 @@ def list_for_resource( :return: An iterator like instance of Permission :rtype: ~azure.mgmt.authorization.v2015_07_01.models.PermissionPaged[~azure.mgmt.authorization.v2015_07_01.models.Permission] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -178,9 +177,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_provider_operations_metadata_operations.py index ce311cb2d563c..c7678a8b7067f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_provider_operations_metadata_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_provider_operations_metadata_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -25,6 +24,7 @@ class ProviderOperationsMetadataOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2015-07-01". """ models = models @@ -34,18 +34,17 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer + self.api_version = "2015-07-01" self.config = config def 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 @@ -57,7 +56,8 @@ def get( :rtype: ~azure.mgmt.authorization.v2015_07_01.models.ProviderOperationsMetadata or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get.metadata['url'] @@ -68,7 +68,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', min_length=1) if expand is not None: query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') @@ -87,9 +87,7 @@ def get( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -103,11 +101,9 @@ def get( 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 @@ -118,7 +114,8 @@ def list( :return: An iterator like instance of ProviderOperationsMetadata :rtype: ~azure.mgmt.authorization.v2015_07_01.models.ProviderOperationsMetadataPaged[~azure.mgmt.authorization.v2015_07_01.models.ProviderOperationsMetadata] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -127,7 +124,7 @@ def prepare_request(next_link=None): # 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', min_length=1) if expand is not None: query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') @@ -155,9 +152,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_assignments_operations.py index 8e3bd0f3e9281..19f3bb8987a6e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_assignments_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -43,7 +42,8 @@ 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. + :param resource_group_name: The name of the resource group. The name + is case insensitive. :type resource_group_name: str :param resource_provider_namespace: The namespace of the resource provider. @@ -68,19 +68,20 @@ def list_for_resource( :return: An iterator like instance of RoleAssignment :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } url = self._client.format_url(url, **path_format_arguments) @@ -88,7 +89,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -114,9 +115,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -133,7 +132,8 @@ 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. + :param resource_group_name: The name of the resource group. The name + is case insensitive. :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 @@ -148,15 +148,16 @@ def list_for_resource_group( :return: An iterator like instance of RoleAssignment :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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') + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } url = self._client.format_url(url, **path_format_arguments) @@ -164,7 +165,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -190,9 +191,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -222,7 +221,8 @@ def delete( :return: RoleAssignment or ClientRawResponse if raw=true :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.delete.metadata['url'] @@ -234,7 +234,7 @@ def delete( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -250,10 +250,8 @@ def delete( 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 + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -292,7 +290,8 @@ def create( :return: RoleAssignment or ClientRawResponse if raw=true :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ parameters = models.RoleAssignmentCreateParameters(properties=properties) @@ -306,7 +305,7 @@ def create( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -327,9 +326,7 @@ def create( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 201: @@ -358,7 +355,8 @@ def get( :return: RoleAssignment or ClientRawResponse if raw=true :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get.metadata['url'] @@ -370,7 +368,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -387,9 +385,7 @@ def get( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -421,7 +417,8 @@ def delete_by_id( :return: RoleAssignment or ClientRawResponse if raw=true :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.delete_by_id.metadata['url'] @@ -432,7 +429,7 @@ def delete_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -448,10 +445,8 @@ def delete_by_id( 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 + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -486,7 +481,8 @@ def create_by_id( :return: RoleAssignment or ClientRawResponse if raw=true :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ parameters = models.RoleAssignmentCreateParameters(properties=properties) @@ -499,7 +495,7 @@ def create_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -520,9 +516,7 @@ def create_by_id( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 201: @@ -554,7 +548,8 @@ def get_by_id( :return: RoleAssignment or ClientRawResponse if raw=true :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get_by_id.metadata['url'] @@ -565,7 +560,7 @@ def get_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -582,9 +577,7 @@ def get_by_id( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -614,14 +607,15 @@ def list( :return: An iterator like instance of RoleAssignment :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } url = self._client.format_url(url, **path_format_arguments) @@ -629,7 +623,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -655,9 +649,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -689,7 +681,8 @@ def list_for_scope( :return: An iterator like instance of RoleAssignment :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -704,7 +697,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -730,9 +723,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_definitions_operations.py index 3af909bb92181..5f204d737a5ac 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/operations/_role_definitions_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -55,7 +54,8 @@ def delete( :return: RoleDefinition or ClientRawResponse if raw=true :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.delete.metadata['url'] @@ -67,7 +67,7 @@ def delete( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -83,10 +83,8 @@ def delete( 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 + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -115,7 +113,8 @@ def get( :return: RoleDefinition or ClientRawResponse if raw=true :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get.metadata['url'] @@ -127,7 +126,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -144,9 +143,7 @@ def get( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -178,7 +175,8 @@ def create_or_update( :return: RoleDefinition or ClientRawResponse if raw=true :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.create_or_update.metadata['url'] @@ -190,7 +188,7 @@ def create_or_update( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -211,9 +209,7 @@ def create_or_update( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 201: @@ -243,7 +239,8 @@ def list( :return: An iterator like instance of RoleDefinition :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinitionPaged[~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -258,7 +255,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -284,9 +281,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -318,7 +313,8 @@ def get_by_id( :return: RoleDefinition or ClientRawResponse if raw=true :rtype: ~azure.mgmt.authorization.v2015_07_01.models.RoleDefinition or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get_by_id.metadata['url'] @@ -329,7 +325,7 @@ def get_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -346,9 +342,7 @@ def get_by_id( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py index d8f1cd2bf98b3..efe775f30d5ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/__init__.py @@ -10,6 +10,9 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import Permission from ._models_py3 import ProviderOperation from ._models_py3 import ProviderOperationsMetadata @@ -20,6 +23,9 @@ from ._models_py3 import RoleDefinition from ._models_py3 import RoleDefinitionFilter except (SyntaxError, ImportError): + from ._models import ErrorAdditionalInfo + from ._models import ErrorDetail + from ._models import ErrorResponse, ErrorResponseException from ._models import Permission from ._models import ProviderOperation from ._models import ProviderOperationsMetadata @@ -35,6 +41,9 @@ from ._paged_models import RoleDefinitionPaged __all__ = [ + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', 'ErrorResponseException', 'Permission', 'ProviderOperation', 'ProviderOperationsMetadata', diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models.py index 0dbfaf8253cc7..36fa027cca558 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class CloudError(Model): @@ -20,6 +21,112 @@ class CloudError(Model): } +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.authorization.v2018_01_01_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.authorization.v2018_01_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: + ~azure.mgmt.authorization.v2018_01_01_preview.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Permission(Model): """Role definition permissions. diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py index 491028a4d4de3..7dcd74718128b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class CloudError(Model): @@ -20,6 +21,112 @@ class CloudError(Model): } +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.authorization.v2018_01_01_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.authorization.v2018_01_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: + ~azure.mgmt.authorization.v2018_01_01_preview.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Permission(Model): """Role definition permissions. diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_permissions_operations.py index e902660afbb68..37f6ec3b8d808 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_permissions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_permissions_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -43,7 +42,8 @@ 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. + :param resource_group_name: The name of the resource group. The name + is case insensitive. :type resource_group_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -53,21 +53,22 @@ def list_for_resource_group( :return: An iterator like instance of Permission :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.PermissionPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.Permission] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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') + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -93,9 +94,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -112,7 +111,8 @@ 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. + :param resource_group_name: The name of the resource group. The name + is case insensitive. :type resource_group_name: str :param resource_provider_namespace: The namespace of the resource provider. @@ -132,25 +132,26 @@ def list_for_resource( :return: An iterator like instance of Permission :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.PermissionPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.Permission] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -176,9 +177,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_provider_operations_metadata_operations.py index 2376a6b16c7a1..363e59e88e775 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_provider_operations_metadata_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_provider_operations_metadata_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -57,7 +56,8 @@ def get( :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.ProviderOperationsMetadata or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get.metadata['url'] @@ -68,7 +68,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) if expand is not None: query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') @@ -87,9 +87,7 @@ def get( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -116,7 +114,8 @@ def list( :return: An iterator like instance of ProviderOperationsMetadata :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.ProviderOperationsMetadataPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.ProviderOperationsMetadata] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -125,7 +124,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) if expand is not None: query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') @@ -153,9 +152,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_assignments_operations.py index e951cf39508bc..aa414215671d3 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_assignments_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -43,7 +42,8 @@ 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. + :param resource_group_name: The name of the resource group. The name + is case insensitive. :type resource_group_name: str :param resource_provider_namespace: The namespace of the resource provider. @@ -68,19 +68,20 @@ def list_for_resource( :return: An iterator like instance of RoleAssignment :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } url = self._client.format_url(url, **path_format_arguments) @@ -88,7 +89,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -114,9 +115,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -133,7 +132,8 @@ 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. + :param resource_group_name: The name of the resource group. The name + is case insensitive. :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 @@ -148,15 +148,16 @@ def list_for_resource_group( :return: An iterator like instance of RoleAssignment :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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') + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } url = self._client.format_url(url, **path_format_arguments) @@ -164,7 +165,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -190,9 +191,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -223,7 +222,8 @@ def delete( :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.delete.metadata['url'] @@ -235,7 +235,7 @@ def delete( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -251,10 +251,8 @@ def delete( 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 + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -294,7 +292,8 @@ def create( :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.create.metadata['url'] @@ -306,7 +305,7 @@ def create( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -327,9 +326,7 @@ def create( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 201: @@ -359,7 +356,8 @@ def get( :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get.metadata['url'] @@ -371,7 +369,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -388,9 +386,7 @@ def get( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -418,7 +414,8 @@ def delete_by_id( :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.delete_by_id.metadata['url'] @@ -429,7 +426,7 @@ def delete_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -445,10 +442,8 @@ def delete_by_id( 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 + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -479,7 +474,8 @@ def create_by_id( :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.create_by_id.metadata['url'] @@ -490,7 +486,7 @@ def create_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -511,9 +507,7 @@ def create_by_id( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 201: @@ -541,7 +535,8 @@ def get_by_id( :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get_by_id.metadata['url'] @@ -552,7 +547,7 @@ def get_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -569,9 +564,7 @@ def get_by_id( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -601,14 +594,15 @@ def list( :return: An iterator like instance of RoleAssignment :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } url = self._client.format_url(url, **path_format_arguments) @@ -616,7 +610,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -642,9 +636,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -676,7 +668,8 @@ def list_for_scope( :return: An iterator like instance of RoleAssignment :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -691,7 +684,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -717,9 +710,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_definitions_operations.py index c921ee6551e83..aa68b30a9baa3 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/operations/_role_definitions_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -56,7 +55,8 @@ def delete( :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.delete.metadata['url'] @@ -68,7 +68,7 @@ def delete( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -84,10 +84,8 @@ def delete( 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 + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -117,7 +115,8 @@ def get( :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get.metadata['url'] @@ -129,7 +128,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -146,9 +145,7 @@ def get( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -181,7 +178,8 @@ def create_or_update( :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.create_or_update.metadata['url'] @@ -193,7 +191,7 @@ def create_or_update( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -214,9 +212,7 @@ def create_or_update( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 201: @@ -246,7 +242,8 @@ def list( :return: An iterator like instance of RoleDefinition :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinitionPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -261,7 +258,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -287,9 +284,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -322,7 +317,8 @@ def get_by_id( :rtype: ~azure.mgmt.authorization.v2018_01_01_preview.models.RoleDefinition or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get_by_id.metadata['url'] @@ -333,7 +329,7 @@ def get_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -350,9 +346,7 @@ def get_by_id( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/__init__.py new file mode 100644 index 0000000000000..e8714b719dfc2 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_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/v2018_05_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_authorization_management_client.py new file mode 100644 index 0000000000000..5be11b05b4c35 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_authorization_management_client.py @@ -0,0 +1,89 @@ +# 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 Operations +from .operations import AccessReviewScheduleDefinitionsOperations +from .operations import AccessReviewInstancesOperations +from .operations import AccessReviewInstanceOperations +from .operations import AccessReviewInstanceDecisionsOperations +from .operations import AccessReviewDefaultSettingsOperations +from .operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations +from .operations import AccessReviewInstancesAssignedForMyApprovalOperations +from .operations import AccessReviewInstanceMyDecisionsOperations +from . import models + + +class AuthorizationManagementClient(SDKClient): + """Access reviews service provides the workflow for running access reviews on different kind of resources. + + :ivar config: Configuration for client. + :vartype config: AuthorizationManagementClientConfiguration + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.authorization.v2018_05_01_preview.operations.Operations + :ivar access_review_schedule_definitions: AccessReviewScheduleDefinitions operations + :vartype access_review_schedule_definitions: azure.mgmt.authorization.v2018_05_01_preview.operations.AccessReviewScheduleDefinitionsOperations + :ivar access_review_instances: AccessReviewInstances operations + :vartype access_review_instances: azure.mgmt.authorization.v2018_05_01_preview.operations.AccessReviewInstancesOperations + :ivar access_review_instance: AccessReviewInstance operations + :vartype access_review_instance: azure.mgmt.authorization.v2018_05_01_preview.operations.AccessReviewInstanceOperations + :ivar access_review_instance_decisions: AccessReviewInstanceDecisions operations + :vartype access_review_instance_decisions: azure.mgmt.authorization.v2018_05_01_preview.operations.AccessReviewInstanceDecisionsOperations + :ivar access_review_default_settings: AccessReviewDefaultSettings operations + :vartype access_review_default_settings: azure.mgmt.authorization.v2018_05_01_preview.operations.AccessReviewDefaultSettingsOperations + :ivar access_review_schedule_definitions_assigned_for_my_approval: AccessReviewScheduleDefinitionsAssignedForMyApproval operations + :vartype access_review_schedule_definitions_assigned_for_my_approval: azure.mgmt.authorization.v2018_05_01_preview.operations.AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations + :ivar access_review_instances_assigned_for_my_approval: AccessReviewInstancesAssignedForMyApproval operations + :vartype access_review_instances_assigned_for_my_approval: azure.mgmt.authorization.v2018_05_01_preview.operations.AccessReviewInstancesAssignedForMyApprovalOperations + :ivar access_review_instance_my_decisions: AccessReviewInstanceMyDecisions operations + :vartype access_review_instance_my_decisions: azure.mgmt.authorization.v2018_05_01_preview.operations.AccessReviewInstanceMyDecisionsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = AuthorizationManagementClientConfiguration(credentials, subscription_id, base_url) + super(AuthorizationManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2018-05-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_schedule_definitions = AccessReviewScheduleDefinitionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_instances = AccessReviewInstancesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_instance = AccessReviewInstanceOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_instance_decisions = AccessReviewInstanceDecisionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_default_settings = AccessReviewDefaultSettingsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_schedule_definitions_assigned_for_my_approval = AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_instances_assigned_for_my_approval = AccessReviewInstancesAssignedForMyApprovalOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_instance_my_decisions = AccessReviewInstanceMyDecisionsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_configuration.py new file mode 100644 index 0000000000000..c192b8088f15e --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_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/v2018_05_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/__init__.py new file mode 100644 index 0000000000000..ca65be97a222d --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/__init__.py @@ -0,0 +1,95 @@ +# 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 AccessReviewDecision + from ._models_py3 import AccessReviewDecisionProperties + from ._models_py3 import AccessReviewDecisionTarget + from ._models_py3 import AccessReviewDefaultSettings + from ._models_py3 import AccessReviewInstance + from ._models_py3 import AccessReviewReviewer + from ._models_py3 import AccessReviewScheduleDefinition + from ._models_py3 import AccessReviewScheduleDefinitionProperties + from ._models_py3 import AccessReviewScheduleSettings + from ._models_py3 import ErrorDefinition, ErrorDefinitionException + from ._models_py3 import ErrorDefinitionProperties + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import ServicePrincipalDecisionTarget + from ._models_py3 import UserDecisionTarget +except (SyntaxError, ImportError): + from ._models import AccessReviewDecision + from ._models import AccessReviewDecisionProperties + from ._models import AccessReviewDecisionTarget + from ._models import AccessReviewDefaultSettings + from ._models import AccessReviewInstance + from ._models import AccessReviewReviewer + from ._models import AccessReviewScheduleDefinition + from ._models import AccessReviewScheduleDefinitionProperties + from ._models import AccessReviewScheduleSettings + from ._models import ErrorDefinition, ErrorDefinitionException + from ._models import ErrorDefinitionProperties + from ._models import Operation + from ._models import OperationDisplay + from ._models import ServicePrincipalDecisionTarget + from ._models import UserDecisionTarget +from ._paged_models import AccessReviewDecisionPaged +from ._paged_models import AccessReviewInstancePaged +from ._paged_models import AccessReviewScheduleDefinitionPaged +from ._paged_models import OperationPaged +from ._authorization_management_client_enums import ( + AccessReviewScheduleDefinitionStatus, + AccessReviewActorIdentityType, + DefaultDecisionType, + AccessReviewRecurrencePatternType, + AccessReviewRecurrenceRangeType, + AccessReviewScopePrincipalType, + AccessReviewReviewerType, + AccessReviewScheduleDefinitionReviewersType, + AccessReviewInstanceStatus, + AccessRecommendationType, + AccessReviewResult, + AccessReviewApplyResult, +) + +__all__ = [ + 'AccessReviewDecision', + 'AccessReviewDecisionProperties', + 'AccessReviewDecisionTarget', + 'AccessReviewDefaultSettings', + 'AccessReviewInstance', + 'AccessReviewReviewer', + 'AccessReviewScheduleDefinition', + 'AccessReviewScheduleDefinitionProperties', + 'AccessReviewScheduleSettings', + 'ErrorDefinition', 'ErrorDefinitionException', + 'ErrorDefinitionProperties', + 'Operation', + 'OperationDisplay', + 'ServicePrincipalDecisionTarget', + 'UserDecisionTarget', + 'OperationPaged', + 'AccessReviewScheduleDefinitionPaged', + 'AccessReviewInstancePaged', + 'AccessReviewDecisionPaged', + 'AccessReviewScheduleDefinitionStatus', + 'AccessReviewActorIdentityType', + 'DefaultDecisionType', + 'AccessReviewRecurrencePatternType', + 'AccessReviewRecurrenceRangeType', + 'AccessReviewScopePrincipalType', + 'AccessReviewReviewerType', + 'AccessReviewScheduleDefinitionReviewersType', + 'AccessReviewInstanceStatus', + 'AccessRecommendationType', + 'AccessReviewResult', + 'AccessReviewApplyResult', +] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_authorization_management_client_enums.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_authorization_management_client_enums.py new file mode 100644 index 0000000000000..f5f418ee37b8a --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_authorization_management_client_enums.py @@ -0,0 +1,113 @@ +# 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 AccessReviewScheduleDefinitionStatus(str, Enum): + + not_started = "NotStarted" + in_progress = "InProgress" + completed = "Completed" + applied = "Applied" + initializing = "Initializing" + applying = "Applying" + completing = "Completing" + scheduled = "Scheduled" + auto_reviewing = "AutoReviewing" + auto_reviewed = "AutoReviewed" + starting = "Starting" + + +class AccessReviewActorIdentityType(str, Enum): + + user = "user" + service_principal = "servicePrincipal" + + +class DefaultDecisionType(str, Enum): + + approve = "Approve" + deny = "Deny" + recommendation = "Recommendation" + + +class AccessReviewRecurrencePatternType(str, Enum): + + weekly = "weekly" + absolute_monthly = "absoluteMonthly" + + +class AccessReviewRecurrenceRangeType(str, Enum): + + end_date = "endDate" + no_end = "noEnd" + numbered = "numbered" + + +class AccessReviewScopePrincipalType(str, Enum): + + user = "user" + service_principal = "servicePrincipal" + + +class AccessReviewReviewerType(str, Enum): + + user = "user" + service_principal = "servicePrincipal" + + +class AccessReviewScheduleDefinitionReviewersType(str, Enum): + + assigned = "Assigned" + self_enum = "Self" + managers = "Managers" + + +class AccessReviewInstanceStatus(str, Enum): + + not_started = "NotStarted" + in_progress = "InProgress" + completed = "Completed" + applied = "Applied" + initializing = "Initializing" + applying = "Applying" + completing = "Completing" + scheduled = "Scheduled" + auto_reviewing = "AutoReviewing" + auto_reviewed = "AutoReviewed" + starting = "Starting" + + +class AccessRecommendationType(str, Enum): + + approve = "Approve" + deny = "Deny" + no_info_available = "NoInfoAvailable" + + +class AccessReviewResult(str, Enum): + + approve = "Approve" + deny = "Deny" + not_reviewed = "NotReviewed" + dont_know = "DontKnow" + not_notified = "NotNotified" + + +class AccessReviewApplyResult(str, Enum): + + new = "New" + applying = "Applying" + applied_successfully = "AppliedSuccessfully" + applied_with_unknown_failure = "AppliedWithUnknownFailure" + applied_successfully_but_object_not_found = "AppliedSuccessfullyButObjectNotFound" + apply_not_supported = "ApplyNotSupported" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models.py new file mode 100644 index 0000000000000..a1ca401fb100a --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models.py @@ -0,0 +1,1095 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class AccessReviewDecision(Model): + """Access Review. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review decision id. + :vartype id: str + :ivar name: The access review decision name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar recommendation: The feature- generated recommendation shown to the + reviewer. Possible values include: 'Approve', 'Deny', 'NoInfoAvailable' + :vartype recommendation: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessRecommendationType + :param decision: The decision on the approval step. This value is + initially set to NotReviewed. Approvers can take action of Approve/Deny. + Possible values include: 'Approve', 'Deny', 'NotReviewed', 'DontKnow', + 'NotNotified' + :type decision: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewResult + :param justification: Justification provided by approvers for their action + :type justification: str + :ivar reviewed_date_time: Date Time when a decision was taken. + :vartype reviewed_date_time: datetime + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :ivar apply_result: The outcome of applying the decision. Possible values + include: 'New', 'Applying', 'AppliedSuccessfully', + 'AppliedWithUnknownFailure', 'AppliedSuccessfullyButObjectNotFound', + 'ApplyNotSupported' + :vartype apply_result: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewApplyResult + :ivar applied_date_time: The date and time when the review decision was + applied. + :vartype applied_date_time: datetime + :ivar principal_id1: The identity id + :vartype principal_id1: str + :ivar principal_type1: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name1: The identity display name + :vartype principal_name1: str + :ivar user_principal_name1: The user principal name(if valid) + :vartype user_principal_name1: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'recommendation': {'readonly': True}, + 'reviewed_date_time': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'apply_result': {'readonly': True}, + 'applied_date_time': {'readonly': True}, + 'principal_id1': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'principal_name1': {'readonly': True}, + 'user_principal_name1': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'recommendation': {'key': 'properties.recommendation', 'type': 'str'}, + 'decision': {'key': 'properties.decision', 'type': 'str'}, + 'justification': {'key': 'properties.justification', 'type': 'str'}, + 'reviewed_date_time': {'key': 'properties.reviewedDateTime', 'type': 'iso-8601'}, + 'principal_id': {'key': 'properties.reviewedBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.reviewedBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'properties.reviewedBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'properties.reviewedBy.userPrincipalName', 'type': 'str'}, + 'apply_result': {'key': 'properties.applyResult', 'type': 'str'}, + 'applied_date_time': {'key': 'properties.appliedDateTime', 'type': 'iso-8601'}, + 'principal_id1': {'key': 'properties.appliedBy.principalId', 'type': 'str'}, + 'principal_type1': {'key': 'properties.appliedBy.principalType', 'type': 'str'}, + 'principal_name1': {'key': 'properties.appliedBy.principalName', 'type': 'str'}, + 'user_principal_name1': {'key': 'properties.appliedBy.userPrincipalName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AccessReviewDecision, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.recommendation = None + self.decision = kwargs.get('decision', None) + self.justification = kwargs.get('justification', None) + self.reviewed_date_time = None + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.apply_result = None + self.applied_date_time = None + self.principal_id1 = None + self.principal_type1 = None + self.principal_name1 = None + self.user_principal_name1 = None + + +class AccessReviewDecisionProperties(Model): + """Approval Step. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar recommendation: The feature- generated recommendation shown to the + reviewer. Possible values include: 'Approve', 'Deny', 'NoInfoAvailable' + :vartype recommendation: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessRecommendationType + :param decision: The decision on the approval step. This value is + initially set to NotReviewed. Approvers can take action of Approve/Deny. + Possible values include: 'Approve', 'Deny', 'NotReviewed', 'DontKnow', + 'NotNotified' + :type decision: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewResult + :param justification: Justification provided by approvers for their action + :type justification: str + :ivar reviewed_date_time: Date Time when a decision was taken. + :vartype reviewed_date_time: datetime + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :ivar apply_result: The outcome of applying the decision. Possible values + include: 'New', 'Applying', 'AppliedSuccessfully', + 'AppliedWithUnknownFailure', 'AppliedSuccessfullyButObjectNotFound', + 'ApplyNotSupported' + :vartype apply_result: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewApplyResult + :ivar applied_date_time: The date and time when the review decision was + applied. + :vartype applied_date_time: datetime + :ivar principal_id1: The identity id + :vartype principal_id1: str + :ivar principal_type1: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name1: The identity display name + :vartype principal_name1: str + :ivar user_principal_name1: The user principal name(if valid) + :vartype user_principal_name1: str + """ + + _validation = { + 'recommendation': {'readonly': True}, + 'reviewed_date_time': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'apply_result': {'readonly': True}, + 'applied_date_time': {'readonly': True}, + 'principal_id1': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'principal_name1': {'readonly': True}, + 'user_principal_name1': {'readonly': True}, + } + + _attribute_map = { + 'recommendation': {'key': 'recommendation', 'type': 'str'}, + 'decision': {'key': 'decision', 'type': 'str'}, + 'justification': {'key': 'justification', 'type': 'str'}, + 'reviewed_date_time': {'key': 'reviewedDateTime', 'type': 'iso-8601'}, + 'principal_id': {'key': 'reviewedBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'reviewedBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'reviewedBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'reviewedBy.userPrincipalName', 'type': 'str'}, + 'apply_result': {'key': 'applyResult', 'type': 'str'}, + 'applied_date_time': {'key': 'appliedDateTime', 'type': 'iso-8601'}, + 'principal_id1': {'key': 'appliedBy.principalId', 'type': 'str'}, + 'principal_type1': {'key': 'appliedBy.principalType', 'type': 'str'}, + 'principal_name1': {'key': 'appliedBy.principalName', 'type': 'str'}, + 'user_principal_name1': {'key': 'appliedBy.userPrincipalName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AccessReviewDecisionProperties, self).__init__(**kwargs) + self.recommendation = None + self.decision = kwargs.get('decision', None) + self.justification = kwargs.get('justification', None) + self.reviewed_date_time = None + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.apply_result = None + self.applied_date_time = None + self.principal_id1 = None + self.principal_type1 = None + self.principal_name1 = None + self.user_principal_name1 = None + + +class AccessReviewDecisionTarget(Model): + """Target of the decision. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: UserDecisionTarget, ServicePrincipalDecisionTarget + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. + :type type: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'user': 'UserDecisionTarget', 'servicePrincipal': 'ServicePrincipalDecisionTarget'} + } + + def __init__(self, **kwargs): + super(AccessReviewDecisionTarget, self).__init__(**kwargs) + self.type = None + + +class AccessReviewDefaultSettings(Model): + """Access Review Default Settings. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review default settings id. This is only going to be + default + :vartype id: str + :ivar name: The access review default settings name. This is always going + to be Access Review Default Settings + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param type1: The recurrence type : weekly, monthly, etc. Possible values + include: 'weekly', 'absoluteMonthly' + :type type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrencePatternType + :param interval: The interval for recurrence. For a quarterly review, the + interval is 3 for type : absoluteMonthly. + :type interval: int + :param type2: The recurrence range type. The possible values are: endDate, + noEnd, numbered. Possible values include: 'endDate', 'noEnd', 'numbered' + :type type2: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrenceRangeType + :param number_of_occurrences: The number of times to repeat the access + review. Required and must be positive if type is numbered. + :type number_of_occurrences: int + :param start_date: The DateTime when the review is scheduled to be start. + This could be a date in the future. Required on create. + :type start_date: datetime + :param end_date: The DateTime when the review is scheduled to end. + Required if type is endDate + :type end_date: datetime + """ + + _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'}, + 'mail_notifications_enabled': {'key': 'properties.mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'properties.reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'properties.defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'properties.justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'properties.defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'properties.autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'properties.recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'properties.instanceDurationInDays', 'type': 'int'}, + 'type1': {'key': 'properties.recurrence.pattern.type', 'type': 'str'}, + 'interval': {'key': 'properties.recurrence.pattern.interval', 'type': 'int'}, + 'type2': {'key': 'properties.recurrence.range.type', 'type': 'str'}, + 'number_of_occurrences': {'key': 'properties.recurrence.range.numberOfOccurrences', 'type': 'int'}, + 'start_date': {'key': 'properties.recurrence.range.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'properties.recurrence.range.endDate', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(AccessReviewDefaultSettings, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.mail_notifications_enabled = kwargs.get('mail_notifications_enabled', None) + self.reminder_notifications_enabled = kwargs.get('reminder_notifications_enabled', None) + self.default_decision_enabled = kwargs.get('default_decision_enabled', None) + self.justification_required_on_approval = kwargs.get('justification_required_on_approval', None) + self.default_decision = kwargs.get('default_decision', None) + self.auto_apply_decisions_enabled = kwargs.get('auto_apply_decisions_enabled', None) + self.recommendations_enabled = kwargs.get('recommendations_enabled', None) + self.instance_duration_in_days = kwargs.get('instance_duration_in_days', None) + self.type1 = kwargs.get('type1', None) + self.interval = kwargs.get('interval', None) + self.type2 = kwargs.get('type2', None) + self.number_of_occurrences = kwargs.get('number_of_occurrences', None) + self.start_date = kwargs.get('start_date', None) + self.end_date = kwargs.get('end_date', None) + + +class AccessReviewInstance(Model): + """Access Review Instance. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review instance id. + :vartype id: str + :ivar name: The access review instance name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar status: This read-only field specifies the status of an access + review instance. Possible values include: 'NotStarted', 'InProgress', + 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + :vartype status: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstanceStatus + :param start_date_time: The DateTime when the review instance is scheduled + to be start. + :type start_date_time: datetime + :param end_date_time: The DateTime when the review instance is scheduled + to end. + :type end_date_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'start_date_time': {'key': 'properties.startDateTime', 'type': 'iso-8601'}, + 'end_date_time': {'key': 'properties.endDateTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(AccessReviewInstance, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.status = None + self.start_date_time = kwargs.get('start_date_time', None) + self.end_date_time = kwargs.get('end_date_time', None) + + +class AccessReviewReviewer(Model): + """Descriptor for what needs to be reviewed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param principal_id: The id of the reviewer(user/servicePrincipal) + :type principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewReviewerType + """ + + _validation = { + 'principal_type': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'principal_type': {'key': 'principalType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AccessReviewReviewer, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.principal_type = None + + +class AccessReviewScheduleDefinition(Model): + """Access Review Schedule Definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review schedule definition id. + :vartype id: str + :ivar name: The access review schedule definition unique id. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param display_name: The display name for the schedule definition. + :type display_name: str + :ivar status: This read-only field specifies the status of an + accessReview. Possible values include: 'NotStarted', 'InProgress', + 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + :vartype status: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionStatus + :param description_for_admins: The description provided by the access + review creator and visible to admins. + :type description_for_admins: str + :param description_for_reviewers: The description provided by the access + review creator to be shown to reviewers. + :type description_for_reviewers: str + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param type1: The recurrence type : weekly, monthly, etc. Possible values + include: 'weekly', 'absoluteMonthly' + :type type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrencePatternType + :param interval: The interval for recurrence. For a quarterly review, the + interval is 3 for type : absoluteMonthly. + :type interval: int + :param type2: The recurrence range type. The possible values are: endDate, + noEnd, numbered. Possible values include: 'endDate', 'noEnd', 'numbered' + :type type2: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrenceRangeType + :param number_of_occurrences: The number of times to repeat the access + review. Required and must be positive if type is numbered. + :type number_of_occurrences: int + :param start_date: The DateTime when the review is scheduled to be start. + This could be a date in the future. Required on create. + :type start_date: datetime + :param end_date: The DateTime when the review is scheduled to end. + Required if type is endDate + :type end_date: datetime + :ivar resource_id: ResourceId in which this review is getting created + :vartype resource_id: str + :ivar role_definition_id: This is used to indicate the role being reviewed + :vartype role_definition_id: str + :ivar principal_type1: The identity type user/servicePrincipal to review. + Possible values include: 'user', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScopePrincipalType + :param reviewers: This is the collection of reviewers. + :type reviewers: + list[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewReviewer] + :ivar reviewers_type: This field specifies the type of reviewers for a + review. Usually for a review, reviewers are explicitly assigned. However, + in some cases, the reviewers may not be assigned and instead be chosen + dynamically. For example managers review or self review. Possible values + include: 'Assigned', 'Self', 'Managers' + :vartype reviewers_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionReviewersType + :param instances: This is the collection of instances returned when one + does an expand on it. + :type instances: + list[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstance] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'role_definition_id': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'reviewers_type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'description_for_admins': {'key': 'properties.descriptionForAdmins', 'type': 'str'}, + 'description_for_reviewers': {'key': 'properties.descriptionForReviewers', 'type': 'str'}, + 'principal_id': {'key': 'properties.createdBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.createdBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'properties.createdBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'properties.createdBy.userPrincipalName', 'type': 'str'}, + 'mail_notifications_enabled': {'key': 'properties.settings.mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'properties.settings.reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'properties.settings.defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'properties.settings.justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'properties.settings.defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'properties.settings.autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'properties.settings.recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'properties.settings.instanceDurationInDays', 'type': 'int'}, + 'type1': {'key': 'properties.settings.recurrence.pattern.type', 'type': 'str'}, + 'interval': {'key': 'properties.settings.recurrence.pattern.interval', 'type': 'int'}, + 'type2': {'key': 'properties.settings.recurrence.range.type', 'type': 'str'}, + 'number_of_occurrences': {'key': 'properties.settings.recurrence.range.numberOfOccurrences', 'type': 'int'}, + 'start_date': {'key': 'properties.settings.recurrence.range.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'properties.settings.recurrence.range.endDate', 'type': 'iso-8601'}, + 'resource_id': {'key': 'properties.scope.resourceId', 'type': 'str'}, + 'role_definition_id': {'key': 'properties.scope.roleDefinitionId', 'type': 'str'}, + 'principal_type1': {'key': 'properties.scope.principalType', 'type': 'str'}, + 'reviewers': {'key': 'properties.reviewers', 'type': '[AccessReviewReviewer]'}, + 'reviewers_type': {'key': 'properties.reviewersType', 'type': 'str'}, + 'instances': {'key': 'properties.instances', 'type': '[AccessReviewInstance]'}, + } + + def __init__(self, **kwargs): + super(AccessReviewScheduleDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.display_name = kwargs.get('display_name', None) + self.status = None + self.description_for_admins = kwargs.get('description_for_admins', None) + self.description_for_reviewers = kwargs.get('description_for_reviewers', None) + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.mail_notifications_enabled = kwargs.get('mail_notifications_enabled', None) + self.reminder_notifications_enabled = kwargs.get('reminder_notifications_enabled', None) + self.default_decision_enabled = kwargs.get('default_decision_enabled', None) + self.justification_required_on_approval = kwargs.get('justification_required_on_approval', None) + self.default_decision = kwargs.get('default_decision', None) + self.auto_apply_decisions_enabled = kwargs.get('auto_apply_decisions_enabled', None) + self.recommendations_enabled = kwargs.get('recommendations_enabled', None) + self.instance_duration_in_days = kwargs.get('instance_duration_in_days', None) + self.type1 = kwargs.get('type1', None) + self.interval = kwargs.get('interval', None) + self.type2 = kwargs.get('type2', None) + self.number_of_occurrences = kwargs.get('number_of_occurrences', None) + self.start_date = kwargs.get('start_date', None) + self.end_date = kwargs.get('end_date', None) + self.resource_id = None + self.role_definition_id = None + self.principal_type1 = None + self.reviewers = kwargs.get('reviewers', None) + self.reviewers_type = None + self.instances = kwargs.get('instances', None) + + +class AccessReviewScheduleDefinitionProperties(Model): + """Access Review. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param display_name: The display name for the schedule definition. + :type display_name: str + :ivar status: This read-only field specifies the status of an + accessReview. Possible values include: 'NotStarted', 'InProgress', + 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + :vartype status: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionStatus + :param description_for_admins: The description provided by the access + review creator and visible to admins. + :type description_for_admins: str + :param description_for_reviewers: The description provided by the access + review creator to be shown to reviewers. + :type description_for_reviewers: str + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param type: The recurrence type : weekly, monthly, etc. Possible values + include: 'weekly', 'absoluteMonthly' + :type type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrencePatternType + :param interval: The interval for recurrence. For a quarterly review, the + interval is 3 for type : absoluteMonthly. + :type interval: int + :param type1: The recurrence range type. The possible values are: endDate, + noEnd, numbered. Possible values include: 'endDate', 'noEnd', 'numbered' + :type type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrenceRangeType + :param number_of_occurrences: The number of times to repeat the access + review. Required and must be positive if type is numbered. + :type number_of_occurrences: int + :param start_date: The DateTime when the review is scheduled to be start. + This could be a date in the future. Required on create. + :type start_date: datetime + :param end_date: The DateTime when the review is scheduled to end. + Required if type is endDate + :type end_date: datetime + :ivar resource_id: ResourceId in which this review is getting created + :vartype resource_id: str + :ivar role_definition_id: This is used to indicate the role being reviewed + :vartype role_definition_id: str + :ivar principal_type1: The identity type user/servicePrincipal to review. + Possible values include: 'user', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScopePrincipalType + :param reviewers: This is the collection of reviewers. + :type reviewers: + list[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewReviewer] + :ivar reviewers_type: This field specifies the type of reviewers for a + review. Usually for a review, reviewers are explicitly assigned. However, + in some cases, the reviewers may not be assigned and instead be chosen + dynamically. For example managers review or self review. Possible values + include: 'Assigned', 'Self', 'Managers' + :vartype reviewers_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionReviewersType + :param instances: This is the collection of instances returned when one + does an expand on it. + :type instances: + list[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstance] + """ + + _validation = { + 'status': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'role_definition_id': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'reviewers_type': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'description_for_admins': {'key': 'descriptionForAdmins', 'type': 'str'}, + 'description_for_reviewers': {'key': 'descriptionForReviewers', 'type': 'str'}, + 'principal_id': {'key': 'createdBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'createdBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'createdBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'createdBy.userPrincipalName', 'type': 'str'}, + 'mail_notifications_enabled': {'key': 'settings.mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'settings.reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'settings.defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'settings.justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'settings.defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'settings.autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'settings.recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'settings.instanceDurationInDays', 'type': 'int'}, + 'type': {'key': 'settings.recurrence.pattern.type', 'type': 'str'}, + 'interval': {'key': 'settings.recurrence.pattern.interval', 'type': 'int'}, + 'type1': {'key': 'settings.recurrence.range.type', 'type': 'str'}, + 'number_of_occurrences': {'key': 'settings.recurrence.range.numberOfOccurrences', 'type': 'int'}, + 'start_date': {'key': 'settings.recurrence.range.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'settings.recurrence.range.endDate', 'type': 'iso-8601'}, + 'resource_id': {'key': 'scope.resourceId', 'type': 'str'}, + 'role_definition_id': {'key': 'scope.roleDefinitionId', 'type': 'str'}, + 'principal_type1': {'key': 'scope.principalType', 'type': 'str'}, + 'reviewers': {'key': 'reviewers', 'type': '[AccessReviewReviewer]'}, + 'reviewers_type': {'key': 'reviewersType', 'type': 'str'}, + 'instances': {'key': 'instances', 'type': '[AccessReviewInstance]'}, + } + + def __init__(self, **kwargs): + super(AccessReviewScheduleDefinitionProperties, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.status = None + self.description_for_admins = kwargs.get('description_for_admins', None) + self.description_for_reviewers = kwargs.get('description_for_reviewers', None) + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.mail_notifications_enabled = kwargs.get('mail_notifications_enabled', None) + self.reminder_notifications_enabled = kwargs.get('reminder_notifications_enabled', None) + self.default_decision_enabled = kwargs.get('default_decision_enabled', None) + self.justification_required_on_approval = kwargs.get('justification_required_on_approval', None) + self.default_decision = kwargs.get('default_decision', None) + self.auto_apply_decisions_enabled = kwargs.get('auto_apply_decisions_enabled', None) + self.recommendations_enabled = kwargs.get('recommendations_enabled', None) + self.instance_duration_in_days = kwargs.get('instance_duration_in_days', None) + self.type = kwargs.get('type', None) + self.interval = kwargs.get('interval', None) + self.type1 = kwargs.get('type1', None) + self.number_of_occurrences = kwargs.get('number_of_occurrences', None) + self.start_date = kwargs.get('start_date', None) + self.end_date = kwargs.get('end_date', None) + self.resource_id = None + self.role_definition_id = None + self.principal_type1 = None + self.reviewers = kwargs.get('reviewers', None) + self.reviewers_type = None + self.instances = kwargs.get('instances', None) + + +class AccessReviewScheduleSettings(Model): + """Settings of an Access Review. + + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param recurrence: Access Review Settings. + :type recurrence: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrenceSettings + """ + + _attribute_map = { + 'mail_notifications_enabled': {'key': 'mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'instanceDurationInDays', 'type': 'int'}, + 'recurrence': {'key': 'recurrence', 'type': 'AccessReviewRecurrenceSettings'}, + } + + def __init__(self, **kwargs): + super(AccessReviewScheduleSettings, self).__init__(**kwargs) + self.mail_notifications_enabled = kwargs.get('mail_notifications_enabled', None) + self.reminder_notifications_enabled = kwargs.get('reminder_notifications_enabled', None) + self.default_decision_enabled = kwargs.get('default_decision_enabled', None) + self.justification_required_on_approval = kwargs.get('justification_required_on_approval', None) + self.default_decision = kwargs.get('default_decision', None) + self.auto_apply_decisions_enabled = kwargs.get('auto_apply_decisions_enabled', None) + self.recommendations_enabled = kwargs.get('recommendations_enabled', None) + self.instance_duration_in_days = kwargs.get('instance_duration_in_days', None) + self.recurrence = kwargs.get('recurrence', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorDefinition(Model): + """Error. + + Error description and code explaining why an operation failed. + + :param error: Error of the list gateway status. + :type error: + ~azure.mgmt.authorization.v2018_05_01_preview.models.ErrorDefinitionProperties + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinitionProperties'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinition, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorDefinitionException(HttpOperationError): + """Server responsed with exception of type: 'ErrorDefinition'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorDefinitionException, self).__init__(deserialize, response, 'ErrorDefinition', *args) + + +class ErrorDefinitionProperties(Model): + """Error. + + Error description and code explaining why an operation failed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar message: Description of the error. + :vartype message: str + :param code: Error code of list gateway. + :type code: str + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinitionProperties, self).__init__(**kwargs) + self.message = None + self.code = kwargs.get('code', None) + + +class Operation(Model): + """The definition of a Microsoft.Authorization operation. + + :param name: Name of the operation + :type name: str + :param is_data_action: Indicates whether the operation is a data action + :type is_data_action: bool + :param display: Display of the operation + :type display: + ~azure.mgmt.authorization.v2018_05_01_preview.models.OperationDisplay + :param origin: Origin of the operation + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + + +class OperationDisplay(Model): + """The display information for a Microsoft.Authorization operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: The resource provider name: Microsoft.Authorization. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class ServicePrincipalDecisionTarget(AccessReviewDecisionTarget): + """Service Principal Decision Target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. + :type type: str + :ivar principal_id: The id of service principal whose access is reviewed. + :vartype principal_id: str + :ivar principal_name: The display name of the service principal whose + access was reviewed. + :vartype principal_name: str + :ivar app_id: The appId for the service principal entity being reviewed + :vartype app_id: str + """ + + _validation = { + 'type': {'required': True}, + 'principal_id': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'app_id': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'principal_name': {'key': 'principalName', 'type': 'str'}, + 'app_id': {'key': 'appId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ServicePrincipalDecisionTarget, self).__init__(**kwargs) + self.principal_id = None + self.principal_name = None + self.app_id = None + self.type = 'servicePrincipal' + + +class UserDecisionTarget(AccessReviewDecisionTarget): + """User Decision Target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. + :type type: str + :ivar principal_id: The id of user whose access was reviewed. + :vartype principal_id: str + :ivar principal_name: The display name of the user whose access was + reviewed. + :vartype principal_name: str + :ivar user_principal_name: The user principal name of the user whose + access was reviewed. + :vartype user_principal_name: str + """ + + _validation = { + 'type': {'required': True}, + 'principal_id': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'principal_name': {'key': 'principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'userPrincipalName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UserDecisionTarget, self).__init__(**kwargs) + self.principal_id = None + self.principal_name = None + self.user_principal_name = None + self.type = 'user' diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models_py3.py new file mode 100644 index 0000000000000..ddf2d9365d2f0 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_models_py3.py @@ -0,0 +1,1095 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class AccessReviewDecision(Model): + """Access Review. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review decision id. + :vartype id: str + :ivar name: The access review decision name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar recommendation: The feature- generated recommendation shown to the + reviewer. Possible values include: 'Approve', 'Deny', 'NoInfoAvailable' + :vartype recommendation: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessRecommendationType + :param decision: The decision on the approval step. This value is + initially set to NotReviewed. Approvers can take action of Approve/Deny. + Possible values include: 'Approve', 'Deny', 'NotReviewed', 'DontKnow', + 'NotNotified' + :type decision: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewResult + :param justification: Justification provided by approvers for their action + :type justification: str + :ivar reviewed_date_time: Date Time when a decision was taken. + :vartype reviewed_date_time: datetime + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :ivar apply_result: The outcome of applying the decision. Possible values + include: 'New', 'Applying', 'AppliedSuccessfully', + 'AppliedWithUnknownFailure', 'AppliedSuccessfullyButObjectNotFound', + 'ApplyNotSupported' + :vartype apply_result: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewApplyResult + :ivar applied_date_time: The date and time when the review decision was + applied. + :vartype applied_date_time: datetime + :ivar principal_id1: The identity id + :vartype principal_id1: str + :ivar principal_type1: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name1: The identity display name + :vartype principal_name1: str + :ivar user_principal_name1: The user principal name(if valid) + :vartype user_principal_name1: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'recommendation': {'readonly': True}, + 'reviewed_date_time': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'apply_result': {'readonly': True}, + 'applied_date_time': {'readonly': True}, + 'principal_id1': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'principal_name1': {'readonly': True}, + 'user_principal_name1': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'recommendation': {'key': 'properties.recommendation', 'type': 'str'}, + 'decision': {'key': 'properties.decision', 'type': 'str'}, + 'justification': {'key': 'properties.justification', 'type': 'str'}, + 'reviewed_date_time': {'key': 'properties.reviewedDateTime', 'type': 'iso-8601'}, + 'principal_id': {'key': 'properties.reviewedBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.reviewedBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'properties.reviewedBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'properties.reviewedBy.userPrincipalName', 'type': 'str'}, + 'apply_result': {'key': 'properties.applyResult', 'type': 'str'}, + 'applied_date_time': {'key': 'properties.appliedDateTime', 'type': 'iso-8601'}, + 'principal_id1': {'key': 'properties.appliedBy.principalId', 'type': 'str'}, + 'principal_type1': {'key': 'properties.appliedBy.principalType', 'type': 'str'}, + 'principal_name1': {'key': 'properties.appliedBy.principalName', 'type': 'str'}, + 'user_principal_name1': {'key': 'properties.appliedBy.userPrincipalName', 'type': 'str'}, + } + + def __init__(self, *, decision=None, justification: str=None, **kwargs) -> None: + super(AccessReviewDecision, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.recommendation = None + self.decision = decision + self.justification = justification + self.reviewed_date_time = None + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.apply_result = None + self.applied_date_time = None + self.principal_id1 = None + self.principal_type1 = None + self.principal_name1 = None + self.user_principal_name1 = None + + +class AccessReviewDecisionProperties(Model): + """Approval Step. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar recommendation: The feature- generated recommendation shown to the + reviewer. Possible values include: 'Approve', 'Deny', 'NoInfoAvailable' + :vartype recommendation: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessRecommendationType + :param decision: The decision on the approval step. This value is + initially set to NotReviewed. Approvers can take action of Approve/Deny. + Possible values include: 'Approve', 'Deny', 'NotReviewed', 'DontKnow', + 'NotNotified' + :type decision: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewResult + :param justification: Justification provided by approvers for their action + :type justification: str + :ivar reviewed_date_time: Date Time when a decision was taken. + :vartype reviewed_date_time: datetime + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :ivar apply_result: The outcome of applying the decision. Possible values + include: 'New', 'Applying', 'AppliedSuccessfully', + 'AppliedWithUnknownFailure', 'AppliedSuccessfullyButObjectNotFound', + 'ApplyNotSupported' + :vartype apply_result: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewApplyResult + :ivar applied_date_time: The date and time when the review decision was + applied. + :vartype applied_date_time: datetime + :ivar principal_id1: The identity id + :vartype principal_id1: str + :ivar principal_type1: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name1: The identity display name + :vartype principal_name1: str + :ivar user_principal_name1: The user principal name(if valid) + :vartype user_principal_name1: str + """ + + _validation = { + 'recommendation': {'readonly': True}, + 'reviewed_date_time': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'apply_result': {'readonly': True}, + 'applied_date_time': {'readonly': True}, + 'principal_id1': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'principal_name1': {'readonly': True}, + 'user_principal_name1': {'readonly': True}, + } + + _attribute_map = { + 'recommendation': {'key': 'recommendation', 'type': 'str'}, + 'decision': {'key': 'decision', 'type': 'str'}, + 'justification': {'key': 'justification', 'type': 'str'}, + 'reviewed_date_time': {'key': 'reviewedDateTime', 'type': 'iso-8601'}, + 'principal_id': {'key': 'reviewedBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'reviewedBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'reviewedBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'reviewedBy.userPrincipalName', 'type': 'str'}, + 'apply_result': {'key': 'applyResult', 'type': 'str'}, + 'applied_date_time': {'key': 'appliedDateTime', 'type': 'iso-8601'}, + 'principal_id1': {'key': 'appliedBy.principalId', 'type': 'str'}, + 'principal_type1': {'key': 'appliedBy.principalType', 'type': 'str'}, + 'principal_name1': {'key': 'appliedBy.principalName', 'type': 'str'}, + 'user_principal_name1': {'key': 'appliedBy.userPrincipalName', 'type': 'str'}, + } + + def __init__(self, *, decision=None, justification: str=None, **kwargs) -> None: + super(AccessReviewDecisionProperties, self).__init__(**kwargs) + self.recommendation = None + self.decision = decision + self.justification = justification + self.reviewed_date_time = None + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.apply_result = None + self.applied_date_time = None + self.principal_id1 = None + self.principal_type1 = None + self.principal_name1 = None + self.user_principal_name1 = None + + +class AccessReviewDecisionTarget(Model): + """Target of the decision. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: UserDecisionTarget, ServicePrincipalDecisionTarget + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. + :type type: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'user': 'UserDecisionTarget', 'servicePrincipal': 'ServicePrincipalDecisionTarget'} + } + + def __init__(self, **kwargs) -> None: + super(AccessReviewDecisionTarget, self).__init__(**kwargs) + self.type = None + + +class AccessReviewDefaultSettings(Model): + """Access Review Default Settings. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review default settings id. This is only going to be + default + :vartype id: str + :ivar name: The access review default settings name. This is always going + to be Access Review Default Settings + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param type1: The recurrence type : weekly, monthly, etc. Possible values + include: 'weekly', 'absoluteMonthly' + :type type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrencePatternType + :param interval: The interval for recurrence. For a quarterly review, the + interval is 3 for type : absoluteMonthly. + :type interval: int + :param type2: The recurrence range type. The possible values are: endDate, + noEnd, numbered. Possible values include: 'endDate', 'noEnd', 'numbered' + :type type2: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrenceRangeType + :param number_of_occurrences: The number of times to repeat the access + review. Required and must be positive if type is numbered. + :type number_of_occurrences: int + :param start_date: The DateTime when the review is scheduled to be start. + This could be a date in the future. Required on create. + :type start_date: datetime + :param end_date: The DateTime when the review is scheduled to end. + Required if type is endDate + :type end_date: datetime + """ + + _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'}, + 'mail_notifications_enabled': {'key': 'properties.mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'properties.reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'properties.defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'properties.justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'properties.defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'properties.autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'properties.recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'properties.instanceDurationInDays', 'type': 'int'}, + 'type1': {'key': 'properties.recurrence.pattern.type', 'type': 'str'}, + 'interval': {'key': 'properties.recurrence.pattern.interval', 'type': 'int'}, + 'type2': {'key': 'properties.recurrence.range.type', 'type': 'str'}, + 'number_of_occurrences': {'key': 'properties.recurrence.range.numberOfOccurrences', 'type': 'int'}, + 'start_date': {'key': 'properties.recurrence.range.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'properties.recurrence.range.endDate', 'type': 'iso-8601'}, + } + + def __init__(self, *, mail_notifications_enabled: bool=None, reminder_notifications_enabled: bool=None, default_decision_enabled: bool=None, justification_required_on_approval: bool=None, default_decision=None, auto_apply_decisions_enabled: bool=None, recommendations_enabled: bool=None, instance_duration_in_days: int=None, type1=None, interval: int=None, type2=None, number_of_occurrences: int=None, start_date=None, end_date=None, **kwargs) -> None: + super(AccessReviewDefaultSettings, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.mail_notifications_enabled = mail_notifications_enabled + self.reminder_notifications_enabled = reminder_notifications_enabled + self.default_decision_enabled = default_decision_enabled + self.justification_required_on_approval = justification_required_on_approval + self.default_decision = default_decision + self.auto_apply_decisions_enabled = auto_apply_decisions_enabled + self.recommendations_enabled = recommendations_enabled + self.instance_duration_in_days = instance_duration_in_days + self.type1 = type1 + self.interval = interval + self.type2 = type2 + self.number_of_occurrences = number_of_occurrences + self.start_date = start_date + self.end_date = end_date + + +class AccessReviewInstance(Model): + """Access Review Instance. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review instance id. + :vartype id: str + :ivar name: The access review instance name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar status: This read-only field specifies the status of an access + review instance. Possible values include: 'NotStarted', 'InProgress', + 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + :vartype status: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstanceStatus + :param start_date_time: The DateTime when the review instance is scheduled + to be start. + :type start_date_time: datetime + :param end_date_time: The DateTime when the review instance is scheduled + to end. + :type end_date_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'start_date_time': {'key': 'properties.startDateTime', 'type': 'iso-8601'}, + 'end_date_time': {'key': 'properties.endDateTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, start_date_time=None, end_date_time=None, **kwargs) -> None: + super(AccessReviewInstance, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.status = None + self.start_date_time = start_date_time + self.end_date_time = end_date_time + + +class AccessReviewReviewer(Model): + """Descriptor for what needs to be reviewed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param principal_id: The id of the reviewer(user/servicePrincipal) + :type principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewReviewerType + """ + + _validation = { + 'principal_type': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'principal_type': {'key': 'principalType', 'type': 'str'}, + } + + def __init__(self, *, principal_id: str=None, **kwargs) -> None: + super(AccessReviewReviewer, self).__init__(**kwargs) + self.principal_id = principal_id + self.principal_type = None + + +class AccessReviewScheduleDefinition(Model): + """Access Review Schedule Definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review schedule definition id. + :vartype id: str + :ivar name: The access review schedule definition unique id. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param display_name: The display name for the schedule definition. + :type display_name: str + :ivar status: This read-only field specifies the status of an + accessReview. Possible values include: 'NotStarted', 'InProgress', + 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + :vartype status: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionStatus + :param description_for_admins: The description provided by the access + review creator and visible to admins. + :type description_for_admins: str + :param description_for_reviewers: The description provided by the access + review creator to be shown to reviewers. + :type description_for_reviewers: str + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param type1: The recurrence type : weekly, monthly, etc. Possible values + include: 'weekly', 'absoluteMonthly' + :type type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrencePatternType + :param interval: The interval for recurrence. For a quarterly review, the + interval is 3 for type : absoluteMonthly. + :type interval: int + :param type2: The recurrence range type. The possible values are: endDate, + noEnd, numbered. Possible values include: 'endDate', 'noEnd', 'numbered' + :type type2: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrenceRangeType + :param number_of_occurrences: The number of times to repeat the access + review. Required and must be positive if type is numbered. + :type number_of_occurrences: int + :param start_date: The DateTime when the review is scheduled to be start. + This could be a date in the future. Required on create. + :type start_date: datetime + :param end_date: The DateTime when the review is scheduled to end. + Required if type is endDate + :type end_date: datetime + :ivar resource_id: ResourceId in which this review is getting created + :vartype resource_id: str + :ivar role_definition_id: This is used to indicate the role being reviewed + :vartype role_definition_id: str + :ivar principal_type1: The identity type user/servicePrincipal to review. + Possible values include: 'user', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScopePrincipalType + :param reviewers: This is the collection of reviewers. + :type reviewers: + list[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewReviewer] + :ivar reviewers_type: This field specifies the type of reviewers for a + review. Usually for a review, reviewers are explicitly assigned. However, + in some cases, the reviewers may not be assigned and instead be chosen + dynamically. For example managers review or self review. Possible values + include: 'Assigned', 'Self', 'Managers' + :vartype reviewers_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionReviewersType + :param instances: This is the collection of instances returned when one + does an expand on it. + :type instances: + list[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstance] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'role_definition_id': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'reviewers_type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'description_for_admins': {'key': 'properties.descriptionForAdmins', 'type': 'str'}, + 'description_for_reviewers': {'key': 'properties.descriptionForReviewers', 'type': 'str'}, + 'principal_id': {'key': 'properties.createdBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.createdBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'properties.createdBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'properties.createdBy.userPrincipalName', 'type': 'str'}, + 'mail_notifications_enabled': {'key': 'properties.settings.mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'properties.settings.reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'properties.settings.defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'properties.settings.justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'properties.settings.defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'properties.settings.autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'properties.settings.recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'properties.settings.instanceDurationInDays', 'type': 'int'}, + 'type1': {'key': 'properties.settings.recurrence.pattern.type', 'type': 'str'}, + 'interval': {'key': 'properties.settings.recurrence.pattern.interval', 'type': 'int'}, + 'type2': {'key': 'properties.settings.recurrence.range.type', 'type': 'str'}, + 'number_of_occurrences': {'key': 'properties.settings.recurrence.range.numberOfOccurrences', 'type': 'int'}, + 'start_date': {'key': 'properties.settings.recurrence.range.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'properties.settings.recurrence.range.endDate', 'type': 'iso-8601'}, + 'resource_id': {'key': 'properties.scope.resourceId', 'type': 'str'}, + 'role_definition_id': {'key': 'properties.scope.roleDefinitionId', 'type': 'str'}, + 'principal_type1': {'key': 'properties.scope.principalType', 'type': 'str'}, + 'reviewers': {'key': 'properties.reviewers', 'type': '[AccessReviewReviewer]'}, + 'reviewers_type': {'key': 'properties.reviewersType', 'type': 'str'}, + 'instances': {'key': 'properties.instances', 'type': '[AccessReviewInstance]'}, + } + + def __init__(self, *, display_name: str=None, description_for_admins: str=None, description_for_reviewers: str=None, mail_notifications_enabled: bool=None, reminder_notifications_enabled: bool=None, default_decision_enabled: bool=None, justification_required_on_approval: bool=None, default_decision=None, auto_apply_decisions_enabled: bool=None, recommendations_enabled: bool=None, instance_duration_in_days: int=None, type1=None, interval: int=None, type2=None, number_of_occurrences: int=None, start_date=None, end_date=None, reviewers=None, instances=None, **kwargs) -> None: + super(AccessReviewScheduleDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.display_name = display_name + self.status = None + self.description_for_admins = description_for_admins + self.description_for_reviewers = description_for_reviewers + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.mail_notifications_enabled = mail_notifications_enabled + self.reminder_notifications_enabled = reminder_notifications_enabled + self.default_decision_enabled = default_decision_enabled + self.justification_required_on_approval = justification_required_on_approval + self.default_decision = default_decision + self.auto_apply_decisions_enabled = auto_apply_decisions_enabled + self.recommendations_enabled = recommendations_enabled + self.instance_duration_in_days = instance_duration_in_days + self.type1 = type1 + self.interval = interval + self.type2 = type2 + self.number_of_occurrences = number_of_occurrences + self.start_date = start_date + self.end_date = end_date + self.resource_id = None + self.role_definition_id = None + self.principal_type1 = None + self.reviewers = reviewers + self.reviewers_type = None + self.instances = instances + + +class AccessReviewScheduleDefinitionProperties(Model): + """Access Review. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param display_name: The display name for the schedule definition. + :type display_name: str + :ivar status: This read-only field specifies the status of an + accessReview. Possible values include: 'NotStarted', 'InProgress', + 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + :vartype status: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionStatus + :param description_for_admins: The description provided by the access + review creator and visible to admins. + :type description_for_admins: str + :param description_for_reviewers: The description provided by the access + review creator to be shown to reviewers. + :type description_for_reviewers: str + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param type: The recurrence type : weekly, monthly, etc. Possible values + include: 'weekly', 'absoluteMonthly' + :type type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrencePatternType + :param interval: The interval for recurrence. For a quarterly review, the + interval is 3 for type : absoluteMonthly. + :type interval: int + :param type1: The recurrence range type. The possible values are: endDate, + noEnd, numbered. Possible values include: 'endDate', 'noEnd', 'numbered' + :type type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrenceRangeType + :param number_of_occurrences: The number of times to repeat the access + review. Required and must be positive if type is numbered. + :type number_of_occurrences: int + :param start_date: The DateTime when the review is scheduled to be start. + This could be a date in the future. Required on create. + :type start_date: datetime + :param end_date: The DateTime when the review is scheduled to end. + Required if type is endDate + :type end_date: datetime + :ivar resource_id: ResourceId in which this review is getting created + :vartype resource_id: str + :ivar role_definition_id: This is used to indicate the role being reviewed + :vartype role_definition_id: str + :ivar principal_type1: The identity type user/servicePrincipal to review. + Possible values include: 'user', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScopePrincipalType + :param reviewers: This is the collection of reviewers. + :type reviewers: + list[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewReviewer] + :ivar reviewers_type: This field specifies the type of reviewers for a + review. Usually for a review, reviewers are explicitly assigned. However, + in some cases, the reviewers may not be assigned and instead be chosen + dynamically. For example managers review or self review. Possible values + include: 'Assigned', 'Self', 'Managers' + :vartype reviewers_type: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionReviewersType + :param instances: This is the collection of instances returned when one + does an expand on it. + :type instances: + list[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstance] + """ + + _validation = { + 'status': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'role_definition_id': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'reviewers_type': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'description_for_admins': {'key': 'descriptionForAdmins', 'type': 'str'}, + 'description_for_reviewers': {'key': 'descriptionForReviewers', 'type': 'str'}, + 'principal_id': {'key': 'createdBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'createdBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'createdBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'createdBy.userPrincipalName', 'type': 'str'}, + 'mail_notifications_enabled': {'key': 'settings.mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'settings.reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'settings.defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'settings.justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'settings.defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'settings.autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'settings.recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'settings.instanceDurationInDays', 'type': 'int'}, + 'type': {'key': 'settings.recurrence.pattern.type', 'type': 'str'}, + 'interval': {'key': 'settings.recurrence.pattern.interval', 'type': 'int'}, + 'type1': {'key': 'settings.recurrence.range.type', 'type': 'str'}, + 'number_of_occurrences': {'key': 'settings.recurrence.range.numberOfOccurrences', 'type': 'int'}, + 'start_date': {'key': 'settings.recurrence.range.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'settings.recurrence.range.endDate', 'type': 'iso-8601'}, + 'resource_id': {'key': 'scope.resourceId', 'type': 'str'}, + 'role_definition_id': {'key': 'scope.roleDefinitionId', 'type': 'str'}, + 'principal_type1': {'key': 'scope.principalType', 'type': 'str'}, + 'reviewers': {'key': 'reviewers', 'type': '[AccessReviewReviewer]'}, + 'reviewers_type': {'key': 'reviewersType', 'type': 'str'}, + 'instances': {'key': 'instances', 'type': '[AccessReviewInstance]'}, + } + + def __init__(self, *, display_name: str=None, description_for_admins: str=None, description_for_reviewers: str=None, mail_notifications_enabled: bool=None, reminder_notifications_enabled: bool=None, default_decision_enabled: bool=None, justification_required_on_approval: bool=None, default_decision=None, auto_apply_decisions_enabled: bool=None, recommendations_enabled: bool=None, instance_duration_in_days: int=None, type=None, interval: int=None, type1=None, number_of_occurrences: int=None, start_date=None, end_date=None, reviewers=None, instances=None, **kwargs) -> None: + super(AccessReviewScheduleDefinitionProperties, self).__init__(**kwargs) + self.display_name = display_name + self.status = None + self.description_for_admins = description_for_admins + self.description_for_reviewers = description_for_reviewers + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.mail_notifications_enabled = mail_notifications_enabled + self.reminder_notifications_enabled = reminder_notifications_enabled + self.default_decision_enabled = default_decision_enabled + self.justification_required_on_approval = justification_required_on_approval + self.default_decision = default_decision + self.auto_apply_decisions_enabled = auto_apply_decisions_enabled + self.recommendations_enabled = recommendations_enabled + self.instance_duration_in_days = instance_duration_in_days + self.type = type + self.interval = interval + self.type1 = type1 + self.number_of_occurrences = number_of_occurrences + self.start_date = start_date + self.end_date = end_date + self.resource_id = None + self.role_definition_id = None + self.principal_type1 = None + self.reviewers = reviewers + self.reviewers_type = None + self.instances = instances + + +class AccessReviewScheduleSettings(Model): + """Settings of an Access Review. + + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param recurrence: Access Review Settings. + :type recurrence: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewRecurrenceSettings + """ + + _attribute_map = { + 'mail_notifications_enabled': {'key': 'mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'instanceDurationInDays', 'type': 'int'}, + 'recurrence': {'key': 'recurrence', 'type': 'AccessReviewRecurrenceSettings'}, + } + + def __init__(self, *, mail_notifications_enabled: bool=None, reminder_notifications_enabled: bool=None, default_decision_enabled: bool=None, justification_required_on_approval: bool=None, default_decision=None, auto_apply_decisions_enabled: bool=None, recommendations_enabled: bool=None, instance_duration_in_days: int=None, recurrence=None, **kwargs) -> None: + super(AccessReviewScheduleSettings, self).__init__(**kwargs) + self.mail_notifications_enabled = mail_notifications_enabled + self.reminder_notifications_enabled = reminder_notifications_enabled + self.default_decision_enabled = default_decision_enabled + self.justification_required_on_approval = justification_required_on_approval + self.default_decision = default_decision + self.auto_apply_decisions_enabled = auto_apply_decisions_enabled + self.recommendations_enabled = recommendations_enabled + self.instance_duration_in_days = instance_duration_in_days + self.recurrence = recurrence + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorDefinition(Model): + """Error. + + Error description and code explaining why an operation failed. + + :param error: Error of the list gateway status. + :type error: + ~azure.mgmt.authorization.v2018_05_01_preview.models.ErrorDefinitionProperties + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinitionProperties'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorDefinition, self).__init__(**kwargs) + self.error = error + + +class ErrorDefinitionException(HttpOperationError): + """Server responsed with exception of type: 'ErrorDefinition'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorDefinitionException, self).__init__(deserialize, response, 'ErrorDefinition', *args) + + +class ErrorDefinitionProperties(Model): + """Error. + + Error description and code explaining why an operation failed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar message: Description of the error. + :vartype message: str + :param code: Error code of list gateway. + :type code: str + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, **kwargs) -> None: + super(ErrorDefinitionProperties, self).__init__(**kwargs) + self.message = None + self.code = code + + +class Operation(Model): + """The definition of a Microsoft.Authorization operation. + + :param name: Name of the operation + :type name: str + :param is_data_action: Indicates whether the operation is a data action + :type is_data_action: bool + :param display: Display of the operation + :type display: + ~azure.mgmt.authorization.v2018_05_01_preview.models.OperationDisplay + :param origin: Origin of the operation + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, is_data_action: bool=None, display=None, origin: str=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin + + +class OperationDisplay(Model): + """The display information for a Microsoft.Authorization operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: The resource provider name: Microsoft.Authorization. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class ServicePrincipalDecisionTarget(AccessReviewDecisionTarget): + """Service Principal Decision Target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. + :type type: str + :ivar principal_id: The id of service principal whose access is reviewed. + :vartype principal_id: str + :ivar principal_name: The display name of the service principal whose + access was reviewed. + :vartype principal_name: str + :ivar app_id: The appId for the service principal entity being reviewed + :vartype app_id: str + """ + + _validation = { + 'type': {'required': True}, + 'principal_id': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'app_id': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'principal_name': {'key': 'principalName', 'type': 'str'}, + 'app_id': {'key': 'appId', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ServicePrincipalDecisionTarget, self).__init__(**kwargs) + self.principal_id = None + self.principal_name = None + self.app_id = None + self.type = 'servicePrincipal' + + +class UserDecisionTarget(AccessReviewDecisionTarget): + """User Decision Target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Constant filled by server. + :type type: str + :ivar principal_id: The id of user whose access was reviewed. + :vartype principal_id: str + :ivar principal_name: The display name of the user whose access was + reviewed. + :vartype principal_name: str + :ivar user_principal_name: The user principal name of the user whose + access was reviewed. + :vartype user_principal_name: str + """ + + _validation = { + 'type': {'required': True}, + 'principal_id': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'principal_name': {'key': 'principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'userPrincipalName', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(UserDecisionTarget, self).__init__(**kwargs) + self.principal_id = None + self.principal_name = None + self.user_principal_name = None + self.type = 'user' diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_paged_models.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_paged_models.py new file mode 100644 index 0000000000000..3def9e2f03678 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/models/_paged_models.py @@ -0,0 +1,66 @@ +# 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 OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class AccessReviewScheduleDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`AccessReviewScheduleDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[AccessReviewScheduleDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(AccessReviewScheduleDefinitionPaged, self).__init__(*args, **kwargs) +class AccessReviewInstancePaged(Paged): + """ + A paging container for iterating over a list of :class:`AccessReviewInstance ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[AccessReviewInstance]'} + } + + def __init__(self, *args, **kwargs): + + super(AccessReviewInstancePaged, self).__init__(*args, **kwargs) +class AccessReviewDecisionPaged(Paged): + """ + A paging container for iterating over a list of :class:`AccessReviewDecision ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[AccessReviewDecision]'} + } + + def __init__(self, *args, **kwargs): + + super(AccessReviewDecisionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/__init__.py new file mode 100644 index 0000000000000..cba7f42add555 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations +from ._access_review_instances_operations import AccessReviewInstancesOperations +from ._access_review_instance_operations import AccessReviewInstanceOperations +from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations +from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations +from ._access_review_schedule_definitions_assigned_for_my_approval_operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations +from ._access_review_instances_assigned_for_my_approval_operations import AccessReviewInstancesAssignedForMyApprovalOperations +from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations + +__all__ = [ + 'Operations', + 'AccessReviewScheduleDefinitionsOperations', + 'AccessReviewInstancesOperations', + 'AccessReviewInstanceOperations', + 'AccessReviewInstanceDecisionsOperations', + 'AccessReviewDefaultSettingsOperations', + 'AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations', + 'AccessReviewInstancesAssignedForMyApprovalOperations', + 'AccessReviewInstanceMyDecisionsOperations', +] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_default_settings_operations.py new file mode 100644 index 0000000000000..c86d01586b5ce --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_default_settings_operations.py @@ -0,0 +1,156 @@ +# 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 .. import models + + +class AccessReviewDefaultSettingsOperations(object): + """AccessReviewDefaultSettingsOperations 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 be used with the HTTP request. Constant value: "2018-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-01-preview" + + self.config = config + + def get( + self, custom_headers=None, raw=False, **operation_config): + """Get access review default settings for the subscription. + + :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: AccessReviewDefaultSettings or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDefaultSettings + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get.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 = {} + 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewDefaultSettings', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default'} + + def put( + self, properties, custom_headers=None, raw=False, **operation_config): + """Get access review default settings for the subscription. + + :param properties: Access review schedule settings. + :type properties: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleSettings + :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: AccessReviewDefaultSettings or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDefaultSettings + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.put.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 = {} + 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(properties, 'AccessReviewScheduleSettings') + + # 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 [200]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewDefaultSettings', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_decisions_operations.py new file mode 100644 index 0000000000000..f851a3bba40d1 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_decisions_operations.py @@ -0,0 +1,111 @@ +# 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 .. import models + + +class AccessReviewInstanceDecisionsOperations(object): + """AccessReviewInstanceDecisionsOperations 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 be used with the HTTP request. Constant value: "2018-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-01-preview" + + self.config = config + + def list( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """Get access review instance decisions. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: An iterator like instance of AccessReviewDecision + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecisionPaged[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecision] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AccessReviewDecisionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_my_decisions_operations.py new file mode 100644 index 0000000000000..8efbc740b4a46 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_my_decisions_operations.py @@ -0,0 +1,253 @@ +# 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 .. import models + + +class AccessReviewInstanceMyDecisionsOperations(object): + """AccessReviewInstanceMyDecisionsOperations 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 be used with the HTTP request. Constant value: "2018-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-01-preview" + + self.config = config + + def list( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """Get my access review instance decisions. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: An iterator like instance of AccessReviewDecision + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecisionPaged[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecision] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AccessReviewDecisionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions'} + + def get_by_id( + self, schedule_definition_id, id, decision_id, custom_headers=None, raw=False, **operation_config): + """Get my single access review instance decision. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type id: str + :param decision_id: The id of the decision record. + :type decision_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: AccessReviewDecision or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecision + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'decisionId': self._serialize.url("decision_id", decision_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewDecision', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}'} + + def patch( + self, schedule_definition_id, id, decision_id, decision=None, justification=None, custom_headers=None, raw=False, **operation_config): + """Record a decision. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type id: str + :param decision_id: The id of the decision record. + :type decision_id: str + :param decision: The decision on the approval step. This value is + initially set to NotReviewed. Approvers can take action of + Approve/Deny. Possible values include: 'Approve', 'Deny', + 'NotReviewed', 'DontKnow', 'NotNotified' + :type decision: str or + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewResult + :param justification: Justification provided by approvers for their + action + :type justification: 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: AccessReviewDecision or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewDecision + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + properties = models.AccessReviewDecisionProperties(decision=decision, justification=justification) + + # Construct URL + url = self.patch.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'decisionId': self._serialize.url("decision_id", decision_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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(properties, 'AccessReviewDecisionProperties') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewDecision', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + patch.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_operations.py new file mode 100644 index 0000000000000..dbc28ccb44307 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instance_operations.py @@ -0,0 +1,304 @@ +# 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 .. import models + + +class AccessReviewInstanceOperations(object): + """AccessReviewInstanceOperations 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 be used with the HTTP request. Constant value: "2018-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-01-preview" + + self.config = config + + def stop( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """An action to stop an access review instance. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.stop.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + stop.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop'} + + def reset_decisions( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """An action to reset all decisions for an access review instance. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.reset_decisions.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + reset_decisions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions'} + + def apply_decisions( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """An action to apply all decisions for an access review instance. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.apply_decisions.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + apply_decisions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions'} + + def send_reminders( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """An action to send reminders for an access review instance. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.send_reminders.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + send_reminders.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders'} + + def accept_recommendations( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """An action to accept recommendations for decision in an access review + instance. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.accept_recommendations.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + accept_recommendations.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py new file mode 100644 index 0000000000000..8d9ab8526f463 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class AccessReviewInstancesAssignedForMyApprovalOperations(object): + """AccessReviewInstancesAssignedForMyApprovalOperations 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 be used with the HTTP request. Constant value: "2018-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-01-preview" + + self.config = config + + def list( + self, schedule_definition_id, custom_headers=None, raw=False, **operation_config): + """Get access review instances assigned for my approval. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_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: An iterator like instance of AccessReviewInstance + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstancePaged[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstance] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AccessReviewInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances'} + + def get_by_id( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """Get single access review instance assigned for my approval. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: AccessReviewInstance or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstance + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewInstance', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_operations.py new file mode 100644 index 0000000000000..059e1d3289cc4 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_instances_operations.py @@ -0,0 +1,170 @@ +# 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 .. import models + + +class AccessReviewInstancesOperations(object): + """AccessReviewInstancesOperations 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 be used with the HTTP request. Constant value: "2018-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-01-preview" + + self.config = config + + def list( + self, schedule_definition_id, custom_headers=None, raw=False, **operation_config): + """Get access review instances. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_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: An iterator like instance of AccessReviewInstance + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstancePaged[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstance] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AccessReviewInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances'} + + def get_by_id( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """Get access review instances. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: AccessReviewInstance or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewInstance + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewInstance', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py new file mode 100644 index 0000000000000..7aa0afdaf94ac --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py @@ -0,0 +1,100 @@ +# 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 .. import models + + +class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations(object): + """AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations 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 be used with the HTTP request. Constant value: "2018-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get access review instances assigned for my approval. + + :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 AccessReviewScheduleDefinition + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionPaged[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinition] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AccessReviewScheduleDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_operations.py new file mode 100644 index 0000000000000..ccfad23cb52c9 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_access_review_schedule_definitions_operations.py @@ -0,0 +1,331 @@ +# 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 .. import models + + +class AccessReviewScheduleDefinitionsOperations(object): + """AccessReviewScheduleDefinitionsOperations 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 be used with the HTTP request. Constant value: "2018-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get access review schedule definitions. + + :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 AccessReviewScheduleDefinition + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionPaged[~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinition] + :raises: + :class:`ErrorDefinitionException` + """ + 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 = {} + 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AccessReviewScheduleDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions'} + + def get_by_id( + self, schedule_definition_id, custom_headers=None, raw=False, **operation_config): + """Get single access review definition. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_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: AccessReviewScheduleDefinition or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinition + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewScheduleDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}'} + + def delete_by_id( + self, schedule_definition_id, custom_headers=None, raw=False, **operation_config): + """Delete access review schedule definition. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.delete_by_id.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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, 204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}'} + + def create_or_update_by_id( + self, schedule_definition_id, properties, custom_headers=None, raw=False, **operation_config): + """Create or Update access review schedule definition. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param properties: Access review schedule definition properties. + :type properties: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinitionProperties + :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: AccessReviewScheduleDefinition or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.AccessReviewScheduleDefinition + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.create_or_update_by_id.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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(properties, 'AccessReviewScheduleDefinitionProperties') + + # 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 [200]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewScheduleDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}'} + + def stop( + self, schedule_definition_id, custom_headers=None, raw=False, **operation_config): + """Stop access review definition. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.stop.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + stop.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_operations.py new file mode 100644 index 0000000000000..3b6b4072fac71 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/operations/_operations.py @@ -0,0 +1,100 @@ +# 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 .. import models + + +class Operations(object): + """Operations 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 be used with the HTTP request. Constant value: "2018-05-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-05-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists the operations available from this provider. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.authorization.v2018_05_01_preview.models.OperationPaged[~azure.mgmt.authorization.v2018_05_01_preview.models.Operation] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/operations'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/version.py new file mode 100644 index 0000000000000..7921c843fb544 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2018-05-01-preview" + diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/__init__.py index 66060cabcd57d..51454184dbfef 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/__init__.py @@ -13,11 +13,17 @@ from ._models_py3 import DenyAssignment from ._models_py3 import DenyAssignmentFilter from ._models_py3 import DenyAssignmentPermission + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import Principal except (SyntaxError, ImportError): from ._models import DenyAssignment from ._models import DenyAssignmentFilter from ._models import DenyAssignmentPermission + from ._models import ErrorAdditionalInfo + from ._models import ErrorDetail + from ._models import ErrorResponse, ErrorResponseException from ._models import Principal from ._paged_models import DenyAssignmentPaged @@ -25,6 +31,9 @@ 'DenyAssignment', 'DenyAssignmentFilter', 'DenyAssignmentPermission', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', 'ErrorResponseException', 'Principal', 'DenyAssignmentPaged', ] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models.py index 3f34d4eccca24..5870b0cc4b181 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class CloudError(Model): @@ -152,6 +153,112 @@ def __init__(self, **kwargs): self.not_data_actions = kwargs.get('not_data_actions', None) +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.authorization.v2018_07_01_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.authorization.v2018_07_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: + ~azure.mgmt.authorization.v2018_07_01_preview.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Principal(Model): """Deny assignment principal. diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models_py3.py index ea24aa033cbd3..0033e1e11a542 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/models/_models_py3.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class CloudError(Model): @@ -152,6 +153,112 @@ def __init__(self, *, actions=None, not_actions=None, data_actions=None, not_dat self.not_data_actions = not_data_actions +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.authorization.v2018_07_01_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.authorization.v2018_07_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: + ~azure.mgmt.authorization.v2018_07_01_preview.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Principal(Model): """Deny assignment principal. diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py index baf2c93202adc..c076c57a9c05b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -43,7 +42,8 @@ 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 deny assignments for a resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name + is case insensitive. :type resource_group_name: str :param resource_provider_namespace: The namespace of the resource provider. @@ -78,15 +78,16 @@ def list_for_resource( :return: An iterator like instance of DenyAssignment :rtype: ~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignmentPaged[~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list_for_resource.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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), @@ -96,7 +97,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') @@ -124,9 +125,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -143,7 +142,8 @@ def list_for_resource_group( self, resource_group_name, filter=None, custom_headers=None, raw=False, **operation_config): """Gets deny assignments for a resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name + is case insensitive. :type resource_group_name: str :param filter: The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the @@ -168,21 +168,22 @@ def list_for_resource_group( :return: An iterator like instance of DenyAssignment :rtype: ~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignmentPaged[~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list_for_resource_group.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') } 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') @@ -210,9 +211,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -252,20 +251,21 @@ def list( :return: An iterator like instance of DenyAssignment :rtype: ~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignmentPaged[~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') @@ -293,9 +293,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -325,7 +323,8 @@ def get( :rtype: ~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get.metadata['url'] @@ -337,7 +336,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -354,9 +353,7 @@ def get( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -389,7 +386,8 @@ def get_by_id( :rtype: ~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get_by_id.metadata['url'] @@ -400,7 +398,7 @@ def get_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -417,9 +415,7 @@ def get_by_id( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -461,7 +457,8 @@ def list_for_scope( :return: An iterator like instance of DenyAssignment :rtype: ~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignmentPaged[~azure.mgmt.authorization.v2018_07_01_preview.models.DenyAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -474,7 +471,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') @@ -502,9 +499,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/__init__.py index 7fa9d33fff9dc..b9da08d124b53 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/__init__.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/__init__.py @@ -10,10 +10,16 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import RoleAssignment from ._models_py3 import RoleAssignmentCreateParameters from ._models_py3 import RoleAssignmentFilter except (SyntaxError, ImportError): + from ._models import ErrorAdditionalInfo + from ._models import ErrorDetail + from ._models import ErrorResponse, ErrorResponseException from ._models import RoleAssignment from ._models import RoleAssignmentCreateParameters from ._models import RoleAssignmentFilter @@ -23,6 +29,9 @@ ) __all__ = [ + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', 'ErrorResponseException', 'RoleAssignment', 'RoleAssignmentCreateParameters', 'RoleAssignmentFilter', diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models.py index 18d880b6cc493..a298d0f9f60c4 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class CloudError(Model): @@ -20,6 +21,112 @@ class CloudError(Model): } +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.authorization.v2018_09_01_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.authorization.v2018_09_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: + ~azure.mgmt.authorization.v2018_09_01_preview.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class RoleAssignment(Model): """Role Assignments. diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models_py3.py index a0bb24a96def4..bd76702bd2082 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/models/_models_py3.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class CloudError(Model): @@ -20,6 +21,112 @@ class CloudError(Model): } +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.authorization.v2018_09_01_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.authorization.v2018_09_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: + ~azure.mgmt.authorization.v2018_09_01_preview.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class RoleAssignment(Model): """Role Assignments. diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/_role_assignments_operations.py index 6fbe84aa3234b..3386785da2978 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/operations/_role_assignments_operations.py @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -43,7 +42,8 @@ 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. + :param resource_group_name: The name of the resource group. The name + is case insensitive. :type resource_group_name: str :param resource_provider_namespace: The namespace of the resource provider. @@ -68,19 +68,20 @@ def list_for_resource( :return: An iterator like instance of RoleAssignment :rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } url = self._client.format_url(url, **path_format_arguments) @@ -88,7 +89,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -114,9 +115,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -133,7 +132,8 @@ 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. + :param resource_group_name: The name of the resource group. The name + is case insensitive. :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 @@ -148,15 +148,16 @@ def list_for_resource_group( :return: An iterator like instance of RoleAssignment :rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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') + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } url = self._client.format_url(url, **path_format_arguments) @@ -164,7 +165,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -190,9 +191,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -223,7 +222,8 @@ def delete( :rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.delete.metadata['url'] @@ -235,7 +235,7 @@ def delete( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -251,10 +251,8 @@ def delete( 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 + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -294,7 +292,8 @@ def create( :rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.create.metadata['url'] @@ -306,7 +305,7 @@ def create( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -327,9 +326,7 @@ def create( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 201: @@ -359,7 +356,8 @@ def get( :rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get.metadata['url'] @@ -371,7 +369,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -388,9 +386,7 @@ def get( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -418,7 +414,8 @@ def delete_by_id( :rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.delete_by_id.metadata['url'] @@ -429,7 +426,7 @@ def delete_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -445,10 +442,8 @@ def delete_by_id( 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 + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -479,7 +474,8 @@ def create_by_id( :rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.create_by_id.metadata['url'] @@ -490,7 +486,7 @@ def create_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -511,9 +507,7 @@ def create_by_id( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 201: @@ -541,7 +535,8 @@ def get_by_id( :rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get_by_id.metadata['url'] @@ -552,7 +547,7 @@ def get_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -569,9 +564,7 @@ def get_by_id( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -601,14 +594,15 @@ def list( :return: An iterator like instance of RoleAssignment :rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ 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') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } url = self._client.format_url(url, **path_format_arguments) @@ -616,7 +610,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -642,9 +636,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -676,7 +668,8 @@ def list_for_scope( :return: An iterator like instance of RoleAssignment :rtype: ~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignmentPaged[~azure.mgmt.authorization.v2018_09_01_preview.models.RoleAssignment] - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -691,7 +684,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -717,9 +710,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response 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 index 7fa9d33fff9dc..b9da08d124b53 100644 --- 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 @@ -10,10 +10,16 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import RoleAssignment from ._models_py3 import RoleAssignmentCreateParameters from ._models_py3 import RoleAssignmentFilter except (SyntaxError, ImportError): + from ._models import ErrorAdditionalInfo + from ._models import ErrorDetail + from ._models import ErrorResponse, ErrorResponseException from ._models import RoleAssignment from ._models import RoleAssignmentCreateParameters from ._models import RoleAssignmentFilter @@ -23,6 +29,9 @@ ) __all__ = [ + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', 'ErrorResponseException', 'RoleAssignment', 'RoleAssignmentCreateParameters', 'RoleAssignmentFilter', 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 index ca78bb76ffd1a..bcc3b99db5561 100644 --- 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 @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class CloudError(Model): @@ -20,6 +21,112 @@ class CloudError(Model): } +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.authorization.v2020_04_01_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.authorization.v2020_04_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: + ~azure.mgmt.authorization.v2020_04_01_preview.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class RoleAssignment(Model): """Role Assignments. @@ -54,8 +161,19 @@ class RoleAssignment(Model): StringEqualsIgnoreCase 'foo_storage_container' :type condition: str :param condition_version: Version of the condition. Currently accepted - values are '1.0' or '2.0' + value is '2.0' :type condition_version: str + :param created_on: Time it was created + :type created_on: datetime + :param updated_on: Time it was updated + :type updated_on: datetime + :param created_by: Id of the user who created the assignment + :type created_by: str + :param updated_by: Id of the user who updated the assignment + :type updated_by: str + :param delegated_managed_identity_resource_id: Id of the delegated managed + identity resource + :type delegated_managed_identity_resource_id: str """ _validation = { @@ -76,6 +194,11 @@ class RoleAssignment(Model): 'description': {'key': 'properties.description', 'type': 'str'}, 'condition': {'key': 'properties.condition', 'type': 'str'}, 'condition_version': {'key': 'properties.conditionVersion', 'type': 'str'}, + 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, + 'updated_on': {'key': 'properties.updatedOn', 'type': 'iso-8601'}, + 'created_by': {'key': 'properties.createdBy', 'type': 'str'}, + 'updated_by': {'key': 'properties.updatedBy', 'type': 'str'}, + 'delegated_managed_identity_resource_id': {'key': 'properties.delegatedManagedIdentityResourceId', 'type': 'str'}, } def __init__(self, **kwargs): @@ -91,6 +214,11 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) self.condition = kwargs.get('condition', None) self.condition_version = kwargs.get('condition_version', None) + self.created_on = kwargs.get('created_on', None) + self.updated_on = kwargs.get('updated_on', None) + self.created_by = kwargs.get('created_by', None) + self.updated_by = kwargs.get('updated_by', None) + self.delegated_managed_identity_resource_id = kwargs.get('delegated_managed_identity_resource_id', None) class RoleAssignmentCreateParameters(Model): @@ -108,7 +236,7 @@ class RoleAssignmentCreateParameters(Model): :param principal_type: The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', - 'DirectoryObjectOrGroup', 'Everyone' + 'DirectoryObjectOrGroup', 'Everyone'. Default value: "User" . :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 @@ -116,10 +244,17 @@ class RoleAssignmentCreateParameters(Model): :type can_delegate: bool :param description: Description of role assignment :type description: str - :param condition: The conditions on the role assignment + :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 + :param condition_version: Version of the condition. Currently accepted + value is '2.0' :type condition_version: str + :param delegated_managed_identity_resource_id: Id of the delegated managed + identity resource + :type delegated_managed_identity_resource_id: str """ _validation = { @@ -135,17 +270,19 @@ class RoleAssignmentCreateParameters(Model): 'description': {'key': 'properties.description', 'type': 'str'}, 'condition': {'key': 'properties.condition', 'type': 'str'}, 'condition_version': {'key': 'properties.conditionVersion', 'type': 'str'}, + 'delegated_managed_identity_resource_id': {'key': 'properties.delegatedManagedIdentityResourceId', '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.principal_type = kwargs.get('principal_type', "User") 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) + self.delegated_managed_identity_resource_id = kwargs.get('delegated_managed_identity_resource_id', None) class RoleAssignmentFilter(Model): 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 index 2d4acd255fca7..7e08c40d33d69 100644 --- 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 @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class CloudError(Model): @@ -20,6 +21,112 @@ class CloudError(Model): } +class ErrorAdditionalInfo(Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: + list[~azure.mgmt.authorization.v2020_04_01_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.authorization.v2020_04_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(Model): + """Error response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). + + :param error: The error object. + :type error: + ~azure.mgmt.authorization.v2020_04_01_preview.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class RoleAssignment(Model): """Role Assignments. @@ -54,8 +161,19 @@ class RoleAssignment(Model): StringEqualsIgnoreCase 'foo_storage_container' :type condition: str :param condition_version: Version of the condition. Currently accepted - values are '1.0' or '2.0' + value is '2.0' :type condition_version: str + :param created_on: Time it was created + :type created_on: datetime + :param updated_on: Time it was updated + :type updated_on: datetime + :param created_by: Id of the user who created the assignment + :type created_by: str + :param updated_by: Id of the user who updated the assignment + :type updated_by: str + :param delegated_managed_identity_resource_id: Id of the delegated managed + identity resource + :type delegated_managed_identity_resource_id: str """ _validation = { @@ -76,9 +194,14 @@ class RoleAssignment(Model): 'description': {'key': 'properties.description', 'type': 'str'}, 'condition': {'key': 'properties.condition', 'type': 'str'}, 'condition_version': {'key': 'properties.conditionVersion', 'type': 'str'}, + 'created_on': {'key': 'properties.createdOn', 'type': 'iso-8601'}, + 'updated_on': {'key': 'properties.updatedOn', 'type': 'iso-8601'}, + 'created_by': {'key': 'properties.createdBy', 'type': 'str'}, + 'updated_by': {'key': 'properties.updatedBy', 'type': 'str'}, + 'delegated_managed_identity_resource_id': {'key': 'properties.delegatedManagedIdentityResourceId', '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: + 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, created_on=None, updated_on=None, created_by: str=None, updated_by: str=None, delegated_managed_identity_resource_id: str=None, **kwargs) -> None: super(RoleAssignment, self).__init__(**kwargs) self.id = None self.name = None @@ -91,6 +214,11 @@ def __init__(self, *, scope: str=None, role_definition_id: str=None, principal_i self.description = description self.condition = condition self.condition_version = condition_version + self.created_on = created_on + self.updated_on = updated_on + self.created_by = created_by + self.updated_by = updated_by + self.delegated_managed_identity_resource_id = delegated_managed_identity_resource_id class RoleAssignmentCreateParameters(Model): @@ -108,7 +236,7 @@ class RoleAssignmentCreateParameters(Model): :param principal_type: The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', - 'DirectoryObjectOrGroup', 'Everyone' + 'DirectoryObjectOrGroup', 'Everyone'. Default value: "User" . :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 @@ -116,10 +244,17 @@ class RoleAssignmentCreateParameters(Model): :type can_delegate: bool :param description: Description of role assignment :type description: str - :param condition: The conditions on the role assignment + :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 + :param condition_version: Version of the condition. Currently accepted + value is '2.0' :type condition_version: str + :param delegated_managed_identity_resource_id: Id of the delegated managed + identity resource + :type delegated_managed_identity_resource_id: str """ _validation = { @@ -135,9 +270,10 @@ class RoleAssignmentCreateParameters(Model): 'description': {'key': 'properties.description', 'type': 'str'}, 'condition': {'key': 'properties.condition', 'type': 'str'}, 'condition_version': {'key': 'properties.conditionVersion', 'type': 'str'}, + 'delegated_managed_identity_resource_id': {'key': 'properties.delegatedManagedIdentityResourceId', '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: + def __init__(self, *, role_definition_id: str, principal_id: str, principal_type="User", can_delegate: bool=None, description: str=None, condition: str=None, condition_version: str=None, delegated_managed_identity_resource_id: str=None, **kwargs) -> None: super(RoleAssignmentCreateParameters, self).__init__(**kwargs) self.role_definition_id = role_definition_id self.principal_id = principal_id @@ -146,6 +282,7 @@ def __init__(self, *, role_definition_id: str, principal_id: str, principal_type self.description = description self.condition = condition self.condition_version = condition_version + self.delegated_managed_identity_resource_id = delegated_managed_identity_resource_id class RoleAssignmentFilter(Model): 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 index 2fe33743dac89..a544c04c1094d 100644 --- 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 @@ -11,7 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError from .. import models @@ -41,9 +40,10 @@ def __init__(self, client, config, serializer, deserializer): 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. + """List role assignments for a resource. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name + is case insensitive. :type resource_group_name: str :param resource_provider_namespace: The namespace of the resource provider. @@ -68,19 +68,20 @@ def list_for_resource( :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` + :raises: + :class:`ErrorResponseException` """ 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } url = self._client.format_url(url, **path_format_arguments) @@ -88,7 +89,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -114,9 +115,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -131,9 +130,10 @@ def internal_paging(next_link=None): 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. + """List role assignments for a resource group. - :param resource_group_name: The name of the resource group. + :param resource_group_name: The name of the resource group. The name + is case insensitive. :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 @@ -148,15 +148,16 @@ def list_for_resource_group( :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` + :raises: + :class:`ErrorResponseException` """ 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') + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } url = self._client.format_url(url, **path_format_arguments) @@ -164,7 +165,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -190,9 +191,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -207,7 +206,7 @@ def internal_paging(next_link=None): def delete( self, scope, role_assignment_name, custom_headers=None, raw=False, **operation_config): - """Deletes a role assignment. + """Delete a role assignment. :param scope: The scope of the role assignment to delete. :type scope: str @@ -223,7 +222,8 @@ def delete( :rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.delete.metadata['url'] @@ -235,7 +235,7 @@ def delete( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -251,10 +251,8 @@ def delete( 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 + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -269,7 +267,7 @@ def delete( def create( self, scope, role_assignment_name, parameters, custom_headers=None, raw=False, **operation_config): - """Creates a role assignment. + """Create a role assignment. :param scope: The scope of the role assignment to create. The scope can be any REST resource instance. For example, use @@ -294,7 +292,8 @@ def create( :rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.create.metadata['url'] @@ -306,7 +305,7 @@ def create( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -327,9 +326,7 @@ def create( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 201: @@ -359,7 +356,8 @@ def get( :rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get.metadata['url'] @@ -371,7 +369,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -388,9 +386,7 @@ def get( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -405,7 +401,7 @@ def get( def delete_by_id( self, role_id, custom_headers=None, raw=False, **operation_config): - """Deletes a role assignment. + """Delete a role assignment. :param role_id: The ID of the role assignment to delete. :type role_id: str @@ -418,7 +414,8 @@ def delete_by_id( :rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.delete_by_id.metadata['url'] @@ -429,7 +426,7 @@ def delete_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -445,10 +442,8 @@ def delete_by_id( 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 + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -479,7 +474,8 @@ def create_by_id( :rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.create_by_id.metadata['url'] @@ -490,7 +486,7 @@ def create_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -511,9 +507,7 @@ def create_by_id( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 201: @@ -541,7 +535,8 @@ def get_by_id( :rtype: ~azure.mgmt.authorization.v2020_04_01_preview.models.RoleAssignment or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get_by_id.metadata['url'] @@ -552,7 +547,7 @@ def get_by_id( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) # Construct headers header_parameters = {} @@ -569,9 +564,7 @@ def get_by_id( 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 + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: @@ -601,14 +594,15 @@ def list( :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` + :raises: + :class:`ErrorResponseException` """ 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') + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) } url = self._client.format_url(url, **path_format_arguments) @@ -616,7 +610,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -642,9 +636,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response @@ -676,7 +668,8 @@ def list_for_scope( :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` + :raises: + :class:`ErrorResponseException` """ def prepare_request(next_link=None): if not next_link: @@ -691,7 +684,7 @@ def prepare_request(next_link=None): 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') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) else: url = next_link @@ -717,9 +710,7 @@ def internal_paging(next_link=None): 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 + raise models.ErrorResponseException(self._deserialize, response) return response diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/__init__.py new file mode 100644 index 0000000000000..e8714b719dfc2 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_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/v2021_01_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_authorization_management_client.py new file mode 100644 index 0000000000000..f3c588762ac3a --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_authorization_management_client.py @@ -0,0 +1,79 @@ +# 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 Operations +from .operations import RoleAssignmentApprovalOperations +from .operations import RoleAssignmentApprovalStepsOperations +from .operations import RoleAssignmentApprovalStepOperations +from .operations import ScopeRoleAssignmentApprovalOperations +from .operations import ScopeRoleAssignmentApprovalStepsOperations +from .operations import ScopeRoleAssignmentApprovalStepOperations +from . import models + + +class AuthorizationManagementClient(SDKClient): + """Request Approvals service provides the workflow for running request approvals on different kind of resources. + + :ivar config: Configuration for client. + :vartype config: AuthorizationManagementClientConfiguration + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.authorization.v2021_01_01_preview.operations.Operations + :ivar role_assignment_approval: RoleAssignmentApproval operations + :vartype role_assignment_approval: azure.mgmt.authorization.v2021_01_01_preview.operations.RoleAssignmentApprovalOperations + :ivar role_assignment_approval_steps: RoleAssignmentApprovalSteps operations + :vartype role_assignment_approval_steps: azure.mgmt.authorization.v2021_01_01_preview.operations.RoleAssignmentApprovalStepsOperations + :ivar role_assignment_approval_step: RoleAssignmentApprovalStep operations + :vartype role_assignment_approval_step: azure.mgmt.authorization.v2021_01_01_preview.operations.RoleAssignmentApprovalStepOperations + :ivar scope_role_assignment_approval: ScopeRoleAssignmentApproval operations + :vartype scope_role_assignment_approval: azure.mgmt.authorization.v2021_01_01_preview.operations.ScopeRoleAssignmentApprovalOperations + :ivar scope_role_assignment_approval_steps: ScopeRoleAssignmentApprovalSteps operations + :vartype scope_role_assignment_approval_steps: azure.mgmt.authorization.v2021_01_01_preview.operations.ScopeRoleAssignmentApprovalStepsOperations + :ivar scope_role_assignment_approval_step: ScopeRoleAssignmentApprovalStep operations + :vartype scope_role_assignment_approval_step: azure.mgmt.authorization.v2021_01_01_preview.operations.ScopeRoleAssignmentApprovalStepOperations + + :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 = '2021-01-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.role_assignment_approval = RoleAssignmentApprovalOperations( + self._client, self.config, self._serialize, self._deserialize) + self.role_assignment_approval_steps = RoleAssignmentApprovalStepsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.role_assignment_approval_step = RoleAssignmentApprovalStepOperations( + self._client, self.config, self._serialize, self._deserialize) + self.scope_role_assignment_approval = ScopeRoleAssignmentApprovalOperations( + self._client, self.config, self._serialize, self._deserialize) + self.scope_role_assignment_approval_steps = ScopeRoleAssignmentApprovalStepsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.scope_role_assignment_approval_step = ScopeRoleAssignmentApprovalStepOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_configuration.py new file mode 100644 index 0000000000000..c192b8088f15e --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_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/v2021_01_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/__init__.py new file mode 100644 index 0000000000000..d773ca1dce272 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/__init__.py @@ -0,0 +1,52 @@ +# 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 ErrorDefinition, ErrorDefinitionException + from ._models_py3 import ErrorDefinitionProperties + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import RoleAssignmentApproval + from ._models_py3 import RoleAssignmentApprovalStep + from ._models_py3 import RoleAssignmentApprovalStepListResult + from ._models_py3 import RoleAssignmentApprovalStepProperties +except (SyntaxError, ImportError): + from ._models import ErrorDefinition, ErrorDefinitionException + from ._models import ErrorDefinitionProperties + from ._models import Operation + from ._models import OperationDisplay + from ._models import RoleAssignmentApproval + from ._models import RoleAssignmentApprovalStep + from ._models import RoleAssignmentApprovalStepListResult + from ._models import RoleAssignmentApprovalStepProperties +from ._paged_models import OperationPaged +from ._paged_models import RoleAssignmentApprovalPaged +from ._authorization_management_client_enums import ( + RoleAssignmentApprovalActorIdentityType, + RoleAssignmentApprovalStepStatus, + RoleAssignmentApprovalStepReviewResult, +) + +__all__ = [ + 'ErrorDefinition', 'ErrorDefinitionException', + 'ErrorDefinitionProperties', + 'Operation', + 'OperationDisplay', + 'RoleAssignmentApproval', + 'RoleAssignmentApprovalStep', + 'RoleAssignmentApprovalStepListResult', + 'RoleAssignmentApprovalStepProperties', + 'OperationPaged', + 'RoleAssignmentApprovalPaged', + 'RoleAssignmentApprovalActorIdentityType', + 'RoleAssignmentApprovalStepStatus', + 'RoleAssignmentApprovalStepReviewResult', +] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_authorization_management_client_enums.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_authorization_management_client_enums.py new file mode 100644 index 0000000000000..05fee236c4d49 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_authorization_management_client_enums.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class RoleAssignmentApprovalActorIdentityType(str, Enum): + + user = "user" + service_principal = "servicePrincipal" + + +class RoleAssignmentApprovalStepStatus(str, Enum): + + not_started = "NotStarted" + in_progress = "InProgress" + completed = "Completed" + expired = "Expired" + initializing = "Initializing" + escalating = "Escalating" + completing = "Completing" + escalated = "Escalated" + + +class RoleAssignmentApprovalStepReviewResult(str, Enum): + + approve = "Approve" + deny = "Deny" + not_reviewed = "NotReviewed" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models.py new file mode 100644 index 0000000000000..611284ae6725a --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models.py @@ -0,0 +1,379 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorDefinition(Model): + """Error. + + Error description and code explaining why an operation failed. + + :param error: Error of the list gateway status. + :type error: + ~azure.mgmt.authorization.v2021_01_01_preview.models.ErrorDefinitionProperties + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinitionProperties'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinition, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorDefinitionException(HttpOperationError): + """Server responsed with exception of type: 'ErrorDefinition'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorDefinitionException, self).__init__(deserialize, response, 'ErrorDefinition', *args) + + +class ErrorDefinitionProperties(Model): + """Error. + + Error description and code explaining why an operation failed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar message: Description of the error. + :vartype message: str + :param code: Error code of list gateway. + :type code: str + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinitionProperties, self).__init__(**kwargs) + self.message = None + self.code = kwargs.get('code', None) + + +class Operation(Model): + """The definition of a Microsoft.Authorization operation. + + :param name: Name of the operation + :type name: str + :param is_data_action: Indicates whether the operation is a data action + :type is_data_action: bool + :param display: Display of the operation + :type display: + ~azure.mgmt.authorization.v2021_01_01_preview.models.OperationDisplay + :param origin: Origin of the operation. Values include + user|system|user,system + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + + +class OperationDisplay(Model): + """The display information for a Microsoft.Authorization operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: The resource provider name: Microsoft.Authorization. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class RoleAssignmentApproval(Model): + """Role Assignment Approval. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The role assignment approval id. + :vartype id: str + :ivar name: The role assignment approval unique id. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param stages: This is the collection of stages returned when one does an + expand on it. + :type stages: + list[~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep] + """ + + _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'}, + 'stages': {'key': 'properties.stages', 'type': '[RoleAssignmentApprovalStep]'}, + } + + def __init__(self, **kwargs): + super(RoleAssignmentApproval, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.stages = kwargs.get('stages', None) + + +class RoleAssignmentApprovalStep(Model): + """Role assignment approval stage properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The role assignment approval stage id. + :vartype id: str + :ivar name: The role assignment approval stage name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param display_name: The display name for the approval stage. + :type display_name: str + :ivar status: This read-only field specifies the status of an approval. + Possible values include: 'NotStarted', 'InProgress', 'Completed', + 'Expired', 'Initializing', 'Escalating', 'Completing', 'Escalated' + :vartype status: str or + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepStatus + :ivar assigned_to_me: Indicates whether the stage is assigned to me for + review + :vartype assigned_to_me: bool + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :ivar reviewed_date_time: Date Time when a decision was taken. + :vartype reviewed_date_time: datetime + :param review_result: The decision on the approval stage. This value is + initially set to NotReviewed. Approvers can take action of Approve/Deny. + Possible values include: 'Approve', 'Deny', 'NotReviewed' + :type review_result: str or + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepReviewResult + :param justification: Justification provided by approvers for their action + :type justification: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'assigned_to_me': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'reviewed_date_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'assigned_to_me': {'key': 'properties.assignedToMe', 'type': 'bool'}, + 'principal_id': {'key': 'properties.reviewedBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.reviewedBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'properties.reviewedBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'properties.reviewedBy.userPrincipalName', 'type': 'str'}, + 'reviewed_date_time': {'key': 'properties.reviewedDateTime', 'type': 'iso-8601'}, + 'review_result': {'key': 'properties.reviewResult', 'type': 'str'}, + 'justification': {'key': 'properties.justification', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RoleAssignmentApprovalStep, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.display_name = kwargs.get('display_name', None) + self.status = None + self.assigned_to_me = None + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.reviewed_date_time = None + self.review_result = kwargs.get('review_result', None) + self.justification = kwargs.get('justification', None) + + +class RoleAssignmentApprovalStepListResult(Model): + """List of role assignment approval stage list. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param value: Role Assignment Approval Step list. + :type value: + list[~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RoleAssignmentApprovalStep]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RoleAssignmentApprovalStepListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class RoleAssignmentApprovalStepProperties(Model): + """Approval Step. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param display_name: The display name for the approval stage. + :type display_name: str + :ivar status: This read-only field specifies the status of an approval. + Possible values include: 'NotStarted', 'InProgress', 'Completed', + 'Expired', 'Initializing', 'Escalating', 'Completing', 'Escalated' + :vartype status: str or + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepStatus + :ivar assigned_to_me: Indicates whether the stage is assigned to me for + review + :vartype assigned_to_me: bool + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :ivar reviewed_date_time: Date Time when a decision was taken. + :vartype reviewed_date_time: datetime + :param review_result: The decision on the approval stage. This value is + initially set to NotReviewed. Approvers can take action of Approve/Deny. + Possible values include: 'Approve', 'Deny', 'NotReviewed' + :type review_result: str or + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepReviewResult + :param justification: Justification provided by approvers for their action + :type justification: str + """ + + _validation = { + 'status': {'readonly': True}, + 'assigned_to_me': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'reviewed_date_time': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'assigned_to_me': {'key': 'assignedToMe', 'type': 'bool'}, + 'principal_id': {'key': 'reviewedBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'reviewedBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'reviewedBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'reviewedBy.userPrincipalName', 'type': 'str'}, + 'reviewed_date_time': {'key': 'reviewedDateTime', 'type': 'iso-8601'}, + 'review_result': {'key': 'reviewResult', 'type': 'str'}, + 'justification': {'key': 'justification', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RoleAssignmentApprovalStepProperties, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.status = None + self.assigned_to_me = None + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.reviewed_date_time = None + self.review_result = kwargs.get('review_result', None) + self.justification = kwargs.get('justification', None) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models_py3.py new file mode 100644 index 0000000000000..6d5e77a73d1e2 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_models_py3.py @@ -0,0 +1,379 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorDefinition(Model): + """Error. + + Error description and code explaining why an operation failed. + + :param error: Error of the list gateway status. + :type error: + ~azure.mgmt.authorization.v2021_01_01_preview.models.ErrorDefinitionProperties + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinitionProperties'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorDefinition, self).__init__(**kwargs) + self.error = error + + +class ErrorDefinitionException(HttpOperationError): + """Server responsed with exception of type: 'ErrorDefinition'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorDefinitionException, self).__init__(deserialize, response, 'ErrorDefinition', *args) + + +class ErrorDefinitionProperties(Model): + """Error. + + Error description and code explaining why an operation failed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar message: Description of the error. + :vartype message: str + :param code: Error code of list gateway. + :type code: str + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, **kwargs) -> None: + super(ErrorDefinitionProperties, self).__init__(**kwargs) + self.message = None + self.code = code + + +class Operation(Model): + """The definition of a Microsoft.Authorization operation. + + :param name: Name of the operation + :type name: str + :param is_data_action: Indicates whether the operation is a data action + :type is_data_action: bool + :param display: Display of the operation + :type display: + ~azure.mgmt.authorization.v2021_01_01_preview.models.OperationDisplay + :param origin: Origin of the operation. Values include + user|system|user,system + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, is_data_action: bool=None, display=None, origin: str=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin + + +class OperationDisplay(Model): + """The display information for a Microsoft.Authorization operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: The resource provider name: Microsoft.Authorization. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class RoleAssignmentApproval(Model): + """Role Assignment Approval. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The role assignment approval id. + :vartype id: str + :ivar name: The role assignment approval unique id. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param stages: This is the collection of stages returned when one does an + expand on it. + :type stages: + list[~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep] + """ + + _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'}, + 'stages': {'key': 'properties.stages', 'type': '[RoleAssignmentApprovalStep]'}, + } + + def __init__(self, *, stages=None, **kwargs) -> None: + super(RoleAssignmentApproval, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.stages = stages + + +class RoleAssignmentApprovalStep(Model): + """Role assignment approval stage properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The role assignment approval stage id. + :vartype id: str + :ivar name: The role assignment approval stage name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param display_name: The display name for the approval stage. + :type display_name: str + :ivar status: This read-only field specifies the status of an approval. + Possible values include: 'NotStarted', 'InProgress', 'Completed', + 'Expired', 'Initializing', 'Escalating', 'Completing', 'Escalated' + :vartype status: str or + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepStatus + :ivar assigned_to_me: Indicates whether the stage is assigned to me for + review + :vartype assigned_to_me: bool + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :ivar reviewed_date_time: Date Time when a decision was taken. + :vartype reviewed_date_time: datetime + :param review_result: The decision on the approval stage. This value is + initially set to NotReviewed. Approvers can take action of Approve/Deny. + Possible values include: 'Approve', 'Deny', 'NotReviewed' + :type review_result: str or + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepReviewResult + :param justification: Justification provided by approvers for their action + :type justification: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'assigned_to_me': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'reviewed_date_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'assigned_to_me': {'key': 'properties.assignedToMe', 'type': 'bool'}, + 'principal_id': {'key': 'properties.reviewedBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.reviewedBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'properties.reviewedBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'properties.reviewedBy.userPrincipalName', 'type': 'str'}, + 'reviewed_date_time': {'key': 'properties.reviewedDateTime', 'type': 'iso-8601'}, + 'review_result': {'key': 'properties.reviewResult', 'type': 'str'}, + 'justification': {'key': 'properties.justification', 'type': 'str'}, + } + + def __init__(self, *, display_name: str=None, review_result=None, justification: str=None, **kwargs) -> None: + super(RoleAssignmentApprovalStep, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.display_name = display_name + self.status = None + self.assigned_to_me = None + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.reviewed_date_time = None + self.review_result = review_result + self.justification = justification + + +class RoleAssignmentApprovalStepListResult(Model): + """List of role assignment approval stage list. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param value: Role Assignment Approval Step list. + :type value: + list[~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RoleAssignmentApprovalStep]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(RoleAssignmentApprovalStepListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class RoleAssignmentApprovalStepProperties(Model): + """Approval Step. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param display_name: The display name for the approval stage. + :type display_name: str + :ivar status: This read-only field specifies the status of an approval. + Possible values include: 'NotStarted', 'InProgress', 'Completed', + 'Expired', 'Initializing', 'Escalating', 'Completing', 'Escalated' + :vartype status: str or + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepStatus + :ivar assigned_to_me: Indicates whether the stage is assigned to me for + review + :vartype assigned_to_me: bool + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :ivar reviewed_date_time: Date Time when a decision was taken. + :vartype reviewed_date_time: datetime + :param review_result: The decision on the approval stage. This value is + initially set to NotReviewed. Approvers can take action of Approve/Deny. + Possible values include: 'Approve', 'Deny', 'NotReviewed' + :type review_result: str or + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepReviewResult + :param justification: Justification provided by approvers for their action + :type justification: str + """ + + _validation = { + 'status': {'readonly': True}, + 'assigned_to_me': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'reviewed_date_time': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'assigned_to_me': {'key': 'assignedToMe', 'type': 'bool'}, + 'principal_id': {'key': 'reviewedBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'reviewedBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'reviewedBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'reviewedBy.userPrincipalName', 'type': 'str'}, + 'reviewed_date_time': {'key': 'reviewedDateTime', 'type': 'iso-8601'}, + 'review_result': {'key': 'reviewResult', 'type': 'str'}, + 'justification': {'key': 'justification', 'type': 'str'}, + } + + def __init__(self, *, display_name: str=None, review_result=None, justification: str=None, **kwargs) -> None: + super(RoleAssignmentApprovalStepProperties, self).__init__(**kwargs) + self.display_name = display_name + self.status = None + self.assigned_to_me = None + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.reviewed_date_time = None + self.review_result = review_result + self.justification = justification diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_paged_models.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_paged_models.py new file mode 100644 index 0000000000000..08ac7fd27e218 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/models/_paged_models.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.paging import Paged + + +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class RoleAssignmentApprovalPaged(Paged): + """ + A paging container for iterating over a list of :class:`RoleAssignmentApproval ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[RoleAssignmentApproval]'} + } + + def __init__(self, *args, **kwargs): + + super(RoleAssignmentApprovalPaged, self).__init__(*args, **kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/__init__.py new file mode 100644 index 0000000000000..bda557459f8ca --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/__init__.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._role_assignment_approval_operations import RoleAssignmentApprovalOperations +from ._role_assignment_approval_steps_operations import RoleAssignmentApprovalStepsOperations +from ._role_assignment_approval_step_operations import RoleAssignmentApprovalStepOperations +from ._scope_role_assignment_approval_operations import ScopeRoleAssignmentApprovalOperations +from ._scope_role_assignment_approval_steps_operations import ScopeRoleAssignmentApprovalStepsOperations +from ._scope_role_assignment_approval_step_operations import ScopeRoleAssignmentApprovalStepOperations + +__all__ = [ + 'Operations', + 'RoleAssignmentApprovalOperations', + 'RoleAssignmentApprovalStepsOperations', + 'RoleAssignmentApprovalStepOperations', + 'ScopeRoleAssignmentApprovalOperations', + 'ScopeRoleAssignmentApprovalStepsOperations', + 'ScopeRoleAssignmentApprovalStepOperations', +] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_operations.py new file mode 100644 index 0000000000000..7ab9c841925b6 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_operations.py @@ -0,0 +1,100 @@ +# 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 .. import models + + +class Operations(object): + """Operations 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 be used with the HTTP request. Constant value: "2021-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-01-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists the operations available from this provider. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.authorization.v2021_01_01_preview.models.OperationPaged[~azure.mgmt.authorization.v2021_01_01_preview.models.Operation] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/operations'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_operations.py new file mode 100644 index 0000000000000..b69581d93f4fb --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_operations.py @@ -0,0 +1,170 @@ +# 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 .. import models + + +class RoleAssignmentApprovalOperations(object): + """RoleAssignmentApprovalOperations 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 be used with the HTTP request. Constant value: "2021-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-01-01-preview" + + self.config = config + + def list( + self, filter=None, custom_headers=None, raw=False, **operation_config): + """Get role assignment approvals. + + :param filter: The filter to apply on the operation. Valid values for + $filter are: 'asApprover()', 'asCreatedBy()' and 'asTarget()'. If + $filter is not provided, no filtering is performed. If + $filter=asApprover() is provided, the returned list only includes all + role assignment approvals that the calling user is assigned as an + approver for. If $filter=asCreatedBy() is provided, the returned list + only includes all role assignment approvals that the calling user + created requests for. If $filter=asTarget() is provided, the returned + list only includes all role assignment approvals that the calling user + has requests targeted for. + :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 RoleAssignmentApproval + :rtype: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalPaged[~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApproval] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + + 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.RoleAssignmentApprovalPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/roleAssignmentApprovals'} + + def get_by_id( + self, approval_id, custom_headers=None, raw=False, **operation_config): + """Get role assignment approval. + + :param approval_id: The id of the role assignment approval. + :type approval_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: RoleAssignmentApproval or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApproval + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'approvalId': self._serialize.url("approval_id", approval_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignmentApproval', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_step_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_step_operations.py new file mode 100644 index 0000000000000..be072e642c6a3 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_step_operations.py @@ -0,0 +1,233 @@ +# 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 .. import models + + +class RoleAssignmentApprovalStepOperations(object): + """RoleAssignmentApprovalStepOperations 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 be used with the HTTP request. Constant value: "2021-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-01-01-preview" + + self.config = config + + def get_by_id( + self, approval_id, stage_id, custom_headers=None, raw=False, **operation_config): + """Get role assignment approval. + + :param approval_id: The id of the role assignment approval. + :type approval_id: str + :param stage_id: The id of the role assignment approval stage. + :type stage_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: RoleAssignmentApprovalStep or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'approvalId': self._serialize.url("approval_id", approval_id, 'str'), + 'stageId': self._serialize.url("stage_id", stage_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignmentApprovalStep', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}'} + + def patch( + self, approval_id, stage_id, properties, custom_headers=None, raw=False, **operation_config): + """Record a decision. + + :param approval_id: The id of the role assignment approval. + :type approval_id: str + :param stage_id: The id of the role assignment approval stage. + :type stage_id: str + :param properties: Role Assignment Approval stage properties to patch. + :type properties: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties + :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: RoleAssignmentApprovalStep or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.patch.metadata['url'] + path_format_arguments = { + 'approvalId': self._serialize.url("approval_id", approval_id, 'str'), + 'stageId': self._serialize.url("stage_id", stage_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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(properties, 'RoleAssignmentApprovalStepProperties') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignmentApprovalStep', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + patch.metadata = {'url': '/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}'} + + def put( + self, approval_id, stage_id, properties, custom_headers=None, raw=False, **operation_config): + """Record a decision. + + :param approval_id: The id of the role assignment approval. + :type approval_id: str + :param stage_id: The id of the role assignment approval stage. + :type stage_id: str + :param properties: Role Assignment Approval stage properties to put. + :type properties: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties + :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: RoleAssignmentApprovalStep or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.put.metadata['url'] + path_format_arguments = { + 'approvalId': self._serialize.url("approval_id", approval_id, 'str'), + 'stageId': self._serialize.url("stage_id", stage_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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(properties, 'RoleAssignmentApprovalStepProperties') + + # 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 [200]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignmentApprovalStep', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + put.metadata = {'url': '/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_steps_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_steps_operations.py new file mode 100644 index 0000000000000..56d0177d9bef9 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_role_assignment_approval_steps_operations.py @@ -0,0 +1,97 @@ +# 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 .. import models + + +class RoleAssignmentApprovalStepsOperations(object): + """RoleAssignmentApprovalStepsOperations 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 be used with the HTTP request. Constant value: "2021-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-01-01-preview" + + self.config = config + + def list( + self, approval_id, custom_headers=None, raw=False, **operation_config): + """Get role assignment approval. + + :param approval_id: The id of the role assignment approval. + :type approval_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: RoleAssignmentApprovalStepListResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepListResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'approvalId': self._serialize.url("approval_id", approval_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignmentApprovalStepListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_operations.py new file mode 100644 index 0000000000000..626b3f5408b2a --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_operations.py @@ -0,0 +1,179 @@ +# 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 .. import models + + +class ScopeRoleAssignmentApprovalOperations(object): + """ScopeRoleAssignmentApprovalOperations 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 be used with the HTTP request. Constant value: "2021-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-01-01-preview" + + self.config = config + + def list( + self, scope, filter=None, custom_headers=None, raw=False, **operation_config): + """Get role assignment approvals. + + :param scope: The scope of the resource. + :type scope: str + :param filter: The filter to apply on the operation. Valid values for + $filter are: 'asApprover()', 'asCreatedBy()' and 'asTarget()'. If + $filter is not provided, no filtering is performed. If + $filter=asApprover() is provided, the returned list only includes all + role assignment approvals that the calling user is assigned as an + approver for. If $filter=asCreatedBy() is provided, the returned list + only includes all role assignment approvals that the calling user + created requests for. If $filter=asTarget() is provided, the returned + list only includes all role assignment approvals that the calling user + has requests targeted for. + :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 RoleAssignmentApproval + :rtype: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalPaged[~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApproval] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + + 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.RoleAssignmentApprovalPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals'} + + def get_by_id( + self, approval_id, scope, custom_headers=None, raw=False, **operation_config): + """Get role assignment approval. + + :param approval_id: The id of the role assignment approval. + :type approval_id: str + :param scope: The scope of the resource. + :type scope: 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: RoleAssignmentApproval or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApproval + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'approvalId': self._serialize.url("approval_id", approval_id, 'str'), + 'scope': self._serialize.url("scope", scope, '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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignmentApproval', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_step_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_step_operations.py new file mode 100644 index 0000000000000..ae5117bc54075 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_step_operations.py @@ -0,0 +1,242 @@ +# 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 .. import models + + +class ScopeRoleAssignmentApprovalStepOperations(object): + """ScopeRoleAssignmentApprovalStepOperations 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 be used with the HTTP request. Constant value: "2021-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-01-01-preview" + + self.config = config + + def get_by_id( + self, approval_id, stage_id, scope, custom_headers=None, raw=False, **operation_config): + """Get role assignment approval. + + :param approval_id: The id of the role assignment approval. + :type approval_id: str + :param stage_id: The id of the role assignment approval stage. + :type stage_id: str + :param scope: The scope of the resource. + :type scope: 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: RoleAssignmentApprovalStep or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'approvalId': self._serialize.url("approval_id", approval_id, 'str'), + 'stageId': self._serialize.url("stage_id", stage_id, 'str'), + 'scope': self._serialize.url("scope", scope, '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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignmentApprovalStep', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}'} + + def patch( + self, approval_id, stage_id, properties, scope, custom_headers=None, raw=False, **operation_config): + """Record a decision. + + :param approval_id: The id of the role assignment approval. + :type approval_id: str + :param stage_id: The id of the role assignment approval stage. + :type stage_id: str + :param properties: Role Assignment Approval stage properties to patch. + :type properties: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties + :param scope: The scope of the resource. + :type scope: 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: RoleAssignmentApprovalStep or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.patch.metadata['url'] + path_format_arguments = { + 'approvalId': self._serialize.url("approval_id", approval_id, 'str'), + 'stageId': self._serialize.url("stage_id", stage_id, 'str'), + 'scope': self._serialize.url("scope", scope, '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(properties, 'RoleAssignmentApprovalStepProperties') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignmentApprovalStep', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + patch.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}'} + + def put( + self, approval_id, stage_id, properties, scope, custom_headers=None, raw=False, **operation_config): + """Record a decision. + + :param approval_id: The id of the role assignment approval. + :type approval_id: str + :param stage_id: The id of the role assignment approval stage. + :type stage_id: str + :param properties: Role Assignment Approval stage properties to put. + :type properties: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepProperties + :param scope: The scope of the resource. + :type scope: 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: RoleAssignmentApprovalStep or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStep + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.put.metadata['url'] + path_format_arguments = { + 'approvalId': self._serialize.url("approval_id", approval_id, 'str'), + 'stageId': self._serialize.url("stage_id", stage_id, 'str'), + 'scope': self._serialize.url("scope", scope, '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(properties, 'RoleAssignmentApprovalStepProperties') + + # 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 [200]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignmentApprovalStep', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + put.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages/{stageId}'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_steps_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_steps_operations.py new file mode 100644 index 0000000000000..8b63aeb68e91f --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/operations/_scope_role_assignment_approval_steps_operations.py @@ -0,0 +1,100 @@ +# 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 .. import models + + +class ScopeRoleAssignmentApprovalStepsOperations(object): + """ScopeRoleAssignmentApprovalStepsOperations 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 be used with the HTTP request. Constant value: "2021-01-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-01-01-preview" + + self.config = config + + def list( + self, approval_id, scope, custom_headers=None, raw=False, **operation_config): + """Get role assignment approval. + + :param approval_id: The id of the role assignment approval. + :type approval_id: str + :param scope: The scope of the resource. + :type scope: 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: RoleAssignmentApprovalStepListResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.authorization.v2021_01_01_preview.models.RoleAssignmentApprovalStepListResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'approvalId': self._serialize.url("approval_id", approval_id, 'str'), + 'scope': self._serialize.url("scope", scope, '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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RoleAssignmentApprovalStepListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/roleAssignmentApprovals/{approvalId}/stages'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/version.py new file mode 100644 index 0000000000000..1b04b35649546 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2021-01-01-preview" + diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/__init__.py new file mode 100644 index 0000000000000..e8714b719dfc2 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_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/v2021_03_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_authorization_management_client.py new file mode 100644 index 0000000000000..40e22f7865c17 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_authorization_management_client.py @@ -0,0 +1,89 @@ +# 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 Operations +from .operations import AccessReviewScheduleDefinitionsOperations +from .operations import AccessReviewInstancesOperations +from .operations import AccessReviewInstanceOperations +from .operations import AccessReviewInstanceDecisionsOperations +from .operations import AccessReviewDefaultSettingsOperations +from .operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations +from .operations import AccessReviewInstancesAssignedForMyApprovalOperations +from .operations import AccessReviewInstanceMyDecisionsOperations +from . import models + + +class AuthorizationManagementClient(SDKClient): + """Access reviews service provides the workflow for running access reviews on different kind of resources. + + :ivar config: Configuration for client. + :vartype config: AuthorizationManagementClientConfiguration + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.authorization.v2021_03_01_preview.operations.Operations + :ivar access_review_schedule_definitions: AccessReviewScheduleDefinitions operations + :vartype access_review_schedule_definitions: azure.mgmt.authorization.v2021_03_01_preview.operations.AccessReviewScheduleDefinitionsOperations + :ivar access_review_instances: AccessReviewInstances operations + :vartype access_review_instances: azure.mgmt.authorization.v2021_03_01_preview.operations.AccessReviewInstancesOperations + :ivar access_review_instance: AccessReviewInstance operations + :vartype access_review_instance: azure.mgmt.authorization.v2021_03_01_preview.operations.AccessReviewInstanceOperations + :ivar access_review_instance_decisions: AccessReviewInstanceDecisions operations + :vartype access_review_instance_decisions: azure.mgmt.authorization.v2021_03_01_preview.operations.AccessReviewInstanceDecisionsOperations + :ivar access_review_default_settings: AccessReviewDefaultSettings operations + :vartype access_review_default_settings: azure.mgmt.authorization.v2021_03_01_preview.operations.AccessReviewDefaultSettingsOperations + :ivar access_review_schedule_definitions_assigned_for_my_approval: AccessReviewScheduleDefinitionsAssignedForMyApproval operations + :vartype access_review_schedule_definitions_assigned_for_my_approval: azure.mgmt.authorization.v2021_03_01_preview.operations.AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations + :ivar access_review_instances_assigned_for_my_approval: AccessReviewInstancesAssignedForMyApproval operations + :vartype access_review_instances_assigned_for_my_approval: azure.mgmt.authorization.v2021_03_01_preview.operations.AccessReviewInstancesAssignedForMyApprovalOperations + :ivar access_review_instance_my_decisions: AccessReviewInstanceMyDecisions operations + :vartype access_review_instance_my_decisions: azure.mgmt.authorization.v2021_03_01_preview.operations.AccessReviewInstanceMyDecisionsOperations + + :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 = '2021-03-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_schedule_definitions = AccessReviewScheduleDefinitionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_instances = AccessReviewInstancesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_instance = AccessReviewInstanceOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_instance_decisions = AccessReviewInstanceDecisionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_default_settings = AccessReviewDefaultSettingsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_schedule_definitions_assigned_for_my_approval = AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_instances_assigned_for_my_approval = AccessReviewInstancesAssignedForMyApprovalOperations( + self._client, self.config, self._serialize, self._deserialize) + self.access_review_instance_my_decisions = AccessReviewInstanceMyDecisionsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_configuration.py new file mode 100644 index 0000000000000..c192b8088f15e --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_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/v2021_03_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/__init__.py new file mode 100644 index 0000000000000..5207439e0f098 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/__init__.py @@ -0,0 +1,95 @@ +# 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 AccessReviewDecision + from ._models_py3 import AccessReviewDecisionIdentity + from ._models_py3 import AccessReviewDecisionProperties + from ._models_py3 import AccessReviewDecisionServicePrincipalIdentity + from ._models_py3 import AccessReviewDecisionUserIdentity + from ._models_py3 import AccessReviewDefaultSettings + from ._models_py3 import AccessReviewInstance + from ._models_py3 import AccessReviewReviewer + from ._models_py3 import AccessReviewScheduleDefinition + from ._models_py3 import AccessReviewScheduleDefinitionProperties + from ._models_py3 import AccessReviewScheduleSettings + from ._models_py3 import ErrorDefinition, ErrorDefinitionException + from ._models_py3 import ErrorDefinitionProperties + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay +except (SyntaxError, ImportError): + from ._models import AccessReviewDecision + from ._models import AccessReviewDecisionIdentity + from ._models import AccessReviewDecisionProperties + from ._models import AccessReviewDecisionServicePrincipalIdentity + from ._models import AccessReviewDecisionUserIdentity + from ._models import AccessReviewDefaultSettings + from ._models import AccessReviewInstance + from ._models import AccessReviewReviewer + from ._models import AccessReviewScheduleDefinition + from ._models import AccessReviewScheduleDefinitionProperties + from ._models import AccessReviewScheduleSettings + from ._models import ErrorDefinition, ErrorDefinitionException + from ._models import ErrorDefinitionProperties + from ._models import Operation + from ._models import OperationDisplay +from ._paged_models import AccessReviewDecisionPaged +from ._paged_models import AccessReviewInstancePaged +from ._paged_models import AccessReviewScheduleDefinitionPaged +from ._paged_models import OperationPaged +from ._authorization_management_client_enums import ( + AccessReviewScheduleDefinitionStatus, + AccessReviewActorIdentityType, + DefaultDecisionType, + AccessReviewRecurrencePatternType, + AccessReviewRecurrenceRangeType, + AccessReviewScopePrincipalType, + AccessReviewReviewerType, + AccessReviewScheduleDefinitionReviewersType, + AccessReviewInstanceStatus, + AccessRecommendationType, + AccessReviewResult, + AccessReviewApplyResult, +) + +__all__ = [ + 'AccessReviewDecision', + 'AccessReviewDecisionIdentity', + 'AccessReviewDecisionProperties', + 'AccessReviewDecisionServicePrincipalIdentity', + 'AccessReviewDecisionUserIdentity', + 'AccessReviewDefaultSettings', + 'AccessReviewInstance', + 'AccessReviewReviewer', + 'AccessReviewScheduleDefinition', + 'AccessReviewScheduleDefinitionProperties', + 'AccessReviewScheduleSettings', + 'ErrorDefinition', 'ErrorDefinitionException', + 'ErrorDefinitionProperties', + 'Operation', + 'OperationDisplay', + 'OperationPaged', + 'AccessReviewScheduleDefinitionPaged', + 'AccessReviewInstancePaged', + 'AccessReviewDecisionPaged', + 'AccessReviewScheduleDefinitionStatus', + 'AccessReviewActorIdentityType', + 'DefaultDecisionType', + 'AccessReviewRecurrencePatternType', + 'AccessReviewRecurrenceRangeType', + 'AccessReviewScopePrincipalType', + 'AccessReviewReviewerType', + 'AccessReviewScheduleDefinitionReviewersType', + 'AccessReviewInstanceStatus', + 'AccessRecommendationType', + 'AccessReviewResult', + 'AccessReviewApplyResult', +] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_authorization_management_client_enums.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_authorization_management_client_enums.py new file mode 100644 index 0000000000000..b9d89c15064fa --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_authorization_management_client_enums.py @@ -0,0 +1,114 @@ +# 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 AccessReviewScheduleDefinitionStatus(str, Enum): + + not_started = "NotStarted" + in_progress = "InProgress" + completed = "Completed" + applied = "Applied" + initializing = "Initializing" + applying = "Applying" + completing = "Completing" + scheduled = "Scheduled" + auto_reviewing = "AutoReviewing" + auto_reviewed = "AutoReviewed" + starting = "Starting" + + +class AccessReviewActorIdentityType(str, Enum): + + user = "user" + service_principal = "servicePrincipal" + + +class DefaultDecisionType(str, Enum): + + approve = "Approve" + deny = "Deny" + recommendation = "Recommendation" + + +class AccessReviewRecurrencePatternType(str, Enum): + + weekly = "weekly" + absolute_monthly = "absoluteMonthly" + + +class AccessReviewRecurrenceRangeType(str, Enum): + + end_date = "endDate" + no_end = "noEnd" + numbered = "numbered" + + +class AccessReviewScopePrincipalType(str, Enum): + + user = "user" + guest_user = "guestUser" + service_principal = "servicePrincipal" + + +class AccessReviewReviewerType(str, Enum): + + user = "user" + service_principal = "servicePrincipal" + + +class AccessReviewScheduleDefinitionReviewersType(str, Enum): + + assigned = "Assigned" + self_enum = "Self" + managers = "Managers" + + +class AccessReviewInstanceStatus(str, Enum): + + not_started = "NotStarted" + in_progress = "InProgress" + completed = "Completed" + applied = "Applied" + initializing = "Initializing" + applying = "Applying" + completing = "Completing" + scheduled = "Scheduled" + auto_reviewing = "AutoReviewing" + auto_reviewed = "AutoReviewed" + starting = "Starting" + + +class AccessRecommendationType(str, Enum): + + approve = "Approve" + deny = "Deny" + no_info_available = "NoInfoAvailable" + + +class AccessReviewResult(str, Enum): + + approve = "Approve" + deny = "Deny" + not_reviewed = "NotReviewed" + dont_know = "DontKnow" + not_notified = "NotNotified" + + +class AccessReviewApplyResult(str, Enum): + + new = "New" + applying = "Applying" + applied_successfully = "AppliedSuccessfully" + applied_with_unknown_failure = "AppliedWithUnknownFailure" + applied_successfully_but_object_not_found = "AppliedSuccessfullyButObjectNotFound" + apply_not_supported = "ApplyNotSupported" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models.py new file mode 100644 index 0000000000000..7f6d16266b61c --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models.py @@ -0,0 +1,1160 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class AccessReviewDecision(Model): + """Access Review. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review decision id. + :vartype id: str + :ivar name: The access review decision name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar id1: The id of principal whose access was reviewed. + :vartype id1: str + :ivar display_name: The display name of the user whose access was + reviewed. + :vartype display_name: str + :ivar id2: The id of resource associated with a decision record. + :vartype id2: str + :ivar display_name1: The display name of resource associated with a + decision record. + :vartype display_name1: str + :ivar recommendation: The feature- generated recommendation shown to the + reviewer. Possible values include: 'Approve', 'Deny', 'NoInfoAvailable' + :vartype recommendation: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessRecommendationType + :param decision: The decision on the approval step. This value is + initially set to NotReviewed. Approvers can take action of Approve/Deny. + Possible values include: 'Approve', 'Deny', 'NotReviewed', 'DontKnow', + 'NotNotified' + :type decision: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewResult + :param justification: Justification provided by approvers for their action + :type justification: str + :ivar reviewed_date_time: Date Time when a decision was taken. + :vartype reviewed_date_time: datetime + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :ivar apply_result: The outcome of applying the decision. Possible values + include: 'New', 'Applying', 'AppliedSuccessfully', + 'AppliedWithUnknownFailure', 'AppliedSuccessfullyButObjectNotFound', + 'ApplyNotSupported' + :vartype apply_result: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewApplyResult + :ivar applied_date_time: The date and time when the review decision was + applied. + :vartype applied_date_time: datetime + :ivar principal_id1: The identity id + :vartype principal_id1: str + :ivar principal_type1: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name1: The identity display name + :vartype principal_name1: str + :ivar user_principal_name1: The user principal name(if valid) + :vartype user_principal_name1: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'id1': {'readonly': True}, + 'display_name': {'readonly': True}, + 'id2': {'readonly': True}, + 'display_name1': {'readonly': True}, + 'recommendation': {'readonly': True}, + 'reviewed_date_time': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'apply_result': {'readonly': True}, + 'applied_date_time': {'readonly': True}, + 'principal_id1': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'principal_name1': {'readonly': True}, + 'user_principal_name1': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'id1': {'key': 'properties.principal.id', 'type': 'str'}, + 'display_name': {'key': 'properties.principal.displayName', 'type': 'str'}, + 'id2': {'key': 'properties.resource.id', 'type': 'str'}, + 'display_name1': {'key': 'properties.resource.displayName', 'type': 'str'}, + 'recommendation': {'key': 'properties.recommendation', 'type': 'str'}, + 'decision': {'key': 'properties.decision', 'type': 'str'}, + 'justification': {'key': 'properties.justification', 'type': 'str'}, + 'reviewed_date_time': {'key': 'properties.reviewedDateTime', 'type': 'iso-8601'}, + 'principal_id': {'key': 'properties.reviewedBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.reviewedBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'properties.reviewedBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'properties.reviewedBy.userPrincipalName', 'type': 'str'}, + 'apply_result': {'key': 'properties.applyResult', 'type': 'str'}, + 'applied_date_time': {'key': 'properties.appliedDateTime', 'type': 'iso-8601'}, + 'principal_id1': {'key': 'properties.appliedBy.principalId', 'type': 'str'}, + 'principal_type1': {'key': 'properties.appliedBy.principalType', 'type': 'str'}, + 'principal_name1': {'key': 'properties.appliedBy.principalName', 'type': 'str'}, + 'user_principal_name1': {'key': 'properties.appliedBy.userPrincipalName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AccessReviewDecision, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.id1 = None + self.display_name = None + self.id2 = None + self.display_name1 = None + self.recommendation = None + self.decision = kwargs.get('decision', None) + self.justification = kwargs.get('justification', None) + self.reviewed_date_time = None + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.apply_result = None + self.applied_date_time = None + self.principal_id1 = None + self.principal_type1 = None + self.principal_name1 = None + self.user_principal_name1 = None + + +class AccessReviewDecisionIdentity(Model): + """Target of the decision. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AccessReviewDecisionUserIdentity, + AccessReviewDecisionServicePrincipalIdentity + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The id of principal whose access was reviewed. + :vartype id: str + :ivar display_name: The display name of the user whose access was + reviewed. + :vartype display_name: str + :param type: Required. Constant filled by server. + :type type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'display_name': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'user': 'AccessReviewDecisionUserIdentity', 'servicePrincipal': 'AccessReviewDecisionServicePrincipalIdentity'} + } + + def __init__(self, **kwargs): + super(AccessReviewDecisionIdentity, self).__init__(**kwargs) + self.id = None + self.display_name = None + self.type = None + + +class AccessReviewDecisionProperties(Model): + """Approval Step. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The id of principal whose access was reviewed. + :vartype id: str + :ivar display_name: The display name of the user whose access was + reviewed. + :vartype display_name: str + :ivar id1: The id of resource associated with a decision record. + :vartype id1: str + :ivar display_name1: The display name of resource associated with a + decision record. + :vartype display_name1: str + :ivar recommendation: The feature- generated recommendation shown to the + reviewer. Possible values include: 'Approve', 'Deny', 'NoInfoAvailable' + :vartype recommendation: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessRecommendationType + :param decision: The decision on the approval step. This value is + initially set to NotReviewed. Approvers can take action of Approve/Deny. + Possible values include: 'Approve', 'Deny', 'NotReviewed', 'DontKnow', + 'NotNotified' + :type decision: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewResult + :param justification: Justification provided by approvers for their action + :type justification: str + :ivar reviewed_date_time: Date Time when a decision was taken. + :vartype reviewed_date_time: datetime + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :ivar apply_result: The outcome of applying the decision. Possible values + include: 'New', 'Applying', 'AppliedSuccessfully', + 'AppliedWithUnknownFailure', 'AppliedSuccessfullyButObjectNotFound', + 'ApplyNotSupported' + :vartype apply_result: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewApplyResult + :ivar applied_date_time: The date and time when the review decision was + applied. + :vartype applied_date_time: datetime + :ivar principal_id1: The identity id + :vartype principal_id1: str + :ivar principal_type1: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name1: The identity display name + :vartype principal_name1: str + :ivar user_principal_name1: The user principal name(if valid) + :vartype user_principal_name1: str + """ + + _validation = { + 'id': {'readonly': True}, + 'display_name': {'readonly': True}, + 'id1': {'readonly': True}, + 'display_name1': {'readonly': True}, + 'recommendation': {'readonly': True}, + 'reviewed_date_time': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'apply_result': {'readonly': True}, + 'applied_date_time': {'readonly': True}, + 'principal_id1': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'principal_name1': {'readonly': True}, + 'user_principal_name1': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'principal.id', 'type': 'str'}, + 'display_name': {'key': 'principal.displayName', 'type': 'str'}, + 'id1': {'key': 'resource.id', 'type': 'str'}, + 'display_name1': {'key': 'resource.displayName', 'type': 'str'}, + 'recommendation': {'key': 'recommendation', 'type': 'str'}, + 'decision': {'key': 'decision', 'type': 'str'}, + 'justification': {'key': 'justification', 'type': 'str'}, + 'reviewed_date_time': {'key': 'reviewedDateTime', 'type': 'iso-8601'}, + 'principal_id': {'key': 'reviewedBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'reviewedBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'reviewedBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'reviewedBy.userPrincipalName', 'type': 'str'}, + 'apply_result': {'key': 'applyResult', 'type': 'str'}, + 'applied_date_time': {'key': 'appliedDateTime', 'type': 'iso-8601'}, + 'principal_id1': {'key': 'appliedBy.principalId', 'type': 'str'}, + 'principal_type1': {'key': 'appliedBy.principalType', 'type': 'str'}, + 'principal_name1': {'key': 'appliedBy.principalName', 'type': 'str'}, + 'user_principal_name1': {'key': 'appliedBy.userPrincipalName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AccessReviewDecisionProperties, self).__init__(**kwargs) + self.id = None + self.display_name = None + self.id1 = None + self.display_name1 = None + self.recommendation = None + self.decision = kwargs.get('decision', None) + self.justification = kwargs.get('justification', None) + self.reviewed_date_time = None + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.apply_result = None + self.applied_date_time = None + self.principal_id1 = None + self.principal_type1 = None + self.principal_name1 = None + self.user_principal_name1 = None + + +class AccessReviewDecisionServicePrincipalIdentity(AccessReviewDecisionIdentity): + """Service Principal Decision Target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The id of principal whose access was reviewed. + :vartype id: str + :ivar display_name: The display name of the user whose access was + reviewed. + :vartype display_name: str + :param type: Required. Constant filled by server. + :type type: str + :ivar app_id: The appId for the service principal entity being reviewed + :vartype app_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'display_name': {'readonly': True}, + 'type': {'required': True}, + 'app_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'app_id': {'key': 'appId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AccessReviewDecisionServicePrincipalIdentity, self).__init__(**kwargs) + self.app_id = None + self.type = 'servicePrincipal' + + +class AccessReviewDecisionUserIdentity(AccessReviewDecisionIdentity): + """User Decision Target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The id of principal whose access was reviewed. + :vartype id: str + :ivar display_name: The display name of the user whose access was + reviewed. + :vartype display_name: str + :param type: Required. Constant filled by server. + :type type: str + :ivar user_principal_name: The user principal name of the user whose + access was reviewed. + :vartype user_principal_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'display_name': {'readonly': True}, + 'type': {'required': True}, + 'user_principal_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_principal_name': {'key': 'userPrincipalName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AccessReviewDecisionUserIdentity, self).__init__(**kwargs) + self.user_principal_name = None + self.type = 'user' + + +class AccessReviewDefaultSettings(Model): + """Access Review Default Settings. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review default settings id. This is only going to be + default + :vartype id: str + :ivar name: The access review default settings name. This is always going + to be Access Review Default Settings + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param type1: The recurrence type : weekly, monthly, etc. Possible values + include: 'weekly', 'absoluteMonthly' + :type type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrencePatternType + :param interval: The interval for recurrence. For a quarterly review, the + interval is 3 for type : absoluteMonthly. + :type interval: int + :param type2: The recurrence range type. The possible values are: endDate, + noEnd, numbered. Possible values include: 'endDate', 'noEnd', 'numbered' + :type type2: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrenceRangeType + :param number_of_occurrences: The number of times to repeat the access + review. Required and must be positive if type is numbered. + :type number_of_occurrences: int + :param start_date: The DateTime when the review is scheduled to be start. + This could be a date in the future. Required on create. + :type start_date: datetime + :param end_date: The DateTime when the review is scheduled to end. + Required if type is endDate + :type end_date: datetime + """ + + _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'}, + 'mail_notifications_enabled': {'key': 'properties.mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'properties.reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'properties.defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'properties.justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'properties.defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'properties.autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'properties.recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'properties.instanceDurationInDays', 'type': 'int'}, + 'type1': {'key': 'properties.recurrence.pattern.type', 'type': 'str'}, + 'interval': {'key': 'properties.recurrence.pattern.interval', 'type': 'int'}, + 'type2': {'key': 'properties.recurrence.range.type', 'type': 'str'}, + 'number_of_occurrences': {'key': 'properties.recurrence.range.numberOfOccurrences', 'type': 'int'}, + 'start_date': {'key': 'properties.recurrence.range.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'properties.recurrence.range.endDate', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(AccessReviewDefaultSettings, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.mail_notifications_enabled = kwargs.get('mail_notifications_enabled', None) + self.reminder_notifications_enabled = kwargs.get('reminder_notifications_enabled', None) + self.default_decision_enabled = kwargs.get('default_decision_enabled', None) + self.justification_required_on_approval = kwargs.get('justification_required_on_approval', None) + self.default_decision = kwargs.get('default_decision', None) + self.auto_apply_decisions_enabled = kwargs.get('auto_apply_decisions_enabled', None) + self.recommendations_enabled = kwargs.get('recommendations_enabled', None) + self.instance_duration_in_days = kwargs.get('instance_duration_in_days', None) + self.type1 = kwargs.get('type1', None) + self.interval = kwargs.get('interval', None) + self.type2 = kwargs.get('type2', None) + self.number_of_occurrences = kwargs.get('number_of_occurrences', None) + self.start_date = kwargs.get('start_date', None) + self.end_date = kwargs.get('end_date', None) + + +class AccessReviewInstance(Model): + """Access Review Instance. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review instance id. + :vartype id: str + :ivar name: The access review instance name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar status: This read-only field specifies the status of an access + review instance. Possible values include: 'NotStarted', 'InProgress', + 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + :vartype status: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstanceStatus + :param start_date_time: The DateTime when the review instance is scheduled + to be start. + :type start_date_time: datetime + :param end_date_time: The DateTime when the review instance is scheduled + to end. + :type end_date_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'start_date_time': {'key': 'properties.startDateTime', 'type': 'iso-8601'}, + 'end_date_time': {'key': 'properties.endDateTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(AccessReviewInstance, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.status = None + self.start_date_time = kwargs.get('start_date_time', None) + self.end_date_time = kwargs.get('end_date_time', None) + + +class AccessReviewReviewer(Model): + """Descriptor for what needs to be reviewed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param principal_id: The id of the reviewer(user/servicePrincipal) + :type principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewReviewerType + """ + + _validation = { + 'principal_type': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'principal_type': {'key': 'principalType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AccessReviewReviewer, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.principal_type = None + + +class AccessReviewScheduleDefinition(Model): + """Access Review Schedule Definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review schedule definition id. + :vartype id: str + :ivar name: The access review schedule definition unique id. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param display_name: The display name for the schedule definition. + :type display_name: str + :ivar status: This read-only field specifies the status of an + accessReview. Possible values include: 'NotStarted', 'InProgress', + 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + :vartype status: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionStatus + :param description_for_admins: The description provided by the access + review creator and visible to admins. + :type description_for_admins: str + :param description_for_reviewers: The description provided by the access + review creator to be shown to reviewers. + :type description_for_reviewers: str + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param type1: The recurrence type : weekly, monthly, etc. Possible values + include: 'weekly', 'absoluteMonthly' + :type type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrencePatternType + :param interval: The interval for recurrence. For a quarterly review, the + interval is 3 for type : absoluteMonthly. + :type interval: int + :param type2: The recurrence range type. The possible values are: endDate, + noEnd, numbered. Possible values include: 'endDate', 'noEnd', 'numbered' + :type type2: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrenceRangeType + :param number_of_occurrences: The number of times to repeat the access + review. Required and must be positive if type is numbered. + :type number_of_occurrences: int + :param start_date: The DateTime when the review is scheduled to be start. + This could be a date in the future. Required on create. + :type start_date: datetime + :param end_date: The DateTime when the review is scheduled to end. + Required if type is endDate + :type end_date: datetime + :ivar resource_id: ResourceId in which this review is getting created + :vartype resource_id: str + :ivar role_definition_id: This is used to indicate the role being reviewed + :vartype role_definition_id: str + :ivar principal_type1: The identity type user/servicePrincipal to review. + Possible values include: 'user', 'guestUser', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScopePrincipalType + :param reviewers: This is the collection of reviewers. + :type reviewers: + list[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewReviewer] + :param backup_reviewers: This is the collection of backup reviewers. + :type backup_reviewers: + list[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewReviewer] + :ivar reviewers_type: This field specifies the type of reviewers for a + review. Usually for a review, reviewers are explicitly assigned. However, + in some cases, the reviewers may not be assigned and instead be chosen + dynamically. For example managers review or self review. Possible values + include: 'Assigned', 'Self', 'Managers' + :vartype reviewers_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionReviewersType + :param instances: This is the collection of instances returned when one + does an expand on it. + :type instances: + list[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstance] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'role_definition_id': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'reviewers_type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'description_for_admins': {'key': 'properties.descriptionForAdmins', 'type': 'str'}, + 'description_for_reviewers': {'key': 'properties.descriptionForReviewers', 'type': 'str'}, + 'principal_id': {'key': 'properties.createdBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.createdBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'properties.createdBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'properties.createdBy.userPrincipalName', 'type': 'str'}, + 'mail_notifications_enabled': {'key': 'properties.settings.mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'properties.settings.reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'properties.settings.defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'properties.settings.justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'properties.settings.defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'properties.settings.autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'properties.settings.recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'properties.settings.instanceDurationInDays', 'type': 'int'}, + 'type1': {'key': 'properties.settings.recurrence.pattern.type', 'type': 'str'}, + 'interval': {'key': 'properties.settings.recurrence.pattern.interval', 'type': 'int'}, + 'type2': {'key': 'properties.settings.recurrence.range.type', 'type': 'str'}, + 'number_of_occurrences': {'key': 'properties.settings.recurrence.range.numberOfOccurrences', 'type': 'int'}, + 'start_date': {'key': 'properties.settings.recurrence.range.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'properties.settings.recurrence.range.endDate', 'type': 'iso-8601'}, + 'resource_id': {'key': 'properties.scope.resourceId', 'type': 'str'}, + 'role_definition_id': {'key': 'properties.scope.roleDefinitionId', 'type': 'str'}, + 'principal_type1': {'key': 'properties.scope.principalType', 'type': 'str'}, + 'reviewers': {'key': 'properties.reviewers', 'type': '[AccessReviewReviewer]'}, + 'backup_reviewers': {'key': 'properties.backupReviewers', 'type': '[AccessReviewReviewer]'}, + 'reviewers_type': {'key': 'properties.reviewersType', 'type': 'str'}, + 'instances': {'key': 'properties.instances', 'type': '[AccessReviewInstance]'}, + } + + def __init__(self, **kwargs): + super(AccessReviewScheduleDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.display_name = kwargs.get('display_name', None) + self.status = None + self.description_for_admins = kwargs.get('description_for_admins', None) + self.description_for_reviewers = kwargs.get('description_for_reviewers', None) + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.mail_notifications_enabled = kwargs.get('mail_notifications_enabled', None) + self.reminder_notifications_enabled = kwargs.get('reminder_notifications_enabled', None) + self.default_decision_enabled = kwargs.get('default_decision_enabled', None) + self.justification_required_on_approval = kwargs.get('justification_required_on_approval', None) + self.default_decision = kwargs.get('default_decision', None) + self.auto_apply_decisions_enabled = kwargs.get('auto_apply_decisions_enabled', None) + self.recommendations_enabled = kwargs.get('recommendations_enabled', None) + self.instance_duration_in_days = kwargs.get('instance_duration_in_days', None) + self.type1 = kwargs.get('type1', None) + self.interval = kwargs.get('interval', None) + self.type2 = kwargs.get('type2', None) + self.number_of_occurrences = kwargs.get('number_of_occurrences', None) + self.start_date = kwargs.get('start_date', None) + self.end_date = kwargs.get('end_date', None) + self.resource_id = None + self.role_definition_id = None + self.principal_type1 = None + self.reviewers = kwargs.get('reviewers', None) + self.backup_reviewers = kwargs.get('backup_reviewers', None) + self.reviewers_type = None + self.instances = kwargs.get('instances', None) + + +class AccessReviewScheduleDefinitionProperties(Model): + """Access Review. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param display_name: The display name for the schedule definition. + :type display_name: str + :ivar status: This read-only field specifies the status of an + accessReview. Possible values include: 'NotStarted', 'InProgress', + 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + :vartype status: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionStatus + :param description_for_admins: The description provided by the access + review creator and visible to admins. + :type description_for_admins: str + :param description_for_reviewers: The description provided by the access + review creator to be shown to reviewers. + :type description_for_reviewers: str + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param type: The recurrence type : weekly, monthly, etc. Possible values + include: 'weekly', 'absoluteMonthly' + :type type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrencePatternType + :param interval: The interval for recurrence. For a quarterly review, the + interval is 3 for type : absoluteMonthly. + :type interval: int + :param type1: The recurrence range type. The possible values are: endDate, + noEnd, numbered. Possible values include: 'endDate', 'noEnd', 'numbered' + :type type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrenceRangeType + :param number_of_occurrences: The number of times to repeat the access + review. Required and must be positive if type is numbered. + :type number_of_occurrences: int + :param start_date: The DateTime when the review is scheduled to be start. + This could be a date in the future. Required on create. + :type start_date: datetime + :param end_date: The DateTime when the review is scheduled to end. + Required if type is endDate + :type end_date: datetime + :ivar resource_id: ResourceId in which this review is getting created + :vartype resource_id: str + :ivar role_definition_id: This is used to indicate the role being reviewed + :vartype role_definition_id: str + :ivar principal_type1: The identity type user/servicePrincipal to review. + Possible values include: 'user', 'guestUser', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScopePrincipalType + :param reviewers: This is the collection of reviewers. + :type reviewers: + list[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewReviewer] + :param backup_reviewers: This is the collection of backup reviewers. + :type backup_reviewers: + list[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewReviewer] + :ivar reviewers_type: This field specifies the type of reviewers for a + review. Usually for a review, reviewers are explicitly assigned. However, + in some cases, the reviewers may not be assigned and instead be chosen + dynamically. For example managers review or self review. Possible values + include: 'Assigned', 'Self', 'Managers' + :vartype reviewers_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionReviewersType + :param instances: This is the collection of instances returned when one + does an expand on it. + :type instances: + list[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstance] + """ + + _validation = { + 'status': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'role_definition_id': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'reviewers_type': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'description_for_admins': {'key': 'descriptionForAdmins', 'type': 'str'}, + 'description_for_reviewers': {'key': 'descriptionForReviewers', 'type': 'str'}, + 'principal_id': {'key': 'createdBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'createdBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'createdBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'createdBy.userPrincipalName', 'type': 'str'}, + 'mail_notifications_enabled': {'key': 'settings.mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'settings.reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'settings.defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'settings.justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'settings.defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'settings.autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'settings.recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'settings.instanceDurationInDays', 'type': 'int'}, + 'type': {'key': 'settings.recurrence.pattern.type', 'type': 'str'}, + 'interval': {'key': 'settings.recurrence.pattern.interval', 'type': 'int'}, + 'type1': {'key': 'settings.recurrence.range.type', 'type': 'str'}, + 'number_of_occurrences': {'key': 'settings.recurrence.range.numberOfOccurrences', 'type': 'int'}, + 'start_date': {'key': 'settings.recurrence.range.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'settings.recurrence.range.endDate', 'type': 'iso-8601'}, + 'resource_id': {'key': 'scope.resourceId', 'type': 'str'}, + 'role_definition_id': {'key': 'scope.roleDefinitionId', 'type': 'str'}, + 'principal_type1': {'key': 'scope.principalType', 'type': 'str'}, + 'reviewers': {'key': 'reviewers', 'type': '[AccessReviewReviewer]'}, + 'backup_reviewers': {'key': 'backupReviewers', 'type': '[AccessReviewReviewer]'}, + 'reviewers_type': {'key': 'reviewersType', 'type': 'str'}, + 'instances': {'key': 'instances', 'type': '[AccessReviewInstance]'}, + } + + def __init__(self, **kwargs): + super(AccessReviewScheduleDefinitionProperties, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.status = None + self.description_for_admins = kwargs.get('description_for_admins', None) + self.description_for_reviewers = kwargs.get('description_for_reviewers', None) + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.mail_notifications_enabled = kwargs.get('mail_notifications_enabled', None) + self.reminder_notifications_enabled = kwargs.get('reminder_notifications_enabled', None) + self.default_decision_enabled = kwargs.get('default_decision_enabled', None) + self.justification_required_on_approval = kwargs.get('justification_required_on_approval', None) + self.default_decision = kwargs.get('default_decision', None) + self.auto_apply_decisions_enabled = kwargs.get('auto_apply_decisions_enabled', None) + self.recommendations_enabled = kwargs.get('recommendations_enabled', None) + self.instance_duration_in_days = kwargs.get('instance_duration_in_days', None) + self.type = kwargs.get('type', None) + self.interval = kwargs.get('interval', None) + self.type1 = kwargs.get('type1', None) + self.number_of_occurrences = kwargs.get('number_of_occurrences', None) + self.start_date = kwargs.get('start_date', None) + self.end_date = kwargs.get('end_date', None) + self.resource_id = None + self.role_definition_id = None + self.principal_type1 = None + self.reviewers = kwargs.get('reviewers', None) + self.backup_reviewers = kwargs.get('backup_reviewers', None) + self.reviewers_type = None + self.instances = kwargs.get('instances', None) + + +class AccessReviewScheduleSettings(Model): + """Settings of an Access Review. + + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param recurrence: Access Review Settings. + :type recurrence: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrenceSettings + """ + + _attribute_map = { + 'mail_notifications_enabled': {'key': 'mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'instanceDurationInDays', 'type': 'int'}, + 'recurrence': {'key': 'recurrence', 'type': 'AccessReviewRecurrenceSettings'}, + } + + def __init__(self, **kwargs): + super(AccessReviewScheduleSettings, self).__init__(**kwargs) + self.mail_notifications_enabled = kwargs.get('mail_notifications_enabled', None) + self.reminder_notifications_enabled = kwargs.get('reminder_notifications_enabled', None) + self.default_decision_enabled = kwargs.get('default_decision_enabled', None) + self.justification_required_on_approval = kwargs.get('justification_required_on_approval', None) + self.default_decision = kwargs.get('default_decision', None) + self.auto_apply_decisions_enabled = kwargs.get('auto_apply_decisions_enabled', None) + self.recommendations_enabled = kwargs.get('recommendations_enabled', None) + self.instance_duration_in_days = kwargs.get('instance_duration_in_days', None) + self.recurrence = kwargs.get('recurrence', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorDefinition(Model): + """Error. + + Error description and code explaining why an operation failed. + + :param error: Error of the list gateway status. + :type error: + ~azure.mgmt.authorization.v2021_03_01_preview.models.ErrorDefinitionProperties + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinitionProperties'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinition, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorDefinitionException(HttpOperationError): + """Server responsed with exception of type: 'ErrorDefinition'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorDefinitionException, self).__init__(deserialize, response, 'ErrorDefinition', *args) + + +class ErrorDefinitionProperties(Model): + """Error. + + Error description and code explaining why an operation failed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar message: Description of the error. + :vartype message: str + :param code: Error code of list gateway. + :type code: str + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinitionProperties, self).__init__(**kwargs) + self.message = None + self.code = kwargs.get('code', None) + + +class Operation(Model): + """The definition of a Microsoft.Authorization operation. + + :param name: Name of the operation + :type name: str + :param is_data_action: Indicates whether the operation is a data action + :type is_data_action: bool + :param display: Display of the operation + :type display: + ~azure.mgmt.authorization.v2021_03_01_preview.models.OperationDisplay + :param origin: Origin of the operation + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + + +class OperationDisplay(Model): + """The display information for a Microsoft.Authorization operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: The resource provider name: Microsoft.Authorization. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models_py3.py new file mode 100644 index 0000000000000..3a54818c05497 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_models_py3.py @@ -0,0 +1,1160 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class AccessReviewDecision(Model): + """Access Review. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review decision id. + :vartype id: str + :ivar name: The access review decision name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar id1: The id of principal whose access was reviewed. + :vartype id1: str + :ivar display_name: The display name of the user whose access was + reviewed. + :vartype display_name: str + :ivar id2: The id of resource associated with a decision record. + :vartype id2: str + :ivar display_name1: The display name of resource associated with a + decision record. + :vartype display_name1: str + :ivar recommendation: The feature- generated recommendation shown to the + reviewer. Possible values include: 'Approve', 'Deny', 'NoInfoAvailable' + :vartype recommendation: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessRecommendationType + :param decision: The decision on the approval step. This value is + initially set to NotReviewed. Approvers can take action of Approve/Deny. + Possible values include: 'Approve', 'Deny', 'NotReviewed', 'DontKnow', + 'NotNotified' + :type decision: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewResult + :param justification: Justification provided by approvers for their action + :type justification: str + :ivar reviewed_date_time: Date Time when a decision was taken. + :vartype reviewed_date_time: datetime + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :ivar apply_result: The outcome of applying the decision. Possible values + include: 'New', 'Applying', 'AppliedSuccessfully', + 'AppliedWithUnknownFailure', 'AppliedSuccessfullyButObjectNotFound', + 'ApplyNotSupported' + :vartype apply_result: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewApplyResult + :ivar applied_date_time: The date and time when the review decision was + applied. + :vartype applied_date_time: datetime + :ivar principal_id1: The identity id + :vartype principal_id1: str + :ivar principal_type1: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name1: The identity display name + :vartype principal_name1: str + :ivar user_principal_name1: The user principal name(if valid) + :vartype user_principal_name1: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'id1': {'readonly': True}, + 'display_name': {'readonly': True}, + 'id2': {'readonly': True}, + 'display_name1': {'readonly': True}, + 'recommendation': {'readonly': True}, + 'reviewed_date_time': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'apply_result': {'readonly': True}, + 'applied_date_time': {'readonly': True}, + 'principal_id1': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'principal_name1': {'readonly': True}, + 'user_principal_name1': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'id1': {'key': 'properties.principal.id', 'type': 'str'}, + 'display_name': {'key': 'properties.principal.displayName', 'type': 'str'}, + 'id2': {'key': 'properties.resource.id', 'type': 'str'}, + 'display_name1': {'key': 'properties.resource.displayName', 'type': 'str'}, + 'recommendation': {'key': 'properties.recommendation', 'type': 'str'}, + 'decision': {'key': 'properties.decision', 'type': 'str'}, + 'justification': {'key': 'properties.justification', 'type': 'str'}, + 'reviewed_date_time': {'key': 'properties.reviewedDateTime', 'type': 'iso-8601'}, + 'principal_id': {'key': 'properties.reviewedBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.reviewedBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'properties.reviewedBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'properties.reviewedBy.userPrincipalName', 'type': 'str'}, + 'apply_result': {'key': 'properties.applyResult', 'type': 'str'}, + 'applied_date_time': {'key': 'properties.appliedDateTime', 'type': 'iso-8601'}, + 'principal_id1': {'key': 'properties.appliedBy.principalId', 'type': 'str'}, + 'principal_type1': {'key': 'properties.appliedBy.principalType', 'type': 'str'}, + 'principal_name1': {'key': 'properties.appliedBy.principalName', 'type': 'str'}, + 'user_principal_name1': {'key': 'properties.appliedBy.userPrincipalName', 'type': 'str'}, + } + + def __init__(self, *, decision=None, justification: str=None, **kwargs) -> None: + super(AccessReviewDecision, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.id1 = None + self.display_name = None + self.id2 = None + self.display_name1 = None + self.recommendation = None + self.decision = decision + self.justification = justification + self.reviewed_date_time = None + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.apply_result = None + self.applied_date_time = None + self.principal_id1 = None + self.principal_type1 = None + self.principal_name1 = None + self.user_principal_name1 = None + + +class AccessReviewDecisionIdentity(Model): + """Target of the decision. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AccessReviewDecisionUserIdentity, + AccessReviewDecisionServicePrincipalIdentity + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The id of principal whose access was reviewed. + :vartype id: str + :ivar display_name: The display name of the user whose access was + reviewed. + :vartype display_name: str + :param type: Required. Constant filled by server. + :type type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'display_name': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'user': 'AccessReviewDecisionUserIdentity', 'servicePrincipal': 'AccessReviewDecisionServicePrincipalIdentity'} + } + + def __init__(self, **kwargs) -> None: + super(AccessReviewDecisionIdentity, self).__init__(**kwargs) + self.id = None + self.display_name = None + self.type = None + + +class AccessReviewDecisionProperties(Model): + """Approval Step. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The id of principal whose access was reviewed. + :vartype id: str + :ivar display_name: The display name of the user whose access was + reviewed. + :vartype display_name: str + :ivar id1: The id of resource associated with a decision record. + :vartype id1: str + :ivar display_name1: The display name of resource associated with a + decision record. + :vartype display_name1: str + :ivar recommendation: The feature- generated recommendation shown to the + reviewer. Possible values include: 'Approve', 'Deny', 'NoInfoAvailable' + :vartype recommendation: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessRecommendationType + :param decision: The decision on the approval step. This value is + initially set to NotReviewed. Approvers can take action of Approve/Deny. + Possible values include: 'Approve', 'Deny', 'NotReviewed', 'DontKnow', + 'NotNotified' + :type decision: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewResult + :param justification: Justification provided by approvers for their action + :type justification: str + :ivar reviewed_date_time: Date Time when a decision was taken. + :vartype reviewed_date_time: datetime + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :ivar apply_result: The outcome of applying the decision. Possible values + include: 'New', 'Applying', 'AppliedSuccessfully', + 'AppliedWithUnknownFailure', 'AppliedSuccessfullyButObjectNotFound', + 'ApplyNotSupported' + :vartype apply_result: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewApplyResult + :ivar applied_date_time: The date and time when the review decision was + applied. + :vartype applied_date_time: datetime + :ivar principal_id1: The identity id + :vartype principal_id1: str + :ivar principal_type1: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name1: The identity display name + :vartype principal_name1: str + :ivar user_principal_name1: The user principal name(if valid) + :vartype user_principal_name1: str + """ + + _validation = { + 'id': {'readonly': True}, + 'display_name': {'readonly': True}, + 'id1': {'readonly': True}, + 'display_name1': {'readonly': True}, + 'recommendation': {'readonly': True}, + 'reviewed_date_time': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'apply_result': {'readonly': True}, + 'applied_date_time': {'readonly': True}, + 'principal_id1': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'principal_name1': {'readonly': True}, + 'user_principal_name1': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'principal.id', 'type': 'str'}, + 'display_name': {'key': 'principal.displayName', 'type': 'str'}, + 'id1': {'key': 'resource.id', 'type': 'str'}, + 'display_name1': {'key': 'resource.displayName', 'type': 'str'}, + 'recommendation': {'key': 'recommendation', 'type': 'str'}, + 'decision': {'key': 'decision', 'type': 'str'}, + 'justification': {'key': 'justification', 'type': 'str'}, + 'reviewed_date_time': {'key': 'reviewedDateTime', 'type': 'iso-8601'}, + 'principal_id': {'key': 'reviewedBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'reviewedBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'reviewedBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'reviewedBy.userPrincipalName', 'type': 'str'}, + 'apply_result': {'key': 'applyResult', 'type': 'str'}, + 'applied_date_time': {'key': 'appliedDateTime', 'type': 'iso-8601'}, + 'principal_id1': {'key': 'appliedBy.principalId', 'type': 'str'}, + 'principal_type1': {'key': 'appliedBy.principalType', 'type': 'str'}, + 'principal_name1': {'key': 'appliedBy.principalName', 'type': 'str'}, + 'user_principal_name1': {'key': 'appliedBy.userPrincipalName', 'type': 'str'}, + } + + def __init__(self, *, decision=None, justification: str=None, **kwargs) -> None: + super(AccessReviewDecisionProperties, self).__init__(**kwargs) + self.id = None + self.display_name = None + self.id1 = None + self.display_name1 = None + self.recommendation = None + self.decision = decision + self.justification = justification + self.reviewed_date_time = None + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.apply_result = None + self.applied_date_time = None + self.principal_id1 = None + self.principal_type1 = None + self.principal_name1 = None + self.user_principal_name1 = None + + +class AccessReviewDecisionServicePrincipalIdentity(AccessReviewDecisionIdentity): + """Service Principal Decision Target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The id of principal whose access was reviewed. + :vartype id: str + :ivar display_name: The display name of the user whose access was + reviewed. + :vartype display_name: str + :param type: Required. Constant filled by server. + :type type: str + :ivar app_id: The appId for the service principal entity being reviewed + :vartype app_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'display_name': {'readonly': True}, + 'type': {'required': True}, + 'app_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'app_id': {'key': 'appId', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(AccessReviewDecisionServicePrincipalIdentity, self).__init__(**kwargs) + self.app_id = None + self.type = 'servicePrincipal' + + +class AccessReviewDecisionUserIdentity(AccessReviewDecisionIdentity): + """User Decision Target. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The id of principal whose access was reviewed. + :vartype id: str + :ivar display_name: The display name of the user whose access was + reviewed. + :vartype display_name: str + :param type: Required. Constant filled by server. + :type type: str + :ivar user_principal_name: The user principal name of the user whose + access was reviewed. + :vartype user_principal_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'display_name': {'readonly': True}, + 'type': {'required': True}, + 'user_principal_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_principal_name': {'key': 'userPrincipalName', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(AccessReviewDecisionUserIdentity, self).__init__(**kwargs) + self.user_principal_name = None + self.type = 'user' + + +class AccessReviewDefaultSettings(Model): + """Access Review Default Settings. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review default settings id. This is only going to be + default + :vartype id: str + :ivar name: The access review default settings name. This is always going + to be Access Review Default Settings + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param type1: The recurrence type : weekly, monthly, etc. Possible values + include: 'weekly', 'absoluteMonthly' + :type type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrencePatternType + :param interval: The interval for recurrence. For a quarterly review, the + interval is 3 for type : absoluteMonthly. + :type interval: int + :param type2: The recurrence range type. The possible values are: endDate, + noEnd, numbered. Possible values include: 'endDate', 'noEnd', 'numbered' + :type type2: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrenceRangeType + :param number_of_occurrences: The number of times to repeat the access + review. Required and must be positive if type is numbered. + :type number_of_occurrences: int + :param start_date: The DateTime when the review is scheduled to be start. + This could be a date in the future. Required on create. + :type start_date: datetime + :param end_date: The DateTime when the review is scheduled to end. + Required if type is endDate + :type end_date: datetime + """ + + _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'}, + 'mail_notifications_enabled': {'key': 'properties.mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'properties.reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'properties.defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'properties.justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'properties.defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'properties.autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'properties.recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'properties.instanceDurationInDays', 'type': 'int'}, + 'type1': {'key': 'properties.recurrence.pattern.type', 'type': 'str'}, + 'interval': {'key': 'properties.recurrence.pattern.interval', 'type': 'int'}, + 'type2': {'key': 'properties.recurrence.range.type', 'type': 'str'}, + 'number_of_occurrences': {'key': 'properties.recurrence.range.numberOfOccurrences', 'type': 'int'}, + 'start_date': {'key': 'properties.recurrence.range.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'properties.recurrence.range.endDate', 'type': 'iso-8601'}, + } + + def __init__(self, *, mail_notifications_enabled: bool=None, reminder_notifications_enabled: bool=None, default_decision_enabled: bool=None, justification_required_on_approval: bool=None, default_decision=None, auto_apply_decisions_enabled: bool=None, recommendations_enabled: bool=None, instance_duration_in_days: int=None, type1=None, interval: int=None, type2=None, number_of_occurrences: int=None, start_date=None, end_date=None, **kwargs) -> None: + super(AccessReviewDefaultSettings, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.mail_notifications_enabled = mail_notifications_enabled + self.reminder_notifications_enabled = reminder_notifications_enabled + self.default_decision_enabled = default_decision_enabled + self.justification_required_on_approval = justification_required_on_approval + self.default_decision = default_decision + self.auto_apply_decisions_enabled = auto_apply_decisions_enabled + self.recommendations_enabled = recommendations_enabled + self.instance_duration_in_days = instance_duration_in_days + self.type1 = type1 + self.interval = interval + self.type2 = type2 + self.number_of_occurrences = number_of_occurrences + self.start_date = start_date + self.end_date = end_date + + +class AccessReviewInstance(Model): + """Access Review Instance. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review instance id. + :vartype id: str + :ivar name: The access review instance name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar status: This read-only field specifies the status of an access + review instance. Possible values include: 'NotStarted', 'InProgress', + 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + :vartype status: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstanceStatus + :param start_date_time: The DateTime when the review instance is scheduled + to be start. + :type start_date_time: datetime + :param end_date_time: The DateTime when the review instance is scheduled + to end. + :type end_date_time: datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'start_date_time': {'key': 'properties.startDateTime', 'type': 'iso-8601'}, + 'end_date_time': {'key': 'properties.endDateTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, start_date_time=None, end_date_time=None, **kwargs) -> None: + super(AccessReviewInstance, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.status = None + self.start_date_time = start_date_time + self.end_date_time = end_date_time + + +class AccessReviewReviewer(Model): + """Descriptor for what needs to be reviewed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param principal_id: The id of the reviewer(user/servicePrincipal) + :type principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewReviewerType + """ + + _validation = { + 'principal_type': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'principal_type': {'key': 'principalType', 'type': 'str'}, + } + + def __init__(self, *, principal_id: str=None, **kwargs) -> None: + super(AccessReviewReviewer, self).__init__(**kwargs) + self.principal_id = principal_id + self.principal_type = None + + +class AccessReviewScheduleDefinition(Model): + """Access Review Schedule Definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The access review schedule definition id. + :vartype id: str + :ivar name: The access review schedule definition unique id. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param display_name: The display name for the schedule definition. + :type display_name: str + :ivar status: This read-only field specifies the status of an + accessReview. Possible values include: 'NotStarted', 'InProgress', + 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + :vartype status: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionStatus + :param description_for_admins: The description provided by the access + review creator and visible to admins. + :type description_for_admins: str + :param description_for_reviewers: The description provided by the access + review creator to be shown to reviewers. + :type description_for_reviewers: str + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param type1: The recurrence type : weekly, monthly, etc. Possible values + include: 'weekly', 'absoluteMonthly' + :type type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrencePatternType + :param interval: The interval for recurrence. For a quarterly review, the + interval is 3 for type : absoluteMonthly. + :type interval: int + :param type2: The recurrence range type. The possible values are: endDate, + noEnd, numbered. Possible values include: 'endDate', 'noEnd', 'numbered' + :type type2: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrenceRangeType + :param number_of_occurrences: The number of times to repeat the access + review. Required and must be positive if type is numbered. + :type number_of_occurrences: int + :param start_date: The DateTime when the review is scheduled to be start. + This could be a date in the future. Required on create. + :type start_date: datetime + :param end_date: The DateTime when the review is scheduled to end. + Required if type is endDate + :type end_date: datetime + :ivar resource_id: ResourceId in which this review is getting created + :vartype resource_id: str + :ivar role_definition_id: This is used to indicate the role being reviewed + :vartype role_definition_id: str + :ivar principal_type1: The identity type user/servicePrincipal to review. + Possible values include: 'user', 'guestUser', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScopePrincipalType + :param reviewers: This is the collection of reviewers. + :type reviewers: + list[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewReviewer] + :param backup_reviewers: This is the collection of backup reviewers. + :type backup_reviewers: + list[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewReviewer] + :ivar reviewers_type: This field specifies the type of reviewers for a + review. Usually for a review, reviewers are explicitly assigned. However, + in some cases, the reviewers may not be assigned and instead be chosen + dynamically. For example managers review or self review. Possible values + include: 'Assigned', 'Self', 'Managers' + :vartype reviewers_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionReviewersType + :param instances: This is the collection of instances returned when one + does an expand on it. + :type instances: + list[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstance] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'role_definition_id': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'reviewers_type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'description_for_admins': {'key': 'properties.descriptionForAdmins', 'type': 'str'}, + 'description_for_reviewers': {'key': 'properties.descriptionForReviewers', 'type': 'str'}, + 'principal_id': {'key': 'properties.createdBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'properties.createdBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'properties.createdBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'properties.createdBy.userPrincipalName', 'type': 'str'}, + 'mail_notifications_enabled': {'key': 'properties.settings.mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'properties.settings.reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'properties.settings.defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'properties.settings.justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'properties.settings.defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'properties.settings.autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'properties.settings.recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'properties.settings.instanceDurationInDays', 'type': 'int'}, + 'type1': {'key': 'properties.settings.recurrence.pattern.type', 'type': 'str'}, + 'interval': {'key': 'properties.settings.recurrence.pattern.interval', 'type': 'int'}, + 'type2': {'key': 'properties.settings.recurrence.range.type', 'type': 'str'}, + 'number_of_occurrences': {'key': 'properties.settings.recurrence.range.numberOfOccurrences', 'type': 'int'}, + 'start_date': {'key': 'properties.settings.recurrence.range.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'properties.settings.recurrence.range.endDate', 'type': 'iso-8601'}, + 'resource_id': {'key': 'properties.scope.resourceId', 'type': 'str'}, + 'role_definition_id': {'key': 'properties.scope.roleDefinitionId', 'type': 'str'}, + 'principal_type1': {'key': 'properties.scope.principalType', 'type': 'str'}, + 'reviewers': {'key': 'properties.reviewers', 'type': '[AccessReviewReviewer]'}, + 'backup_reviewers': {'key': 'properties.backupReviewers', 'type': '[AccessReviewReviewer]'}, + 'reviewers_type': {'key': 'properties.reviewersType', 'type': 'str'}, + 'instances': {'key': 'properties.instances', 'type': '[AccessReviewInstance]'}, + } + + def __init__(self, *, display_name: str=None, description_for_admins: str=None, description_for_reviewers: str=None, mail_notifications_enabled: bool=None, reminder_notifications_enabled: bool=None, default_decision_enabled: bool=None, justification_required_on_approval: bool=None, default_decision=None, auto_apply_decisions_enabled: bool=None, recommendations_enabled: bool=None, instance_duration_in_days: int=None, type1=None, interval: int=None, type2=None, number_of_occurrences: int=None, start_date=None, end_date=None, reviewers=None, backup_reviewers=None, instances=None, **kwargs) -> None: + super(AccessReviewScheduleDefinition, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.display_name = display_name + self.status = None + self.description_for_admins = description_for_admins + self.description_for_reviewers = description_for_reviewers + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.mail_notifications_enabled = mail_notifications_enabled + self.reminder_notifications_enabled = reminder_notifications_enabled + self.default_decision_enabled = default_decision_enabled + self.justification_required_on_approval = justification_required_on_approval + self.default_decision = default_decision + self.auto_apply_decisions_enabled = auto_apply_decisions_enabled + self.recommendations_enabled = recommendations_enabled + self.instance_duration_in_days = instance_duration_in_days + self.type1 = type1 + self.interval = interval + self.type2 = type2 + self.number_of_occurrences = number_of_occurrences + self.start_date = start_date + self.end_date = end_date + self.resource_id = None + self.role_definition_id = None + self.principal_type1 = None + self.reviewers = reviewers + self.backup_reviewers = backup_reviewers + self.reviewers_type = None + self.instances = instances + + +class AccessReviewScheduleDefinitionProperties(Model): + """Access Review. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param display_name: The display name for the schedule definition. + :type display_name: str + :ivar status: This read-only field specifies the status of an + accessReview. Possible values include: 'NotStarted', 'InProgress', + 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + :vartype status: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionStatus + :param description_for_admins: The description provided by the access + review creator and visible to admins. + :type description_for_admins: str + :param description_for_reviewers: The description provided by the access + review creator to be shown to reviewers. + :type description_for_reviewers: str + :ivar principal_id: The identity id + :vartype principal_id: str + :ivar principal_type: The identity type : user/servicePrincipal. Possible + values include: 'user', 'servicePrincipal' + :vartype principal_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewActorIdentityType + :ivar principal_name: The identity display name + :vartype principal_name: str + :ivar user_principal_name: The user principal name(if valid) + :vartype user_principal_name: str + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param type: The recurrence type : weekly, monthly, etc. Possible values + include: 'weekly', 'absoluteMonthly' + :type type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrencePatternType + :param interval: The interval for recurrence. For a quarterly review, the + interval is 3 for type : absoluteMonthly. + :type interval: int + :param type1: The recurrence range type. The possible values are: endDate, + noEnd, numbered. Possible values include: 'endDate', 'noEnd', 'numbered' + :type type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrenceRangeType + :param number_of_occurrences: The number of times to repeat the access + review. Required and must be positive if type is numbered. + :type number_of_occurrences: int + :param start_date: The DateTime when the review is scheduled to be start. + This could be a date in the future. Required on create. + :type start_date: datetime + :param end_date: The DateTime when the review is scheduled to end. + Required if type is endDate + :type end_date: datetime + :ivar resource_id: ResourceId in which this review is getting created + :vartype resource_id: str + :ivar role_definition_id: This is used to indicate the role being reviewed + :vartype role_definition_id: str + :ivar principal_type1: The identity type user/servicePrincipal to review. + Possible values include: 'user', 'guestUser', 'servicePrincipal' + :vartype principal_type1: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScopePrincipalType + :param reviewers: This is the collection of reviewers. + :type reviewers: + list[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewReviewer] + :param backup_reviewers: This is the collection of backup reviewers. + :type backup_reviewers: + list[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewReviewer] + :ivar reviewers_type: This field specifies the type of reviewers for a + review. Usually for a review, reviewers are explicitly assigned. However, + in some cases, the reviewers may not be assigned and instead be chosen + dynamically. For example managers review or self review. Possible values + include: 'Assigned', 'Self', 'Managers' + :vartype reviewers_type: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionReviewersType + :param instances: This is the collection of instances returned when one + does an expand on it. + :type instances: + list[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstance] + """ + + _validation = { + 'status': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'principal_type': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'user_principal_name': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'role_definition_id': {'readonly': True}, + 'principal_type1': {'readonly': True}, + 'reviewers_type': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'description_for_admins': {'key': 'descriptionForAdmins', 'type': 'str'}, + 'description_for_reviewers': {'key': 'descriptionForReviewers', 'type': 'str'}, + 'principal_id': {'key': 'createdBy.principalId', 'type': 'str'}, + 'principal_type': {'key': 'createdBy.principalType', 'type': 'str'}, + 'principal_name': {'key': 'createdBy.principalName', 'type': 'str'}, + 'user_principal_name': {'key': 'createdBy.userPrincipalName', 'type': 'str'}, + 'mail_notifications_enabled': {'key': 'settings.mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'settings.reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'settings.defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'settings.justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'settings.defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'settings.autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'settings.recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'settings.instanceDurationInDays', 'type': 'int'}, + 'type': {'key': 'settings.recurrence.pattern.type', 'type': 'str'}, + 'interval': {'key': 'settings.recurrence.pattern.interval', 'type': 'int'}, + 'type1': {'key': 'settings.recurrence.range.type', 'type': 'str'}, + 'number_of_occurrences': {'key': 'settings.recurrence.range.numberOfOccurrences', 'type': 'int'}, + 'start_date': {'key': 'settings.recurrence.range.startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'settings.recurrence.range.endDate', 'type': 'iso-8601'}, + 'resource_id': {'key': 'scope.resourceId', 'type': 'str'}, + 'role_definition_id': {'key': 'scope.roleDefinitionId', 'type': 'str'}, + 'principal_type1': {'key': 'scope.principalType', 'type': 'str'}, + 'reviewers': {'key': 'reviewers', 'type': '[AccessReviewReviewer]'}, + 'backup_reviewers': {'key': 'backupReviewers', 'type': '[AccessReviewReviewer]'}, + 'reviewers_type': {'key': 'reviewersType', 'type': 'str'}, + 'instances': {'key': 'instances', 'type': '[AccessReviewInstance]'}, + } + + def __init__(self, *, display_name: str=None, description_for_admins: str=None, description_for_reviewers: str=None, mail_notifications_enabled: bool=None, reminder_notifications_enabled: bool=None, default_decision_enabled: bool=None, justification_required_on_approval: bool=None, default_decision=None, auto_apply_decisions_enabled: bool=None, recommendations_enabled: bool=None, instance_duration_in_days: int=None, type=None, interval: int=None, type1=None, number_of_occurrences: int=None, start_date=None, end_date=None, reviewers=None, backup_reviewers=None, instances=None, **kwargs) -> None: + super(AccessReviewScheduleDefinitionProperties, self).__init__(**kwargs) + self.display_name = display_name + self.status = None + self.description_for_admins = description_for_admins + self.description_for_reviewers = description_for_reviewers + self.principal_id = None + self.principal_type = None + self.principal_name = None + self.user_principal_name = None + self.mail_notifications_enabled = mail_notifications_enabled + self.reminder_notifications_enabled = reminder_notifications_enabled + self.default_decision_enabled = default_decision_enabled + self.justification_required_on_approval = justification_required_on_approval + self.default_decision = default_decision + self.auto_apply_decisions_enabled = auto_apply_decisions_enabled + self.recommendations_enabled = recommendations_enabled + self.instance_duration_in_days = instance_duration_in_days + self.type = type + self.interval = interval + self.type1 = type1 + self.number_of_occurrences = number_of_occurrences + self.start_date = start_date + self.end_date = end_date + self.resource_id = None + self.role_definition_id = None + self.principal_type1 = None + self.reviewers = reviewers + self.backup_reviewers = backup_reviewers + self.reviewers_type = None + self.instances = instances + + +class AccessReviewScheduleSettings(Model): + """Settings of an Access Review. + + :param mail_notifications_enabled: Flag to indicate whether sending mails + to reviewers and the review creator is enabled. + :type mail_notifications_enabled: bool + :param reminder_notifications_enabled: Flag to indicate whether sending + reminder emails to reviewers are enabled. + :type reminder_notifications_enabled: bool + :param default_decision_enabled: Flag to indicate whether reviewers are + required to provide a justification when reviewing access. + :type default_decision_enabled: bool + :param justification_required_on_approval: Flag to indicate whether the + reviewer is required to pass justification when recording a decision. + :type justification_required_on_approval: bool + :param default_decision: This specifies the behavior for the autoReview + feature when an access review completes. Possible values include: + 'Approve', 'Deny', 'Recommendation' + :type default_decision: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.DefaultDecisionType + :param auto_apply_decisions_enabled: Flag to indicate whether auto-apply + capability, to automatically change the target object access resource, is + enabled. If not enabled, a user must, after the review completes, apply + the access review. + :type auto_apply_decisions_enabled: bool + :param recommendations_enabled: Flag to indicate whether showing + recommendations to reviewers is enabled. + :type recommendations_enabled: bool + :param instance_duration_in_days: The duration in days for an instance. + :type instance_duration_in_days: int + :param recurrence: Access Review Settings. + :type recurrence: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewRecurrenceSettings + """ + + _attribute_map = { + 'mail_notifications_enabled': {'key': 'mailNotificationsEnabled', 'type': 'bool'}, + 'reminder_notifications_enabled': {'key': 'reminderNotificationsEnabled', 'type': 'bool'}, + 'default_decision_enabled': {'key': 'defaultDecisionEnabled', 'type': 'bool'}, + 'justification_required_on_approval': {'key': 'justificationRequiredOnApproval', 'type': 'bool'}, + 'default_decision': {'key': 'defaultDecision', 'type': 'str'}, + 'auto_apply_decisions_enabled': {'key': 'autoApplyDecisionsEnabled', 'type': 'bool'}, + 'recommendations_enabled': {'key': 'recommendationsEnabled', 'type': 'bool'}, + 'instance_duration_in_days': {'key': 'instanceDurationInDays', 'type': 'int'}, + 'recurrence': {'key': 'recurrence', 'type': 'AccessReviewRecurrenceSettings'}, + } + + def __init__(self, *, mail_notifications_enabled: bool=None, reminder_notifications_enabled: bool=None, default_decision_enabled: bool=None, justification_required_on_approval: bool=None, default_decision=None, auto_apply_decisions_enabled: bool=None, recommendations_enabled: bool=None, instance_duration_in_days: int=None, recurrence=None, **kwargs) -> None: + super(AccessReviewScheduleSettings, self).__init__(**kwargs) + self.mail_notifications_enabled = mail_notifications_enabled + self.reminder_notifications_enabled = reminder_notifications_enabled + self.default_decision_enabled = default_decision_enabled + self.justification_required_on_approval = justification_required_on_approval + self.default_decision = default_decision + self.auto_apply_decisions_enabled = auto_apply_decisions_enabled + self.recommendations_enabled = recommendations_enabled + self.instance_duration_in_days = instance_duration_in_days + self.recurrence = recurrence + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class ErrorDefinition(Model): + """Error. + + Error description and code explaining why an operation failed. + + :param error: Error of the list gateway status. + :type error: + ~azure.mgmt.authorization.v2021_03_01_preview.models.ErrorDefinitionProperties + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinitionProperties'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorDefinition, self).__init__(**kwargs) + self.error = error + + +class ErrorDefinitionException(HttpOperationError): + """Server responsed with exception of type: 'ErrorDefinition'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorDefinitionException, self).__init__(deserialize, response, 'ErrorDefinition', *args) + + +class ErrorDefinitionProperties(Model): + """Error. + + Error description and code explaining why an operation failed. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar message: Description of the error. + :vartype message: str + :param code: Error code of list gateway. + :type code: str + """ + + _validation = { + 'message': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, **kwargs) -> None: + super(ErrorDefinitionProperties, self).__init__(**kwargs) + self.message = None + self.code = code + + +class Operation(Model): + """The definition of a Microsoft.Authorization operation. + + :param name: Name of the operation + :type name: str + :param is_data_action: Indicates whether the operation is a data action + :type is_data_action: bool + :param display: Display of the operation + :type display: + ~azure.mgmt.authorization.v2021_03_01_preview.models.OperationDisplay + :param origin: Origin of the operation + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, is_data_action: bool=None, display=None, origin: str=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin + + +class OperationDisplay(Model): + """The display information for a Microsoft.Authorization operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provider: The resource provider name: Microsoft.Authorization. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that users can perform. + :vartype operation: str + :ivar description: The description for the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_paged_models.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_paged_models.py new file mode 100644 index 0000000000000..3b6ab8b57061c --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/models/_paged_models.py @@ -0,0 +1,66 @@ +# 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 OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class AccessReviewScheduleDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`AccessReviewScheduleDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[AccessReviewScheduleDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(AccessReviewScheduleDefinitionPaged, self).__init__(*args, **kwargs) +class AccessReviewInstancePaged(Paged): + """ + A paging container for iterating over a list of :class:`AccessReviewInstance ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[AccessReviewInstance]'} + } + + def __init__(self, *args, **kwargs): + + super(AccessReviewInstancePaged, self).__init__(*args, **kwargs) +class AccessReviewDecisionPaged(Paged): + """ + A paging container for iterating over a list of :class:`AccessReviewDecision ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[AccessReviewDecision]'} + } + + def __init__(self, *args, **kwargs): + + super(AccessReviewDecisionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/__init__.py new file mode 100644 index 0000000000000..cba7f42add555 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._access_review_schedule_definitions_operations import AccessReviewScheduleDefinitionsOperations +from ._access_review_instances_operations import AccessReviewInstancesOperations +from ._access_review_instance_operations import AccessReviewInstanceOperations +from ._access_review_instance_decisions_operations import AccessReviewInstanceDecisionsOperations +from ._access_review_default_settings_operations import AccessReviewDefaultSettingsOperations +from ._access_review_schedule_definitions_assigned_for_my_approval_operations import AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations +from ._access_review_instances_assigned_for_my_approval_operations import AccessReviewInstancesAssignedForMyApprovalOperations +from ._access_review_instance_my_decisions_operations import AccessReviewInstanceMyDecisionsOperations + +__all__ = [ + 'Operations', + 'AccessReviewScheduleDefinitionsOperations', + 'AccessReviewInstancesOperations', + 'AccessReviewInstanceOperations', + 'AccessReviewInstanceDecisionsOperations', + 'AccessReviewDefaultSettingsOperations', + 'AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations', + 'AccessReviewInstancesAssignedForMyApprovalOperations', + 'AccessReviewInstanceMyDecisionsOperations', +] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_default_settings_operations.py new file mode 100644 index 0000000000000..cf82003845878 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_default_settings_operations.py @@ -0,0 +1,156 @@ +# 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 .. import models + + +class AccessReviewDefaultSettingsOperations(object): + """AccessReviewDefaultSettingsOperations 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 be used with the HTTP request. Constant value: "2021-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-03-01-preview" + + self.config = config + + def get( + self, custom_headers=None, raw=False, **operation_config): + """Get access review default settings for the subscription. + + :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: AccessReviewDefaultSettings or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDefaultSettings + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get.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 = {} + 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewDefaultSettings', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default'} + + def put( + self, properties, custom_headers=None, raw=False, **operation_config): + """Get access review default settings for the subscription. + + :param properties: Access review schedule settings. + :type properties: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleSettings + :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: AccessReviewDefaultSettings or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDefaultSettings + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.put.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 = {} + 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(properties, 'AccessReviewScheduleSettings') + + # 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 [200]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewDefaultSettings', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_decisions_operations.py new file mode 100644 index 0000000000000..18888fff9d66b --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_decisions_operations.py @@ -0,0 +1,111 @@ +# 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 .. import models + + +class AccessReviewInstanceDecisionsOperations(object): + """AccessReviewInstanceDecisionsOperations 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 be used with the HTTP request. Constant value: "2021-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-03-01-preview" + + self.config = config + + def list( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """Get access review instance decisions. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: An iterator like instance of AccessReviewDecision + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecisionPaged[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecision] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AccessReviewDecisionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_my_decisions_operations.py new file mode 100644 index 0000000000000..61a796741f61c --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_my_decisions_operations.py @@ -0,0 +1,253 @@ +# 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 .. import models + + +class AccessReviewInstanceMyDecisionsOperations(object): + """AccessReviewInstanceMyDecisionsOperations 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 be used with the HTTP request. Constant value: "2021-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-03-01-preview" + + self.config = config + + def list( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """Get my access review instance decisions. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: An iterator like instance of AccessReviewDecision + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecisionPaged[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecision] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AccessReviewDecisionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions'} + + def get_by_id( + self, schedule_definition_id, id, decision_id, custom_headers=None, raw=False, **operation_config): + """Get my single access review instance decision. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type id: str + :param decision_id: The id of the decision record. + :type decision_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: AccessReviewDecision or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecision + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'decisionId': self._serialize.url("decision_id", decision_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewDecision', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}'} + + def patch( + self, schedule_definition_id, id, decision_id, decision=None, justification=None, custom_headers=None, raw=False, **operation_config): + """Record a decision. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type id: str + :param decision_id: The id of the decision record. + :type decision_id: str + :param decision: The decision on the approval step. This value is + initially set to NotReviewed. Approvers can take action of + Approve/Deny. Possible values include: 'Approve', 'Deny', + 'NotReviewed', 'DontKnow', 'NotNotified' + :type decision: str or + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewResult + :param justification: Justification provided by approvers for their + action + :type justification: 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: AccessReviewDecision or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewDecision + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + properties = models.AccessReviewDecisionProperties(decision=decision, justification=justification) + + # Construct URL + url = self.patch.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'decisionId': self._serialize.url("decision_id", decision_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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(properties, 'AccessReviewDecisionProperties') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewDecision', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + patch.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_operations.py new file mode 100644 index 0000000000000..252c12b3082a9 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instance_operations.py @@ -0,0 +1,304 @@ +# 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 .. import models + + +class AccessReviewInstanceOperations(object): + """AccessReviewInstanceOperations 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 be used with the HTTP request. Constant value: "2021-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-03-01-preview" + + self.config = config + + def stop( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """An action to stop an access review instance. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.stop.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + stop.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop'} + + def reset_decisions( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """An action to reset all decisions for an access review instance. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.reset_decisions.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + reset_decisions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions'} + + def apply_decisions( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """An action to apply all decisions for an access review instance. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.apply_decisions.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + apply_decisions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions'} + + def send_reminders( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """An action to send reminders for an access review instance. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.send_reminders.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + send_reminders.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders'} + + def accept_recommendations( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """An action to accept recommendations for decision in an access review + instance. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.accept_recommendations.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + accept_recommendations.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py new file mode 100644 index 0000000000000..542669e19c6b5 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class AccessReviewInstancesAssignedForMyApprovalOperations(object): + """AccessReviewInstancesAssignedForMyApprovalOperations 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 be used with the HTTP request. Constant value: "2021-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-03-01-preview" + + self.config = config + + def list( + self, schedule_definition_id, custom_headers=None, raw=False, **operation_config): + """Get access review instances assigned for my approval. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_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: An iterator like instance of AccessReviewInstance + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstancePaged[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstance] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AccessReviewInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances'} + + def get_by_id( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """Get single access review instance assigned for my approval. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: AccessReviewInstance or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstance + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewInstance', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_operations.py new file mode 100644 index 0000000000000..8a7066095d455 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_instances_operations.py @@ -0,0 +1,170 @@ +# 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 .. import models + + +class AccessReviewInstancesOperations(object): + """AccessReviewInstancesOperations 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 be used with the HTTP request. Constant value: "2021-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-03-01-preview" + + self.config = config + + def list( + self, schedule_definition_id, custom_headers=None, raw=False, **operation_config): + """Get access review instances. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_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: An iterator like instance of AccessReviewInstance + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstancePaged[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstance] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AccessReviewInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances'} + + def get_by_id( + self, schedule_definition_id, id, custom_headers=None, raw=False, **operation_config): + """Get access review instances. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param id: The id of the access review instance. + :type 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: AccessReviewInstance or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewInstance + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'id': self._serialize.url("id", id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewInstance', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py new file mode 100644 index 0000000000000..18df02a5c688e --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_assigned_for_my_approval_operations.py @@ -0,0 +1,100 @@ +# 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 .. import models + + +class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations(object): + """AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations 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 be used with the HTTP request. Constant value: "2021-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-03-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get access review instances assigned for my approval. + + :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 AccessReviewScheduleDefinition + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionPaged[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinition] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AccessReviewScheduleDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/accessReviewScheduleDefinitions'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_operations.py new file mode 100644 index 0000000000000..4e79fd4e4c978 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_access_review_schedule_definitions_operations.py @@ -0,0 +1,331 @@ +# 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 .. import models + + +class AccessReviewScheduleDefinitionsOperations(object): + """AccessReviewScheduleDefinitionsOperations 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 be used with the HTTP request. Constant value: "2021-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-03-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get access review schedule definitions. + + :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 AccessReviewScheduleDefinition + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionPaged[~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinition] + :raises: + :class:`ErrorDefinitionException` + """ + 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 = {} + 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AccessReviewScheduleDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions'} + + def get_by_id( + self, schedule_definition_id, custom_headers=None, raw=False, **operation_config): + """Get single access review definition. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_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: AccessReviewScheduleDefinition or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinition + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewScheduleDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}'} + + def delete_by_id( + self, schedule_definition_id, custom_headers=None, raw=False, **operation_config): + """Delete access review schedule definition. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.delete_by_id.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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, 204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}'} + + def create_or_update_by_id( + self, schedule_definition_id, properties, custom_headers=None, raw=False, **operation_config): + """Create or Update access review schedule definition. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_definition_id: str + :param properties: Access review schedule definition properties. + :type properties: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinitionProperties + :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: AccessReviewScheduleDefinition or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.AccessReviewScheduleDefinition + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.create_or_update_by_id.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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(properties, 'AccessReviewScheduleDefinitionProperties') + + # 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 [200]: + raise models.ErrorDefinitionException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AccessReviewScheduleDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update_by_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}'} + + def stop( + self, schedule_definition_id, custom_headers=None, raw=False, **operation_config): + """Stop access review definition. + + :param schedule_definition_id: The id of the access review schedule + definition. + :type schedule_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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorDefinitionException` + """ + # Construct URL + url = self.stop.metadata['url'] + path_format_arguments = { + 'scheduleDefinitionId': self._serialize.url("schedule_definition_id", schedule_definition_id, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorDefinitionException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + stop.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_operations.py new file mode 100644 index 0000000000000..7fce20e4321ed --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/operations/_operations.py @@ -0,0 +1,100 @@ +# 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 .. import models + + +class Operations(object): + """Operations 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 be used with the HTTP request. Constant value: "2021-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-03-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists the operations available from this provider. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.authorization.v2021_03_01_preview.models.OperationPaged[~azure.mgmt.authorization.v2021_03_01_preview.models.Operation] + :raises: + :class:`ErrorDefinitionException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + 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]: + raise models.ErrorDefinitionException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Authorization/operations'} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/version.py new file mode 100644 index 0000000000000..5eb1b1093d5c0 --- /dev/null +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_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 = "2021-03-01-preview" +