diff --git a/sdk/authorization/azure-mgmt-authorization/_meta.json b/sdk/authorization/azure-mgmt-authorization/_meta.json index ca36520af982..6bccd228508b 100644 --- a/sdk/authorization/azure-mgmt-authorization/_meta.json +++ b/sdk/authorization/azure-mgmt-authorization/_meta.json @@ -1,11 +1,25 @@ { - "commit": "1af2861030243b06ee35172c95899f4809eedfc7", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "commit": "8580fb1de1cc58a85ce41100f0f2235be12a4f53", + "repository_url": "https://github.com/openapi-env-test/azure-rest-api-specs", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.6.0", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/authorization/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.6.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", - "readme": "specification/authorization/resource-manager/readme.md" + "autorest_command": "autorest specification/authorization/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/authorization/resource-manager/readme.md", + "package-2021-12-01-preview-only": "2022-06-29 21:34:39 -0700 a4d7a85899e7b980990870106224524ec6438c8a Microsoft.Authorization/preview/2021-12-01-preview/authorization-AccessReviewCalls.json", + "package-2021-07-01-preview-only": "2021-07-29 01:50:48 -0700 74dbcfee45a6634d0043e478aba324796d98940c Microsoft.Authorization/preview/2021-07-01-preview/authorization-AccessReviewCalls.json", + "package-2021-03-01-preview-only": "2021-04-21 00:47:59 -0700 890f0755f2a973edadc31c78d7a74f5e283f6c3d Microsoft.Authorization/preview/2021-03-01-preview/authorization-AccessReviewCalls.json", + "package-2021-01-01-preview-only": "2021-02-18 00:34:14 -0800 c740df72bd77fd8c6a822bbd1ad8d366a31dc2b3 Microsoft.Authorization/preview/2021-01-01-preview/authorization-RoleAssignmentApprovalCalls.json", + "package-2020-10-01-only": "2022-03-31 17:46:02 -0700 95a128e006b4478203e188c9bf8896ffe9900998 Microsoft.Authorization/stable/2020-10-01/common-types.json", + "package-2020-10-01-preview-only": "2022-02-10 03:42:48 +0100 47c12e21d06ca29be0579880585fc883bd6e6055 Microsoft.Authorization/preview/2020-10-01-preview/RoleManagementPolicy.json", + "package-2020-04-01-preview-only": "2021-11-03 18:26:47 -0700 42c2ad511bc23ece4f224a67eb35c598280c6dcf Microsoft.Authorization/preview/2020-04-01-preview/authorization-RoleAssignmentsCalls.json", + "package-2019-08-01-preview-only": "2021-08-31 20:25:39 -0700 4dc391780cb36a5c8c5632f5baec0cb8f255fa71 Microsoft.Authorization/preview/2019-08-01-preview/authorization-UsageMetricsCalls.json", + "package-2018-09-01-preview-only": "2021-11-03 18:26:47 -0700 42c2ad511bc23ece4f224a67eb35c598280c6dcf Microsoft.Authorization/preview/2018-09-01-preview/authorization-RoleAssignmentsCalls.json", + "package-2018-07-01-preview-only": "2022-02-10 03:42:48 +0100 47c12e21d06ca29be0579880585fc883bd6e6055 Microsoft.Authorization/preview/2018-07-01-preview/authorization-DenyAssignmentGetCalls.json", + "package-2018-05-01-preview": "2022-02-10 03:42:48 +0100 47c12e21d06ca29be0579880585fc883bd6e6055 Microsoft.Authorization/preview/2018-05-01-preview/authorization-AccessReviewCalls.json", + "package-2018-01-01-preview-only": "2022-02-10 03:42:48 +0100 47c12e21d06ca29be0579880585fc883bd6e6055 Microsoft.Authorization/preview/2018-01-01-preview/authorization-RoleDefinitionsCalls.json", + "package-2015-07-01": "2022-06-01 00:48:33 -0700 688cfd36391115f70ea9276a8e526caea6a5c8ad Microsoft.Authorization/stable/2015-07-01/authorization-ElevateAccessCalls.json", + "package-2015-06-01-preview": "2021-08-31 20:25:39 -0700 4dc391780cb36a5c8c5632f5baec0cb8f255fa71 Microsoft.Authorization/preview/2015-06-01/authorization-ClassicAdminCalls.json" } \ No newline at end of file diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_serialization.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_serialization.py index e3cc6ce6ed6f..a00658b1fc19 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_serialization.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/_serialization.py @@ -664,8 +664,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -743,6 +744,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -751,10 +754,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get('skip_quote', False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -893,6 +894,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -905,9 +908,18 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get('do_quote', False): + serialized = [ + '' if s is None else quote(str(s), safe='') + for s + in serialized + ] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -952,7 +964,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_version.py index 77f53a3589c6..e5754a47ce68 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 477ad39de894..83e510ad9732 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_version.py index 77f53a3589c6..e5754a47ce68 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 2723b964e405..9389b36a46bf 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 947f26d65d70..4be0050515d6 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +55,7 @@ def build_list_for_resource_group_request(resource_group_name: str, subscription "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +97,7 @@ def build_list_for_resource_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 227deda6a6df..ccacad769eeb 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_get_request(resource_provider_namespace: str, *, expand: str = "resour "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 f84bbdb3cb5c..2b823e773dad 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 @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +70,7 @@ def build_list_for_resource_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -104,7 +104,7 @@ def build_list_for_resource_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -131,7 +131,7 @@ def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,7 +157,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,7 +184,7 @@ def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> H "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -208,7 +208,7 @@ def build_delete_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -233,7 +233,7 @@ def build_create_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -259,7 +259,7 @@ def build_get_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpReque "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -285,7 +285,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -311,7 +311,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: 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 209215e725ac..7061aa163205 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 @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) -> "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +76,7 @@ def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> Htt "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,7 +102,7 @@ def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,7 +128,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -154,7 +154,7 @@ def build_get_by_id_request(role_definition_id: str, **kwargs: Any) -> HttpReque "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_version.py index 77f53a3589c6..e5754a47ce68 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 ec916a24c3f5..3c91b6f1d4e1 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +55,7 @@ def build_list_for_resource_group_request(resource_group_name: str, subscription "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -99,7 +99,7 @@ def build_list_for_resource_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 c447ad8b13c5..38a5a38e0d01 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_get_request(resource_provider_namespace: str, *, expand: str = "resour ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 455091767542..707177fc31ad 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 @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +72,7 @@ def build_list_for_resource_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -106,7 +106,7 @@ def build_list_for_resource_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -133,7 +133,7 @@ def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,7 +159,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,7 +186,7 @@ def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> H "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -210,7 +210,7 @@ def build_delete_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,7 +235,7 @@ def build_create_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -261,7 +261,7 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,7 +287,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -313,7 +313,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: 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 ac7d84073fdb..c16d04ae5937 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 @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) -> "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +76,7 @@ def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> Htt "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,7 +102,7 @@ def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,7 +128,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -154,7 +154,7 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_05_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c6..e5754a47ce68 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index 5eb5975a1621..08529d03df7d 100644 --- 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 @@ -26,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index 1c86e8c0737f..ca7510325b5e 100644 --- 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index b2b8dae079ef..556c4c658fd5 100644 --- 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 @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,7 +113,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str, "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index 1b5d7c5a7588..efb8c60fee34 100644 --- 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +52,7 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_reset_decisions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +114,7 @@ def build_apply_decisions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,7 +145,7 @@ def build_send_reminders_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +173,7 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, * "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index 4f262f516dfa..14faae61cd40 100644 --- 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +52,7 @@ def build_list_request(schedule_definition_id: str, **kwargs: Any) -> HttpReques "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +80,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any) "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index e944e31089c8..eb644c56363c 100644 --- 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_request(schedule_definition_id: str, subscription_id: str, **kwar "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +82,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index f426bc61978c..2e94179d36cc 100644 --- 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 @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,7 +81,7 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, * "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,7 +109,7 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,7 +140,7 @@ def build_create_or_update_by_id_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -170,7 +170,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_version.py index 77f53a3589c6..e5754a47ce68 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 7549851ad47d..e735501b54fb 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +71,7 @@ def build_list_for_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,7 +105,7 @@ def build_list_for_resource_group_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,7 +133,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +160,7 @@ def build_get_request(scope: str, deny_assignment_id: str, **kwargs: Any) -> Htt "denyAssignmentId": _SERIALIZER.url("deny_assignment_id", deny_assignment_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,7 +184,7 @@ def build_get_by_id_request(deny_assignment_id: str, **kwargs: Any) -> HttpReque "denyAssignmentId": _SERIALIZER.url("deny_assignment_id", deny_assignment_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -208,7 +208,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_version.py index 77f53a3589c6..e5754a47ce68 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_09_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 36aeaa1c57e6..c23abbd9735d 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 @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +72,7 @@ def build_list_for_resource_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -106,7 +106,7 @@ def build_list_for_resource_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -133,7 +133,7 @@ def build_delete_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,7 +159,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -186,7 +186,7 @@ def build_get_request(scope: str, role_assignment_name: str, **kwargs: Any) -> H "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -210,7 +210,7 @@ def build_delete_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,7 +235,7 @@ def build_create_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -261,7 +261,7 @@ def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -287,7 +287,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -313,7 +313,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_version.py index 77f53a3589c6..e5754a47ce68 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/_role_assignment_metrics_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/_role_assignment_metrics_operations.py index 41ab3da09a46..2601a68f69e0 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/_role_assignment_metrics_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2019_08_01_preview/operations/_role_assignment_metrics_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_get_metrics_for_subscription_request(subscription_id: str, **kwargs: A "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_version.py index 77f53a3589c6..e5754a47ce68 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 709edb7a0bea..be15c1e4c39a 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 @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +73,7 @@ def build_list_for_resource_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -114,7 +114,7 @@ def build_list_for_resource_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -145,7 +145,7 @@ def build_delete_request( "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +173,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -202,7 +202,7 @@ def build_get_request( "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -228,7 +228,7 @@ def build_delete_by_id_request(role_id: str, *, tenant_id: Optional[str] = None, "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -255,7 +255,7 @@ def build_create_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -281,7 +281,7 @@ def build_get_by_id_request(role_id: str, *, tenant_id: Optional[str] = None, ** "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -311,7 +311,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -341,7 +341,7 @@ def build_list_for_scope_request( "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_version.py index 77f53a3589c6..e5754a47ce68 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_eligible_child_resources_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_eligible_child_resources_operations.py index 91c9a599883e..f62ef9e7fc39 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_eligible_child_resources_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_eligible_child_resources_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_get_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_instances_operations.py index e8ca1d811b0b..29530c0140dd 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_instances_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -81,7 +81,7 @@ def build_get_request(scope: str, role_assignment_schedule_instance_name: str, * ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_requests_operations.py index 542edabc6b52..b8878ca04c16 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_requests_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedule_requests_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +57,7 @@ def build_create_request(scope: str, role_assignment_schedule_request_name: str, ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +89,7 @@ def build_get_request(scope: str, role_assignment_schedule_request_name: str, ** ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,7 +113,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -145,7 +145,7 @@ def build_cancel_request(scope: str, role_assignment_schedule_request_name: str, ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -176,7 +176,7 @@ def build_validate_request(scope: str, role_assignment_schedule_request_name: st ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedules_operations.py index a6edd5760f1b..dd61a2f7e6bc 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedules_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_assignment_schedules_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +55,7 @@ def build_get_request(scope: str, role_assignment_schedule_name: str, **kwargs: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_instances_operations.py index 84baa462231c..c4e6f5237e59 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_instances_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -81,7 +81,7 @@ def build_get_request(scope: str, role_eligibility_schedule_instance_name: str, ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_requests_operations.py index 03cb9acf3abe..efe15c495c5c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_requests_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedule_requests_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +57,7 @@ def build_create_request(scope: str, role_eligibility_schedule_request_name: str ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +89,7 @@ def build_get_request(scope: str, role_eligibility_schedule_request_name: str, * ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,7 +113,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -145,7 +145,7 @@ def build_cancel_request(scope: str, role_eligibility_schedule_request_name: str ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -176,7 +176,7 @@ def build_validate_request(scope: str, role_eligibility_schedule_request_name: s ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedules_operations.py index 9d7ba4e73c05..30eed76d9e2b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedules_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_eligibility_schedules_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +55,7 @@ def build_get_request(scope: str, role_eligibility_schedule_name: str, **kwargs: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policies_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policies_operations.py index 57aa735de0b9..232e43a0aba1 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policies_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policies_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_get_request(scope: str, role_management_policy_name: str, **kwargs: An "roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,7 +81,7 @@ def build_update_request(scope: str, role_management_policy_name: str, **kwargs: "roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,7 +110,7 @@ def build_delete_request(scope: str, role_management_policy_name: str, **kwargs: "roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,7 +134,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policy_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policy_assignments_operations.py index d15880273785..cba53ca09ff6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policy_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01/operations/_role_management_policy_assignments_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +56,7 @@ def build_get_request(scope: str, role_management_policy_assignment_name: str, * ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +87,7 @@ def build_create_request(scope: str, role_management_policy_assignment_name: str ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,7 +119,7 @@ def build_delete_request(scope: str, role_management_policy_assignment_name: str ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,7 +143,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_version.py index 77f53a3589c6..e5754a47ce68 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_authorization_management_client_enums.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_authorization_management_client_enums.py index b7fe646a9920..511d0e7675ce 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_authorization_management_client_enums.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_authorization_management_client_enums.py @@ -27,7 +27,7 @@ class AssignmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class EnablementRules(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of enablement rule.""" + """The type of enable rules.""" MULTI_FACTOR_AUTHENTICATION = "MultiFactorAuthentication" JUSTIFICATION = "Justification" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_models_py3.py index f75709cee514..a7053c060d6e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_models_py3.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/models/_models_py3.py @@ -20,13 +20,12 @@ class ApprovalSettings(_serialization.Model): """The approval settings. - :ivar is_approval_required: Determines whether approval is required or not. + :ivar is_approval_required: Determine whether approval is required or not. :vartype is_approval_required: bool - :ivar is_approval_required_for_extension: Determines whether approval is required for - assignment extension. + :ivar is_approval_required_for_extension: Determine whether approval is required for assignment + extension. :vartype is_approval_required_for_extension: bool - :ivar is_requestor_justification_required: Determine whether requestor justification is - required. + :ivar is_requestor_justification_required: Determine whether requestor justification required. :vartype is_requestor_justification_required: bool :ivar approval_mode: The type of rule. Known values are: "SingleStage", "Serial", "Parallel", and "NoApproval". @@ -56,12 +55,12 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword is_approval_required: Determines whether approval is required or not. + :keyword is_approval_required: Determine whether approval is required or not. :paramtype is_approval_required: bool - :keyword is_approval_required_for_extension: Determines whether approval is required for + :keyword is_approval_required_for_extension: Determine whether approval is required for assignment extension. :paramtype is_approval_required_for_extension: bool - :keyword is_requestor_justification_required: Determine whether requestor justification is + :keyword is_requestor_justification_required: Determine whether requestor justification required. :paramtype is_requestor_justification_required: bool :keyword approval_mode: The type of rule. Known values are: "SingleStage", "Serial", @@ -86,11 +85,11 @@ class ApprovalStage(_serialization.Model): :ivar approval_stage_time_out_in_days: The time in days when approval request would be timed out. :vartype approval_stage_time_out_in_days: int - :ivar is_approver_justification_required: Determines whether approver need to provide + :ivar is_approver_justification_required: Determine whether approver need to provide justification for his decision. :vartype is_approver_justification_required: bool :ivar escalation_time_in_minutes: The time in minutes when the approval request would be - escalated if the primary approver does not approve. + escalated if the primary approver does not approves. :vartype escalation_time_in_minutes: int :ivar primary_approvers: The primary approver of the request. :vartype primary_approvers: list[~azure.mgmt.authorization.v2020_10_01_preview.models.UserSet] @@ -125,11 +124,11 @@ def __init__( :keyword approval_stage_time_out_in_days: The time in days when approval request would be timed out. :paramtype approval_stage_time_out_in_days: int - :keyword is_approver_justification_required: Determines whether approver need to provide + :keyword is_approver_justification_required: Determine whether approver need to provide justification for his decision. :paramtype is_approver_justification_required: bool :keyword escalation_time_in_minutes: The time in minutes when the approval request would be - escalated if the primary approver does not approve. + escalated if the primary approver does not approves. :paramtype escalation_time_in_minutes: int :keyword primary_approvers: The primary approver of the request. :paramtype primary_approvers: @@ -3003,7 +3002,7 @@ def __init__( class RoleManagementPolicyApprovalRule(RoleManagementPolicyRule): - """The role management policy approval rule. + """The role management policy rule. All required parameters must be populated in order to send to Azure. @@ -3158,7 +3157,7 @@ def __init__( class RoleManagementPolicyAuthenticationContextRule(RoleManagementPolicyRule): - """The role management policy authentication context rule. + """The role management policy rule. All required parameters must be populated in order to send to Azure. @@ -3273,7 +3272,7 @@ def __init__( class RoleManagementPolicyExpirationRule(RoleManagementPolicyRule): - """The role management policy expiration rule. + """The role management policy rule. All required parameters must be populated in order to send to Azure. @@ -3366,7 +3365,7 @@ def __init__( class RoleManagementPolicyNotificationRule(RoleManagementPolicyRule): - """The role management policy notification rule. + """The role management policy rule. All required parameters must be populated in order to send to Azure. @@ -3392,10 +3391,10 @@ class RoleManagementPolicyNotificationRule(RoleManagementPolicyRule): "Admin". :vartype recipient_type: str or ~azure.mgmt.authorization.v2020_10_01_preview.models.RecipientType - :ivar notification_recipients: The list of notification recipients. + :ivar notification_recipients: The list notification recipients. :vartype notification_recipients: list[str] - :ivar is_default_recipients_enabled: Determines if the notification will be sent to the - recipient type specified in the policy rule. + :ivar is_default_recipients_enabled: Its value determine if the notification need to be sent to + the recipient type specified in policy rule. :vartype is_default_recipients_enabled: bool """ @@ -3443,10 +3442,10 @@ def __init__( "Admin". :paramtype recipient_type: str or ~azure.mgmt.authorization.v2020_10_01_preview.models.RecipientType - :keyword notification_recipients: The list of notification recipients. + :keyword notification_recipients: The list notification recipients. :paramtype notification_recipients: list[str] - :keyword is_default_recipients_enabled: Determines if the notification will be sent to the - recipient type specified in the policy rule. + :keyword is_default_recipients_enabled: Its value determine if the notification need to be sent + to the recipient type specified in policy rule. :paramtype is_default_recipients_enabled: bool """ super().__init__(id=id, target=target, **kwargs) @@ -3465,7 +3464,7 @@ class RoleManagementPolicyRuleTarget(_serialization.Model): :vartype caller: str :ivar operations: The type of operation. :vartype operations: list[str] - :ivar level: The assignment level to which rule is applied. + :ivar level: The assignment level to which it is applied. :vartype level: str :ivar target_objects: The list of target objects. :vartype target_objects: list[str] @@ -3500,7 +3499,7 @@ def __init__( :paramtype caller: str :keyword operations: The type of operation. :paramtype operations: list[str] - :keyword level: The assignment level to which rule is applied. + :keyword level: The assignment level to which it is applied. :paramtype level: str :keyword target_objects: The list of target objects. :paramtype target_objects: list[str] diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_eligible_child_resources_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_eligible_child_resources_operations.py index 0de809492db8..0d766f1335b6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_eligible_child_resources_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_eligible_child_resources_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_get_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_instances_operations.py index 4df4b3d9601e..8e20b783a293 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_instances_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -81,7 +81,7 @@ def build_get_request(scope: str, role_assignment_schedule_instance_name: str, * ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_requests_operations.py index a6c978ce2b2f..3953df2086d0 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_requests_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedule_requests_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +57,7 @@ def build_create_request(scope: str, role_assignment_schedule_request_name: str, ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +89,7 @@ def build_get_request(scope: str, role_assignment_schedule_request_name: str, ** ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,7 +113,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -145,7 +145,7 @@ def build_cancel_request(scope: str, role_assignment_schedule_request_name: str, ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedules_operations.py index d48d9d282408..ca35c5228381 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedules_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignment_schedules_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +55,7 @@ def build_get_request(scope: str, role_assignment_schedule_name: str, **kwargs: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignments_operations.py index 98836d3722c6..a1e005df4fdd 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_assignments_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_list_for_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,7 +95,7 @@ def build_list_for_resource_group_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -144,7 +144,7 @@ def build_list_for_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,7 +175,7 @@ def build_get_request( "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,7 +203,7 @@ def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -232,7 +232,7 @@ def build_delete_request( "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -262,7 +262,7 @@ def build_validate_request(scope: str, role_assignment_name: str, **kwargs: Any) "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,7 +290,7 @@ def build_list_for_scope_request( "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -318,7 +318,7 @@ def build_get_by_id_request(role_assignment_id: str, *, tenant_id: Optional[str] "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -345,7 +345,7 @@ def build_create_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRe "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -373,7 +373,7 @@ def build_delete_by_id_request( "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -400,7 +400,7 @@ def build_validate_by_id_request(role_assignment_id: str, **kwargs: Any) -> Http "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_instances_operations.py index 462d376f9d30..854badf816d8 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_instances_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -81,7 +81,7 @@ def build_get_request(scope: str, role_eligibility_schedule_instance_name: str, ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_requests_operations.py index 179ab436ba63..b31fd42bc615 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_requests_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedule_requests_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +57,7 @@ def build_create_request(scope: str, role_eligibility_schedule_request_name: str ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +89,7 @@ def build_get_request(scope: str, role_eligibility_schedule_request_name: str, * ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,7 +113,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -145,7 +145,7 @@ def build_cancel_request(scope: str, role_eligibility_schedule_request_name: str ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedules_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedules_operations.py index f7b2e7ba2fa6..9317c954a92e 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedules_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_eligibility_schedules_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +55,7 @@ def build_get_request(scope: str, role_eligibility_schedule_name: str, **kwargs: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, ** "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if filter is not None: diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policies_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policies_operations.py index 95f8a85ac085..1362b315c0a7 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policies_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policies_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_get_request(scope: str, role_management_policy_name: str, **kwargs: An "roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,7 +81,7 @@ def build_update_request(scope: str, role_management_policy_name: str, **kwargs: "roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,7 +110,7 @@ def build_delete_request(scope: str, role_management_policy_name: str, **kwargs: "roleManagementPolicyName": _SERIALIZER.url("role_management_policy_name", role_management_policy_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,7 +134,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policy_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policy_assignments_operations.py index 2a9a210e7a20..8932790aa44b 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policy_assignments_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_10_01_preview/operations/_role_management_policy_assignments_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +56,7 @@ def build_get_request(scope: str, role_management_policy_assignment_name: str, * ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +87,7 @@ def build_create_request(scope: str, role_management_policy_assignment_name: str ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,7 +119,7 @@ def build_delete_request(scope: str, role_management_policy_assignment_name: str ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,7 +143,7 @@ def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_01_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c6..e5754a47ce68 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index 44572006418a..8e12ad91da10 100644 --- 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +70,7 @@ def build_get_by_id_request(approval_id: str, **kwargs: Any) -> HttpRequest: "approvalId": _SERIALIZER.url("approval_id", approval_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index 4e87856a8042..eb9d0ce3620c 100644 --- 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 @@ -26,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_get_by_id_request(approval_id: str, stage_id: str, **kwargs: Any) -> H "stageId": _SERIALIZER.url("stage_id", stage_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_patch_request(approval_id: str, stage_id: str, **kwargs: Any) -> HttpR "stageId": _SERIALIZER.url("stage_id", stage_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,7 +109,7 @@ def build_put_request(approval_id: str, stage_id: str, **kwargs: Any) -> HttpReq "stageId": _SERIALIZER.url("stage_id", stage_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index 212d0864a22d..460343f2d222 100644 --- 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +47,7 @@ def build_list_request(approval_id: str, **kwargs: Any) -> HttpRequest: "approvalId": _SERIALIZER.url("approval_id", approval_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index 9fba479aa086..3cb9bb4f474f 100644 --- 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +76,7 @@ def build_get_by_id_request(approval_id: str, scope: str, **kwargs: Any) -> Http "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index 6b602185504e..f744f4edfe75 100644 --- 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 @@ -26,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_get_by_id_request(approval_id: str, stage_id: str, scope: str, **kwarg "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_patch_request(approval_id: str, stage_id: str, scope: str, **kwargs: A "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,7 +115,7 @@ def build_put_request(approval_id: str, stage_id: str, scope: str, **kwargs: Any "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index 9300cb8ffd34..20be8172eeba 100644 --- 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_list_request(approval_id: str, scope: str, **kwargs: Any) -> HttpReque "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_03_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 index 77f53a3589c6..e5754a47ce68 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" 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 index d7e6f83d0087..9a3c7418f28c 100644 --- 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 @@ -26,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index d60b6ad2d3e6..b4d55cf622b8 100644 --- 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +56,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index 329036fc2560..726abb31bb15 100644 --- 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 @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +56,7 @@ def build_list_request( "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +87,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,7 +117,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str, "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index 50abda50ab06..d2e3f4ae53af 100644 --- 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +52,7 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_reset_decisions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +114,7 @@ def build_apply_decisions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,7 +145,7 @@ def build_send_reminders_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +173,7 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, * "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index 41ed9c6bc825..89b0f407002c 100644 --- 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +52,7 @@ def build_list_request(schedule_definition_id: str, *, filter: Optional[str] = N "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +82,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any) "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index 80a4753c2734..5af087c0dc3f 100644 --- 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +55,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -86,7 +86,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 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 index 101bd78385fb..5d94566774ef 100644 --- 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 @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, * "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,7 +111,7 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +142,7 @@ def build_create_or_update_by_id_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,7 +172,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_version.py index 77f53a3589c6..e5754a47ce68 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_default_settings_operations.py index f8b6d3a3d816..e7511858ff06 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_default_settings_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_default_settings_operations.py @@ -26,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py index 19b8ad38430f..a87a2164c642 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_decisions_operations.py index f6c1fc47e437..9c28ba4e8f64 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_decisions_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +56,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_my_decisions_operations.py index f1f5b55e4b6f..25799da3618a 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_my_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_my_decisions_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +56,7 @@ def build_list_request( "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +87,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,7 +117,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str, "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_operations.py index ca56aff5c029..c12b0c0caa89 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instance_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +52,7 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_reset_decisions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +114,7 @@ def build_apply_decisions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,7 +145,7 @@ def build_send_reminders_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +173,7 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, * "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py index b33a2aa2103a..e64e1beed387 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +52,7 @@ def build_list_request(schedule_definition_id: str, *, filter: Optional[str] = N "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +82,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any) "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_operations.py index d92292975e9f..b297e3f20529 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_instances_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +56,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +87,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,7 +117,7 @@ def build_create_request(schedule_definition_id: str, id: str, subscription_id: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_operations.py index da73e4b91a1a..a7520f39cffd 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_access_review_schedule_definitions_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, * "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,7 +111,7 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +142,7 @@ def build_create_or_update_by_id_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,7 +172,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py index 38730f35e65f..4316fb6dd3a6 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_07_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_vendor.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_version.py index 77f53a3589c6..e5754a47ce68 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_version.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_default_settings_operations.py index 635c42dbc02c..c0e917200501 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_default_settings_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_default_settings_operations.py @@ -26,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_put_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instance_operations.py index 431dba43d577..fd997c5d995d 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instance_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_generate_download_uri_request( "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instances_operations.py index e3bc81edcfea..c955d5e01d22 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_instances_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_request(history_definition_id: str, subscription_id: str, **kwarg "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_operations.py index 696f778cdd14..da63be68fe66 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definition_operations.py @@ -26,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_create_request(history_definition_id: str, subscription_id: str, **kwa "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_delete_by_id_request(history_definition_id: str, subscription_id: str, "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definitions_operations.py index 031558519eec..867f87322b5c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_history_definitions_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +52,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +82,7 @@ def build_get_by_id_request(history_definition_id: str, subscription_id: str, ** "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py index f26b7dd35419..5a78c1a0d828 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_contacted_reviewers_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_list_request(schedule_definition_id: str, id: str, subscription_id: st "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_decisions_operations.py index fe0a8f1c6f7b..6ce472ddabc7 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_decisions_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +56,7 @@ def build_list_request( "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_my_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_my_decisions_operations.py index 525e2d35e491..58dd0c30736c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_my_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_my_decisions_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +56,7 @@ def build_list_request( "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +87,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, decision_id: s "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,7 +117,7 @@ def build_patch_request(schedule_definition_id: str, id: str, decision_id: str, "decisionId": _SERIALIZER.url("decision_id", decision_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_operations.py index 6480468e873e..e18afaaee158 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instance_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +52,7 @@ def build_stop_request(schedule_definition_id: str, id: str, subscription_id: st "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_reset_decisions_request( "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +114,7 @@ def build_apply_decisions_request( "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,7 +145,7 @@ def build_send_reminders_request( "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +173,7 @@ def build_accept_recommendations_request(schedule_definition_id: str, id: str, * "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py index 490c4997b6fd..34d46c2b603c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_assigned_for_my_approval_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +52,7 @@ def build_list_request(schedule_definition_id: str, *, filter: Optional[str] = N "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +82,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, **kwargs: Any) "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_operations.py index 980b5e96f2d8..7333007969b4 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_instances_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +56,7 @@ def build_list_request( "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +87,7 @@ def build_get_by_id_request(schedule_definition_id: str, id: str, subscription_i "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,7 +117,7 @@ def build_create_request(schedule_definition_id: str, id: str, subscription_id: "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_operations.py index 174c294924f2..8462be0fa769 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_access_review_schedule_definitions_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_get_by_id_request(schedule_definition_id: str, subscription_id: str, * "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,7 +111,7 @@ def build_delete_by_id_request(schedule_definition_id: str, subscription_id: str "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +142,7 @@ def build_create_or_update_by_id_request( "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,7 +172,7 @@ def build_stop_request(schedule_definition_id: str, subscription_id: str, **kwar "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_default_settings_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_default_settings_operations.py index 42207206696a..9d567c151b05 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_default_settings_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_default_settings_operations.py @@ -26,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +48,7 @@ def build_get_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -73,7 +73,7 @@ def build_put_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instance_operations.py index b87d3afdef57..9be112c5259c 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instance_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_generate_download_uri_request( "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instances_operations.py index 04bd6281d819..39c64be98e1f 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_instances_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_request(scope: str, history_definition_id: str, **kwargs: Any) -> "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_operations.py index 48311167b09c..f8a5ab500420 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definition_operations.py @@ -26,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_create_request(scope: str, history_definition_id: str, **kwargs: Any) "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_delete_by_id_request(scope: str, history_definition_id: str, **kwargs: "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definitions_operations.py index 353d0b4774d0..88893ba0abb9 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_history_definitions_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An "scope": _SERIALIZER.url("scope", scope, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -79,7 +79,7 @@ def build_get_by_id_request(scope: str, history_definition_id: str, **kwargs: An "historyDefinitionId": _SERIALIZER.url("history_definition_id", history_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_contacted_reviewers_operations.py index 1b43fcc8e090..dea2011a7fee 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_contacted_reviewers_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_list_request(scope: str, schedule_definition_id: str, id: str, **kwarg "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_decisions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_decisions_operations.py index b7fb53ea5a5d..8a52d4a17358 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_decisions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_decisions_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +56,7 @@ def build_list_request( "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_operations.py index 38813e0e8231..1f12f65511bc 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instance_operations.py @@ -26,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_stop_request(scope: str, schedule_definition_id: str, id: str, **kwarg "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_record_all_decisions_request(scope: str, schedule_definition_id: str, "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +114,7 @@ def build_reset_decisions_request(scope: str, schedule_definition_id: str, id: s "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,7 +143,7 @@ def build_apply_decisions_request(scope: str, schedule_definition_id: str, id: s "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -172,7 +172,7 @@ def build_send_reminders_request(scope: str, schedule_definition_id: str, id: st "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instances_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instances_operations.py index 260ac1c153f3..d5fb862b7635 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instances_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_instances_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +56,7 @@ def build_list_request( "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +87,7 @@ def build_get_by_id_request(scope: str, schedule_definition_id: str, id: str, ** "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,7 +117,7 @@ def build_create_request(scope: str, schedule_definition_id: str, id: str, **kwa "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_schedule_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_schedule_definitions_operations.py index daf22c9b80a3..5e84918e839d 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_schedule_definitions_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_scope_access_review_schedule_definitions_operations.py @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: An "scope": _SERIALIZER.url("scope", scope, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +80,7 @@ def build_get_by_id_request(scope: str, schedule_definition_id: str, **kwargs: A "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,7 +108,7 @@ def build_delete_by_id_request(scope: str, schedule_definition_id: str, **kwargs "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -137,7 +137,7 @@ def build_create_or_update_by_id_request(scope: str, schedule_definition_id: str "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -167,7 +167,7 @@ def build_stop_request(scope: str, schedule_definition_id: str, **kwargs: Any) - "scheduleDefinitionId": _SERIALIZER.url("schedule_definition_id", schedule_definition_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py index bba1797ba26a..4cb8a91f5312 100644 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py +++ b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2021_12_01_preview/operations/_tenant_level_access_review_instance_contacted_reviewers_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_request(schedule_definition_id: str, id: str, **kwargs: Any) -> H "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/__init__.py deleted file mode 100644 index 019f2f208c14..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._authorization_management_client import AuthorizationManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AuthorizationManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_authorization_management_client.py deleted file mode 100644 index 048a0e100390..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_authorization_management_client.py +++ /dev/null @@ -1,124 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AuthorizationManagementClientConfiguration -from .operations import ( - DenyAssignmentsOperations, - PermissionsOperations, - ProviderOperationsMetadataOperations, - RoleAssignmentsOperations, - RoleDefinitionsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword - """Role based access control provides you a way to apply granular level policy administration down - to individual resources or resource groups. These operations enable you to get deny - assignments. A deny assignment describes the set of actions on resources that are denied for - Azure Active Directory users. - - :ivar deny_assignments: DenyAssignmentsOperations operations - :vartype deny_assignments: - azure.mgmt.authorization.v2022_04_01.operations.DenyAssignmentsOperations - :ivar provider_operations_metadata: ProviderOperationsMetadataOperations operations - :vartype provider_operations_metadata: - azure.mgmt.authorization.v2022_04_01.operations.ProviderOperationsMetadataOperations - :ivar role_assignments: RoleAssignmentsOperations operations - :vartype role_assignments: - azure.mgmt.authorization.v2022_04_01.operations.RoleAssignmentsOperations - :ivar permissions: PermissionsOperations operations - :vartype permissions: azure.mgmt.authorization.v2022_04_01.operations.PermissionsOperations - :ivar role_definitions: RoleDefinitionsOperations operations - :vartype role_definitions: - azure.mgmt.authorization.v2022_04_01.operations.RoleDefinitionsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AuthorizationManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.deny_assignments = DenyAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.provider_operations_metadata = ProviderOperationsMetadataOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.role_assignments = RoleAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.permissions = PermissionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.role_definitions = RoleDefinitionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "AuthorizationManagementClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_configuration.py deleted file mode 100644 index b501f5692f43..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AuthorizationManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-04-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_metadata.json deleted file mode 100644 index 1ded4f59232d..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_metadata.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "chosen_version": "2022-04-01", - "total_api_version_list": ["2022-04-01"], - "client": { - "name": "AuthorizationManagementClient", - "filename": "_authorization_management_client", - "description": "Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to get deny assignments. A deny assignment describes the set of actions on resources that are denied for Azure Active Directory users.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": false, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AuthorizationManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AuthorizationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "deny_assignments": "DenyAssignmentsOperations", - "provider_operations_metadata": "ProviderOperationsMetadataOperations", - "role_assignments": "RoleAssignmentsOperations", - "permissions": "PermissionsOperations", - "role_definitions": "RoleDefinitionsOperations" - } -} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_vendor.py deleted file mode 100644 index bd0df84f5319..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_vendor.py +++ /dev/null @@ -1,30 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 typing import List, cast - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_version.py deleted file mode 100644 index 77f53a3589c6..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "4.0.0" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/__init__.py deleted file mode 100644 index a6e41513a3c6..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._authorization_management_client import AuthorizationManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AuthorizationManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_authorization_management_client.py deleted file mode 100644 index c742c42451a6..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_authorization_management_client.py +++ /dev/null @@ -1,124 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AuthorizationManagementClientConfiguration -from .operations import ( - DenyAssignmentsOperations, - PermissionsOperations, - ProviderOperationsMetadataOperations, - RoleAssignmentsOperations, - RoleDefinitionsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword - """Role based access control provides you a way to apply granular level policy administration down - to individual resources or resource groups. These operations enable you to get deny - assignments. A deny assignment describes the set of actions on resources that are denied for - Azure Active Directory users. - - :ivar deny_assignments: DenyAssignmentsOperations operations - :vartype deny_assignments: - azure.mgmt.authorization.v2022_04_01.aio.operations.DenyAssignmentsOperations - :ivar provider_operations_metadata: ProviderOperationsMetadataOperations operations - :vartype provider_operations_metadata: - azure.mgmt.authorization.v2022_04_01.aio.operations.ProviderOperationsMetadataOperations - :ivar role_assignments: RoleAssignmentsOperations operations - :vartype role_assignments: - azure.mgmt.authorization.v2022_04_01.aio.operations.RoleAssignmentsOperations - :ivar permissions: PermissionsOperations operations - :vartype permissions: azure.mgmt.authorization.v2022_04_01.aio.operations.PermissionsOperations - :ivar role_definitions: RoleDefinitionsOperations operations - :vartype role_definitions: - azure.mgmt.authorization.v2022_04_01.aio.operations.RoleDefinitionsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AuthorizationManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.deny_assignments = DenyAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.provider_operations_metadata = ProviderOperationsMetadataOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.role_assignments = RoleAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.permissions = PermissionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - self.role_definitions = RoleDefinitionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "AuthorizationManagementClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_configuration.py deleted file mode 100644 index f778747ea8b4..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AuthorizationManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-04-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/__init__.py deleted file mode 100644 index 336442a84fe5..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._deny_assignments_operations import DenyAssignmentsOperations -from ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations -from ._role_assignments_operations import RoleAssignmentsOperations -from ._permissions_operations import PermissionsOperations -from ._role_definitions_operations import RoleDefinitionsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "DenyAssignmentsOperations", - "ProviderOperationsMetadataOperations", - "RoleAssignmentsOperations", - "PermissionsOperations", - "RoleDefinitionsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_deny_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_deny_assignments_operations.py deleted file mode 100644 index 11bc2ef51898..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_deny_assignments_operations.py +++ /dev/null @@ -1,596 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._deny_assignments_operations import ( - build_get_by_id_request, - build_get_request, - build_list_for_resource_group_request, - build_list_for_resource_request, - build_list_for_scope_request, - build_list_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DenyAssignmentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01.aio.AuthorizationManagementClient`'s - :attr:`deny_assignments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_resource( - self, - resource_group_name: str, - resource_provider_namespace: str, - parent_resource_path: str, - resource_type: str, - resource_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DenyAssignment"]: - """Gets deny assignments for a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_provider_namespace: The namespace of the resource provider. Required. - :type resource_provider_namespace: str - :param parent_resource_path: The parent resource identity. Required. - :type parent_resource_path: str - :param resource_type: The resource type of the resource. Required. - :type resource_type: str - :param resource_name: The name of the resource to get deny assignments for. Required. - :type resource_name: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all deny - assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny - assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny - assignments at, above and below the scope for the specified principal. Use - $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the - scope for the specified principal. This filter is different from the principalId filter as it - returns not only those deny assignments that contain the specified principal is the Principals - list but also those deny assignments that contain the specified principal is the - ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny - assignment name and description properties are returned. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DenyAssignment or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_request( - resource_group_name=resource_group_name, - resource_provider_namespace=resource_provider_namespace, - parent_resource_path=parent_resource_path, - resource_type=resource_type, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - template_url=self.list_for_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments" - } - - @distributed_trace - def list_for_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.DenyAssignment"]: - """Gets deny assignments for a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :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 scope. Use $filter=denyAssignmentName eq '{name}' to search deny - assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny - assignments at, above and below the scope for the specified principal. Use - $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the - scope for the specified principal. This filter is different from the principalId filter as it - returns not only those deny assignments that contain the specified principal is the Principals - list but also those deny assignments that contain the specified principal is the - ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny - assignment name and description properties are returned. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DenyAssignment or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - template_url=self.list_for_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments" - } - - @distributed_trace - def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.DenyAssignment"]: - """Gets all deny assignments for the subscription. - - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all deny - assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny - assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny - assignments at, above and below the scope for the specified principal. Use - $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the - scope for the specified principal. This filter is different from the principalId filter as it - returns not only those deny assignments that contain the specified principal is the Principals - list but also those deny assignments that contain the specified principal is the - ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny - assignment name and description properties are returned. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DenyAssignment or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"} - - @distributed_trace_async - async def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment: - """Get the specified deny assignment. - - :param scope: The scope of the deny assignment. Required. - :type scope: str - :param deny_assignment_id: The ID of the deny assignment to get. Required. - :type deny_assignment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DenyAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - deny_assignment_id=deny_assignment_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DenyAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"} - - @distributed_trace_async - async def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment: - """Gets a deny assignment by ID. - - :param deny_assignment_id: The fully qualified deny assignment ID. For example, use the format, - /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for - subscription level deny assignments, or - /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny - assignments. Required. - :type deny_assignment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DenyAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None) - - request = build_get_by_id_request( - deny_assignment_id=deny_assignment_id, - api_version=api_version, - template_url=self.get_by_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DenyAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_id.metadata = {"url": "/{denyAssignmentId}"} - - @distributed_trace - def list_for_scope( - self, scope: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.DenyAssignment"]: - """Gets deny assignments for a scope. - - :param scope: The scope of the deny assignments. Required. - :type scope: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all deny - assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny - assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny - assignments at, above and below the scope for the specified principal. Use - $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the - scope for the specified principal. This filter is different from the principalId filter as it - returns not only those deny assignments that contain the specified principal is the Principals - list but also those deny assignments that contain the specified principal is the - ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny - assignment name and description properties are returned. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DenyAssignment or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - filter=filter, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_permissions_operations.py deleted file mode 100644 index 93f5baf144c1..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_permissions_operations.py +++ /dev/null @@ -1,250 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._permissions_operations import build_list_for_resource_group_request, build_list_for_resource_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PermissionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01.aio.AuthorizationManagementClient`'s - :attr:`permissions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Permission"]: - """Gets all permissions the caller has for a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Permission or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.Permission] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_for_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PermissionGetResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions" - } - - @distributed_trace - def list_for_resource( - self, - resource_group_name: str, - resource_provider_namespace: str, - parent_resource_path: str, - resource_type: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.Permission"]: - """Gets all permissions the caller has for a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_provider_namespace: The namespace of the resource provider. Required. - :type resource_provider_namespace: str - :param parent_resource_path: The parent resource identity. Required. - :type parent_resource_path: str - :param resource_type: The resource type of the resource. Required. - :type resource_type: str - :param resource_name: The name of the resource to get the permissions for. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Permission or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.Permission] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_request( - resource_group_name=resource_group_name, - resource_provider_namespace=resource_provider_namespace, - parent_resource_path=parent_resource_path, - resource_type=resource_type, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_for_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PermissionGetResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions" - } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_provider_operations_metadata_operations.py deleted file mode 100644 index 938ae96af886..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_provider_operations_metadata_operations.py +++ /dev/null @@ -1,201 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._provider_operations_metadata_operations import build_get_request, build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ProviderOperationsMetadataOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01.aio.AuthorizationManagementClient`'s - :attr:`provider_operations_metadata` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get( - self, resource_provider_namespace: str, expand: str = "resourceTypes", **kwargs: Any - ) -> _models.ProviderOperationsMetadata: - """Gets provider operations metadata for the specified resource provider. - - :param resource_provider_namespace: The namespace of the resource provider. Required. - :type resource_provider_namespace: str - :param expand: Specifies whether to expand the values. Default value is "resourceTypes". - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProviderOperationsMetadata or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.ProviderOperationsMetadata - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None) - - request = build_get_request( - resource_provider_namespace=resource_provider_namespace, - expand=expand, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} - - @distributed_trace - def list(self, expand: str = "resourceTypes", **kwargs: Any) -> AsyncIterable["_models.ProviderOperationsMetadata"]: - """Gets provider operations metadata for all resource providers. - - :param expand: Specifies whether to expand the values. Default value is "resourceTypes". - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProviderOperationsMetadata or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.ProviderOperationsMetadata] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ProviderOperationsMetadataListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_assignments_operations.py deleted file mode 100644 index b6070feb7f78..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_assignments_operations.py +++ /dev/null @@ -1,1047 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._role_assignments_operations import ( - build_create_by_id_request, - build_create_request, - build_delete_by_id_request, - build_delete_request, - build_get_by_id_request, - build_get_request, - build_list_for_resource_group_request, - build_list_for_resource_request, - build_list_for_scope_request, - build_list_for_subscription_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RoleAssignmentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01.aio.AuthorizationManagementClient`'s - :attr:`role_assignments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_subscription( - self, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RoleAssignment"]: - """List all role assignments that apply to a subscription. - - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role - assignments at or above the scope. Use $filter=principalId eq {id} to return all role - assignments at, above or below the scope for the specified principal. Default value is None. - :type filter: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignment or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_subscription_request( - subscription_id=self._config.subscription_id, - filter=filter, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.list_for_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments" - } - - @distributed_trace - def list_for_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RoleAssignment"]: - """List all role assignments that apply to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role - assignments at or above the scope. Use $filter=principalId eq {id} to return all role - assignments at, above or below the scope for the specified principal. Default value is None. - :type filter: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignment or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.list_for_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" - } - - @distributed_trace - def list_for_resource( - self, - resource_group_name: str, - resource_provider_namespace: str, - resource_type: str, - resource_name: str, - filter: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RoleAssignment"]: - """List all role assignments that apply to a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_provider_namespace: The namespace of the resource provider. Required. - :type resource_provider_namespace: str - :param resource_type: The resource type name. For example the type name of a web app is 'sites' - (from Microsoft.Web/sites). Required. - :type resource_type: str - :param resource_name: The resource name. Required. - :type resource_name: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role - assignments at or above the scope. Use $filter=principalId eq {id} to return all role - assignments at, above or below the scope for the specified principal. Default value is None. - :type filter: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignment or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_request( - resource_group_name=resource_group_name, - resource_provider_namespace=resource_provider_namespace, - resource_type=resource_type, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.list_for_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" - } - - @distributed_trace_async - async def get( - self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any - ) -> _models.RoleAssignment: - """Get a role assignment by scope and name. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_assignment_name: The name of the role assignment. It can be any valid GUID. - Required. - :type role_assignment_name: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - role_assignment_name=role_assignment_name, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} - - @overload - async def create( - self, - scope: str, - role_assignment_name: str, - parameters: _models.RoleAssignmentCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignment: - """Create or update a role assignment by scope and name. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_assignment_name: The name of the role assignment. It can be any valid GUID. - Required. - :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Required. - :type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - scope: str, - role_assignment_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignment: - """Create or update a role assignment by scope and name. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_assignment_name: The name of the role assignment. It can be any valid GUID. - Required. - :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - scope: str, - role_assignment_name: str, - parameters: Union[_models.RoleAssignmentCreateParameters, IO], - **kwargs: Any - ) -> _models.RoleAssignment: - """Create or update a role assignment by scope and name. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_assignment_name: The name of the role assignment. It can be any valid GUID. - Required. - :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a - RoleAssignmentCreateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RoleAssignmentCreateParameters") - - request = build_create_request( - scope=scope, - role_assignment_name=role_assignment_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} - - @distributed_trace_async - async def delete( - self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any - ) -> Optional[_models.RoleAssignment]: - """Delete a role assignment by scope and name. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_assignment_name: The name of the role assignment. It can be any valid GUID. - Required. - :type role_assignment_name: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or None or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) - - request = build_delete_request( - scope=scope, - role_assignment_name=role_assignment_name, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} - - @distributed_trace - def list_for_scope( - self, - scope: str, - filter: Optional[str] = None, - tenant_id: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RoleAssignment"]: - """List all role assignments that apply to a scope. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role - assignments at or above the scope. Use $filter=principalId eq {id} to return all role - assignments at, above or below the scope for the specified principal. Default value is None. - :type filter: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :param skip_token: The skipToken to apply on the operation. Use $skipToken={skiptoken} to - return paged role assignments following the skipToken passed. Only supported on provider level - calls. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignment or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - filter=filter, - tenant_id=tenant_id, - skip_token=skip_token, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} - - @distributed_trace_async - async def get_by_id( - self, role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any - ) -> _models.RoleAssignment: - """Get a role assignment by ID. - - :param role_assignment_id: The fully qualified ID of the role assignment including scope, - resource name, and resource type. Format: - /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. - Required. - :type role_assignment_id: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) - - request = build_get_by_id_request( - role_assignment_id=role_assignment_id, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.get_by_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_id.metadata = {"url": "/{roleAssignmentId}"} - - @overload - async def create_by_id( - self, - role_assignment_id: str, - parameters: _models.RoleAssignmentCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignment: - """Create or update a role assignment by ID. - - :param role_assignment_id: The fully qualified ID of the role assignment including scope, - resource name, and resource type. Format: - /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. - Required. - :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Required. - :type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_by_id( - self, role_assignment_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RoleAssignment: - """Create or update a role assignment by ID. - - :param role_assignment_id: The fully qualified ID of the role assignment including scope, - resource name, and resource type. Format: - /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. - Required. - :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_by_id( - self, role_assignment_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any - ) -> _models.RoleAssignment: - """Create or update a role assignment by ID. - - :param role_assignment_id: The fully qualified ID of the role assignment including scope, - resource name, and resource type. Format: - /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. - Required. - :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Is either a - RoleAssignmentCreateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RoleAssignmentCreateParameters") - - request = build_create_by_id_request( - role_assignment_id=role_assignment_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_by_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create_by_id.metadata = {"url": "/{roleAssignmentId}"} - - @distributed_trace_async - async def delete_by_id( - self, role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any - ) -> Optional[_models.RoleAssignment]: - """Delete a role assignment by ID. - - :param role_assignment_id: The fully qualified ID of the role assignment including scope, - resource name, and resource type. Format: - /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. - Required. - :type role_assignment_id: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or None or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) - - request = build_delete_by_id_request( - role_assignment_id=role_assignment_id, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.delete_by_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - delete_by_id.metadata = {"url": "/{roleAssignmentId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_definitions_operations.py deleted file mode 100644 index 4531a6c139d4..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/aio/operations/_role_definitions_operations.py +++ /dev/null @@ -1,463 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._role_definitions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_by_id_request, - build_get_request, - build_list_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RoleDefinitionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01.aio.AuthorizationManagementClient`'s - :attr:`role_definitions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional[_models.RoleDefinition]: - """Deletes a role definition. - - :param scope: The scope of the role definition. Required. - :type scope: str - :param role_definition_id: The ID of the role definition to delete. Required. - :type role_definition_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or None or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None) - - request = build_delete_request( - scope=scope, - role_definition_id=role_definition_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} - - @distributed_trace_async - async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition: - """Get role definition by name (GUID). - - :param scope: The scope of the role definition. Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - role_definition_id=role_definition_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} - - @overload - async def create_or_update( - self, - scope: str, - role_definition_id: str, - role_definition: _models.RoleDefinition, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleDefinition: - """Creates or updates a role definition. - - :param scope: The scope of the role definition. Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :param role_definition: The values for the role definition. Required. - :type role_definition: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - scope: str, - role_definition_id: str, - role_definition: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleDefinition: - """Creates or updates a role definition. - - :param scope: The scope of the role definition. Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :param role_definition: The values for the role definition. Required. - :type role_definition: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, scope: str, role_definition_id: str, role_definition: Union[_models.RoleDefinition, IO], **kwargs: Any - ) -> _models.RoleDefinition: - """Creates or updates a role definition. - - :param scope: The scope of the role definition. Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :param role_definition: The values for the role definition. Is either a RoleDefinition type or - a IO type. Required. - :type role_definition: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(role_definition, (IOBase, bytes)): - _content = role_definition - else: - _json = self._serialize.body(role_definition, "RoleDefinition") - - request = build_create_or_update_request( - scope=scope, - role_definition_id=role_definition_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} - - @distributed_trace - def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleDefinition"]: - """Get all role definitions that are applicable at scope and above. - - :param scope: The scope of the role definition. Required. - :type scope: str - :param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below - the given scope as well. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleDefinition or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - scope=scope, - filter=filter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RoleDefinitionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} - - @distributed_trace_async - async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: - """Gets a role definition by ID. - - :param role_id: The fully qualified role definition ID. Use the format, - /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for - subscription level role definitions, or - /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role - definitions. Required. - :type role_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) - - request = build_get_by_id_request( - role_id=role_id, - api_version=api_version, - template_url=self.get_by_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_id.metadata = {"url": "/{roleId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/__init__.py deleted file mode 100644 index 198470fcd79b..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/__init__.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import ApprovalSettings -from ._models_py3 import ApprovalStage -from ._models_py3 import DenyAssignment -from ._models_py3 import DenyAssignmentFilter -from ._models_py3 import DenyAssignmentListResult -from ._models_py3 import DenyAssignmentPermission -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Permission -from ._models_py3 import PermissionGetResult -from ._models_py3 import Principal -from ._models_py3 import ProviderOperation -from ._models_py3 import ProviderOperationsMetadata -from ._models_py3 import ProviderOperationsMetadataListResult -from ._models_py3 import ResourceType -from ._models_py3 import RoleAssignment -from ._models_py3 import RoleAssignmentCreateParameters -from ._models_py3 import RoleAssignmentFilter -from ._models_py3 import RoleAssignmentListResult -from ._models_py3 import RoleDefinition -from ._models_py3 import RoleDefinitionFilter -from ._models_py3 import RoleDefinitionListResult -from ._models_py3 import RoleManagementPolicyApprovalRule -from ._models_py3 import RoleManagementPolicyAuthenticationContextRule -from ._models_py3 import RoleManagementPolicyEnablementRule -from ._models_py3 import RoleManagementPolicyExpirationRule -from ._models_py3 import RoleManagementPolicyNotificationRule -from ._models_py3 import RoleManagementPolicyRule -from ._models_py3 import RoleManagementPolicyRuleTarget -from ._models_py3 import UserSet -from ._models_py3 import ValidationResponse -from ._models_py3 import ValidationResponseErrorInfo - -from ._authorization_management_client_enums import ApprovalMode -from ._authorization_management_client_enums import EnablementRules -from ._authorization_management_client_enums import NotificationDeliveryMechanism -from ._authorization_management_client_enums import NotificationLevel -from ._authorization_management_client_enums import PrincipalType -from ._authorization_management_client_enums import RecipientType -from ._authorization_management_client_enums import RoleManagementPolicyRuleType -from ._authorization_management_client_enums import UserType -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApprovalSettings", - "ApprovalStage", - "DenyAssignment", - "DenyAssignmentFilter", - "DenyAssignmentListResult", - "DenyAssignmentPermission", - "ErrorAdditionalInfo", - "ErrorDetail", - "ErrorResponse", - "Permission", - "PermissionGetResult", - "Principal", - "ProviderOperation", - "ProviderOperationsMetadata", - "ProviderOperationsMetadataListResult", - "ResourceType", - "RoleAssignment", - "RoleAssignmentCreateParameters", - "RoleAssignmentFilter", - "RoleAssignmentListResult", - "RoleDefinition", - "RoleDefinitionFilter", - "RoleDefinitionListResult", - "RoleManagementPolicyApprovalRule", - "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", - "RoleManagementPolicyExpirationRule", - "RoleManagementPolicyNotificationRule", - "RoleManagementPolicyRule", - "RoleManagementPolicyRuleTarget", - "UserSet", - "ValidationResponse", - "ValidationResponseErrorInfo", - "ApprovalMode", - "EnablementRules", - "NotificationDeliveryMechanism", - "NotificationLevel", - "PrincipalType", - "RecipientType", - "RoleManagementPolicyRuleType", - "UserType", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_authorization_management_client_enums.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_authorization_management_client_enums.py deleted file mode 100644 index b479e5120c47..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_authorization_management_client_enums.py +++ /dev/null @@ -1,76 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ApprovalMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of rule.""" - - SINGLE_STAGE = "SingleStage" - SERIAL = "Serial" - PARALLEL = "Parallel" - NO_APPROVAL = "NoApproval" - - -class EnablementRules(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of enablement rule.""" - - MULTI_FACTOR_AUTHENTICATION = "MultiFactorAuthentication" - JUSTIFICATION = "Justification" - TICKETING = "Ticketing" - - -class NotificationDeliveryMechanism(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of notification.""" - - EMAIL = "Email" - - -class NotificationLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The notification level.""" - - NONE = "None" - CRITICAL = "Critical" - ALL = "All" - - -class PrincipalType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The principal type of the assigned principal ID.""" - - USER = "User" - GROUP = "Group" - SERVICE_PRINCIPAL = "ServicePrincipal" - FOREIGN_GROUP = "ForeignGroup" - DEVICE = "Device" - - -class RecipientType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The recipient type.""" - - REQUESTOR = "Requestor" - APPROVER = "Approver" - ADMIN = "Admin" - - -class RoleManagementPolicyRuleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of rule.""" - - ROLE_MANAGEMENT_POLICY_APPROVAL_RULE = "RoleManagementPolicyApprovalRule" - ROLE_MANAGEMENT_POLICY_AUTHENTICATION_CONTEXT_RULE = "RoleManagementPolicyAuthenticationContextRule" - ROLE_MANAGEMENT_POLICY_ENABLEMENT_RULE = "RoleManagementPolicyEnablementRule" - ROLE_MANAGEMENT_POLICY_EXPIRATION_RULE = "RoleManagementPolicyExpirationRule" - ROLE_MANAGEMENT_POLICY_NOTIFICATION_RULE = "RoleManagementPolicyNotificationRule" - - -class UserType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of user.""" - - USER = "User" - GROUP = "Group" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_models_py3.py deleted file mode 100644 index a25c36472046..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_models_py3.py +++ /dev/null @@ -1,1795 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 sys -from typing import Any, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class ApprovalSettings(_serialization.Model): - """The approval settings. - - :ivar is_approval_required: Determines whether approval is required or not. - :vartype is_approval_required: bool - :ivar is_approval_required_for_extension: Determines whether approval is required for - assignment extension. - :vartype is_approval_required_for_extension: bool - :ivar is_requestor_justification_required: Determine whether requestor justification is - required. - :vartype is_requestor_justification_required: bool - :ivar approval_mode: The type of rule. Known values are: "SingleStage", "Serial", "Parallel", - and "NoApproval". - :vartype approval_mode: str or ~azure.mgmt.authorization.v2022_04_01.models.ApprovalMode - :ivar approval_stages: The approval stages of the request. - :vartype approval_stages: list[~azure.mgmt.authorization.v2022_04_01.models.ApprovalStage] - """ - - _attribute_map = { - "is_approval_required": {"key": "isApprovalRequired", "type": "bool"}, - "is_approval_required_for_extension": {"key": "isApprovalRequiredForExtension", "type": "bool"}, - "is_requestor_justification_required": {"key": "isRequestorJustificationRequired", "type": "bool"}, - "approval_mode": {"key": "approvalMode", "type": "str"}, - "approval_stages": {"key": "approvalStages", "type": "[ApprovalStage]"}, - } - - def __init__( - self, - *, - is_approval_required: Optional[bool] = None, - is_approval_required_for_extension: Optional[bool] = None, - is_requestor_justification_required: Optional[bool] = None, - approval_mode: Optional[Union[str, "_models.ApprovalMode"]] = None, - approval_stages: Optional[List["_models.ApprovalStage"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword is_approval_required: Determines whether approval is required or not. - :paramtype is_approval_required: bool - :keyword is_approval_required_for_extension: Determines whether approval is required for - assignment extension. - :paramtype is_approval_required_for_extension: bool - :keyword is_requestor_justification_required: Determine whether requestor justification is - required. - :paramtype is_requestor_justification_required: bool - :keyword approval_mode: The type of rule. Known values are: "SingleStage", "Serial", - "Parallel", and "NoApproval". - :paramtype approval_mode: str or ~azure.mgmt.authorization.v2022_04_01.models.ApprovalMode - :keyword approval_stages: The approval stages of the request. - :paramtype approval_stages: list[~azure.mgmt.authorization.v2022_04_01.models.ApprovalStage] - """ - super().__init__(**kwargs) - self.is_approval_required = is_approval_required - self.is_approval_required_for_extension = is_approval_required_for_extension - self.is_requestor_justification_required = is_requestor_justification_required - self.approval_mode = approval_mode - self.approval_stages = approval_stages - - -class ApprovalStage(_serialization.Model): - """The approval stage. - - :ivar approval_stage_time_out_in_days: The time in days when approval request would be timed - out. - :vartype approval_stage_time_out_in_days: int - :ivar is_approver_justification_required: Determines whether approver need to provide - justification for his decision. - :vartype is_approver_justification_required: bool - :ivar escalation_time_in_minutes: The time in minutes when the approval request would be - escalated if the primary approver does not approve. - :vartype escalation_time_in_minutes: int - :ivar primary_approvers: The primary approver of the request. - :vartype primary_approvers: list[~azure.mgmt.authorization.v2022_04_01.models.UserSet] - :ivar is_escalation_enabled: The value determine whether escalation feature is enabled. - :vartype is_escalation_enabled: bool - :ivar escalation_approvers: The escalation approver of the request. - :vartype escalation_approvers: list[~azure.mgmt.authorization.v2022_04_01.models.UserSet] - """ - - _attribute_map = { - "approval_stage_time_out_in_days": {"key": "approvalStageTimeOutInDays", "type": "int"}, - "is_approver_justification_required": {"key": "isApproverJustificationRequired", "type": "bool"}, - "escalation_time_in_minutes": {"key": "escalationTimeInMinutes", "type": "int"}, - "primary_approvers": {"key": "primaryApprovers", "type": "[UserSet]"}, - "is_escalation_enabled": {"key": "isEscalationEnabled", "type": "bool"}, - "escalation_approvers": {"key": "escalationApprovers", "type": "[UserSet]"}, - } - - def __init__( - self, - *, - approval_stage_time_out_in_days: Optional[int] = None, - is_approver_justification_required: Optional[bool] = None, - escalation_time_in_minutes: Optional[int] = None, - primary_approvers: Optional[List["_models.UserSet"]] = None, - is_escalation_enabled: Optional[bool] = None, - escalation_approvers: Optional[List["_models.UserSet"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword approval_stage_time_out_in_days: The time in days when approval request would be timed - out. - :paramtype approval_stage_time_out_in_days: int - :keyword is_approver_justification_required: Determines whether approver need to provide - justification for his decision. - :paramtype is_approver_justification_required: bool - :keyword escalation_time_in_minutes: The time in minutes when the approval request would be - escalated if the primary approver does not approve. - :paramtype escalation_time_in_minutes: int - :keyword primary_approvers: The primary approver of the request. - :paramtype primary_approvers: list[~azure.mgmt.authorization.v2022_04_01.models.UserSet] - :keyword is_escalation_enabled: The value determine whether escalation feature is enabled. - :paramtype is_escalation_enabled: bool - :keyword escalation_approvers: The escalation approver of the request. - :paramtype escalation_approvers: list[~azure.mgmt.authorization.v2022_04_01.models.UserSet] - """ - super().__init__(**kwargs) - self.approval_stage_time_out_in_days = approval_stage_time_out_in_days - self.is_approver_justification_required = is_approver_justification_required - self.escalation_time_in_minutes = escalation_time_in_minutes - self.primary_approvers = primary_approvers - self.is_escalation_enabled = is_escalation_enabled - self.escalation_approvers = escalation_approvers - - -class DenyAssignment(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Deny Assignment. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The deny assignment ID. - :vartype id: str - :ivar name: The deny assignment name. - :vartype name: str - :ivar type: The deny assignment type. - :vartype type: str - :ivar deny_assignment_name: The display name of the deny assignment. - :vartype deny_assignment_name: str - :ivar description: The description of the deny assignment. - :vartype description: str - :ivar permissions: An array of permissions that are denied by the deny assignment. - :vartype permissions: - list[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignmentPermission] - :ivar scope: The deny assignment scope. - :vartype scope: str - :ivar do_not_apply_to_child_scopes: Determines if the deny assignment applies to child scopes. - Default value is false. - :vartype do_not_apply_to_child_scopes: bool - :ivar principals: Array of principals to which the deny assignment applies. - :vartype principals: list[~azure.mgmt.authorization.v2022_04_01.models.Principal] - :ivar exclude_principals: Array of principals to which the deny assignment does not apply. - :vartype exclude_principals: list[~azure.mgmt.authorization.v2022_04_01.models.Principal] - :ivar is_system_protected: Specifies whether this deny assignment was created by Azure and - cannot be edited or deleted. - :vartype is_system_protected: bool - :ivar condition: The conditions on the deny assignment. This limits the resources it can be - assigned to. e.g.: - @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] - StringEqualsIgnoreCase 'foo_storage_container'. - :vartype condition: str - :ivar condition_version: Version of the condition. - :vartype condition_version: str - :ivar created_on: Time it was created. - :vartype created_on: ~datetime.datetime - :ivar updated_on: Time it was updated. - :vartype updated_on: ~datetime.datetime - :ivar created_by: Id of the user who created the assignment. - :vartype created_by: str - :ivar updated_by: Id of the user who updated the assignment. - :vartype updated_by: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "created_on": {"readonly": True}, - "updated_on": {"readonly": True}, - "created_by": {"readonly": True}, - "updated_by": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "deny_assignment_name": {"key": "properties.denyAssignmentName", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "permissions": {"key": "properties.permissions", "type": "[DenyAssignmentPermission]"}, - "scope": {"key": "properties.scope", "type": "str"}, - "do_not_apply_to_child_scopes": {"key": "properties.doNotApplyToChildScopes", "type": "bool"}, - "principals": {"key": "properties.principals", "type": "[Principal]"}, - "exclude_principals": {"key": "properties.excludePrincipals", "type": "[Principal]"}, - "is_system_protected": {"key": "properties.isSystemProtected", "type": "bool"}, - "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"}, - } - - def __init__( - self, - *, - deny_assignment_name: Optional[str] = None, - description: Optional[str] = None, - permissions: Optional[List["_models.DenyAssignmentPermission"]] = None, - scope: Optional[str] = None, - do_not_apply_to_child_scopes: Optional[bool] = None, - principals: Optional[List["_models.Principal"]] = None, - exclude_principals: Optional[List["_models.Principal"]] = None, - is_system_protected: Optional[bool] = None, - condition: Optional[str] = None, - condition_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword deny_assignment_name: The display name of the deny assignment. - :paramtype deny_assignment_name: str - :keyword description: The description of the deny assignment. - :paramtype description: str - :keyword permissions: An array of permissions that are denied by the deny assignment. - :paramtype permissions: - list[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignmentPermission] - :keyword scope: The deny assignment scope. - :paramtype scope: str - :keyword do_not_apply_to_child_scopes: Determines if the deny assignment applies to child - scopes. Default value is false. - :paramtype do_not_apply_to_child_scopes: bool - :keyword principals: Array of principals to which the deny assignment applies. - :paramtype principals: list[~azure.mgmt.authorization.v2022_04_01.models.Principal] - :keyword exclude_principals: Array of principals to which the deny assignment does not apply. - :paramtype exclude_principals: list[~azure.mgmt.authorization.v2022_04_01.models.Principal] - :keyword is_system_protected: Specifies whether this deny assignment was created by Azure and - cannot be edited or deleted. - :paramtype is_system_protected: bool - :keyword condition: The conditions on the deny assignment. This limits the resources it can be - assigned to. e.g.: - @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] - StringEqualsIgnoreCase 'foo_storage_container'. - :paramtype condition: str - :keyword condition_version: Version of the condition. - :paramtype condition_version: str - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.deny_assignment_name = deny_assignment_name - self.description = description - self.permissions = permissions - self.scope = scope - self.do_not_apply_to_child_scopes = do_not_apply_to_child_scopes - self.principals = principals - self.exclude_principals = exclude_principals - self.is_system_protected = is_system_protected - self.condition = condition - self.condition_version = condition_version - self.created_on = None - self.updated_on = None - self.created_by = None - self.updated_by = None - - -class DenyAssignmentFilter(_serialization.Model): - """Deny Assignments filter. - - :ivar deny_assignment_name: Return deny assignment with specified name. - :vartype deny_assignment_name: str - :ivar principal_id: Return all deny assignments where the specified principal is listed in the - principals list of deny assignments. - :vartype principal_id: str - :ivar gdpr_export_principal_id: Return all deny assignments where the specified principal is - listed either in the principals list or exclude principals list of deny assignments. - :vartype gdpr_export_principal_id: str - """ - - _attribute_map = { - "deny_assignment_name": {"key": "denyAssignmentName", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - "gdpr_export_principal_id": {"key": "gdprExportPrincipalId", "type": "str"}, - } - - def __init__( - self, - *, - deny_assignment_name: Optional[str] = None, - principal_id: Optional[str] = None, - gdpr_export_principal_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword deny_assignment_name: Return deny assignment with specified name. - :paramtype deny_assignment_name: str - :keyword principal_id: Return all deny assignments where the specified principal is listed in - the principals list of deny assignments. - :paramtype principal_id: str - :keyword gdpr_export_principal_id: Return all deny assignments where the specified principal is - listed either in the principals list or exclude principals list of deny assignments. - :paramtype gdpr_export_principal_id: str - """ - super().__init__(**kwargs) - self.deny_assignment_name = deny_assignment_name - self.principal_id = principal_id - self.gdpr_export_principal_id = gdpr_export_principal_id - - -class DenyAssignmentListResult(_serialization.Model): - """Deny assignment list operation result. - - :ivar value: Deny assignment list. - :vartype value: list[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DenyAssignment]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.DenyAssignment"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Deny assignment list. - :paramtype value: list[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DenyAssignmentPermission(_serialization.Model): - """Deny assignment permissions. - - :ivar actions: Actions to which the deny assignment does not grant access. - :vartype actions: list[str] - :ivar not_actions: Actions to exclude from that the deny assignment does not grant access. - :vartype not_actions: list[str] - :ivar data_actions: Data actions to which the deny assignment does not grant access. - :vartype data_actions: list[str] - :ivar not_data_actions: Data actions to exclude from that the deny assignment does not grant - access. - :vartype not_data_actions: list[str] - :ivar condition: The conditions on the Deny assignment permission. This limits the resources it - applies to. - :vartype condition: str - :ivar condition_version: Version of the condition. - :vartype condition_version: str - """ - - _attribute_map = { - "actions": {"key": "actions", "type": "[str]"}, - "not_actions": {"key": "notActions", "type": "[str]"}, - "data_actions": {"key": "dataActions", "type": "[str]"}, - "not_data_actions": {"key": "notDataActions", "type": "[str]"}, - "condition": {"key": "condition", "type": "str"}, - "condition_version": {"key": "conditionVersion", "type": "str"}, - } - - def __init__( - self, - *, - actions: Optional[List[str]] = None, - not_actions: Optional[List[str]] = None, - data_actions: Optional[List[str]] = None, - not_data_actions: Optional[List[str]] = None, - condition: Optional[str] = None, - condition_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword actions: Actions to which the deny assignment does not grant access. - :paramtype actions: list[str] - :keyword not_actions: Actions to exclude from that the deny assignment does not grant access. - :paramtype not_actions: list[str] - :keyword data_actions: Data actions to which the deny assignment does not grant access. - :paramtype data_actions: list[str] - :keyword not_data_actions: Data actions to exclude from that the deny assignment does not grant - access. - :paramtype not_data_actions: list[str] - :keyword condition: The conditions on the Deny assignment permission. This limits the resources - it applies to. - :paramtype condition: str - :keyword condition_version: Version of the condition. - :paramtype condition_version: str - """ - super().__init__(**kwargs) - self.actions = actions - self.not_actions = not_actions - self.data_actions = data_actions - self.not_data_actions = not_data_actions - self.condition = condition - self.condition_version = condition_version - - -class ErrorAdditionalInfo(_serialization.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: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.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.v2022_04_01.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.authorization.v2022_04_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.authorization.v2022_04_01.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.authorization.v2022_04_01.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class Permission(_serialization.Model): - """Role definition permissions. - - :ivar actions: Allowed actions. - :vartype actions: list[str] - :ivar not_actions: Denied actions. - :vartype not_actions: list[str] - :ivar data_actions: Allowed Data actions. - :vartype data_actions: list[str] - :ivar not_data_actions: Denied Data actions. - :vartype not_data_actions: list[str] - """ - - _attribute_map = { - "actions": {"key": "actions", "type": "[str]"}, - "not_actions": {"key": "notActions", "type": "[str]"}, - "data_actions": {"key": "dataActions", "type": "[str]"}, - "not_data_actions": {"key": "notDataActions", "type": "[str]"}, - } - - def __init__( - self, - *, - actions: Optional[List[str]] = None, - not_actions: Optional[List[str]] = None, - data_actions: Optional[List[str]] = None, - not_data_actions: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword actions: Allowed actions. - :paramtype actions: list[str] - :keyword not_actions: Denied actions. - :paramtype not_actions: list[str] - :keyword data_actions: Allowed Data actions. - :paramtype data_actions: list[str] - :keyword not_data_actions: Denied Data actions. - :paramtype not_data_actions: list[str] - """ - super().__init__(**kwargs) - self.actions = actions - self.not_actions = not_actions - self.data_actions = data_actions - self.not_data_actions = not_data_actions - - -class PermissionGetResult(_serialization.Model): - """Permissions information. - - :ivar value: An array of permissions. - :vartype value: list[~azure.mgmt.authorization.v2022_04_01.models.Permission] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Permission]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Permission"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: An array of permissions. - :paramtype value: list[~azure.mgmt.authorization.v2022_04_01.models.Permission] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Principal(_serialization.Model): - """The name of the entity last modified it. - - :ivar id: The id of the principal made changes. - :vartype id: str - :ivar display_name: The name of the principal made changes. - :vartype display_name: str - :ivar type: Type of principal such as user , group etc. - :vartype type: str - :ivar email: Email of principal. - :vartype email: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "email": {"key": "email", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - display_name: Optional[str] = None, - type: Optional[str] = None, - email: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the principal made changes. - :paramtype id: str - :keyword display_name: The name of the principal made changes. - :paramtype display_name: str - :keyword type: Type of principal such as user , group etc. - :paramtype type: str - :keyword email: Email of principal. - :paramtype email: str - """ - super().__init__(**kwargs) - self.id = id - self.display_name = display_name - self.type = type - self.email = email - - -class ProviderOperation(_serialization.Model): - """Operation. - - :ivar name: The operation name. - :vartype name: str - :ivar display_name: The operation display name. - :vartype display_name: str - :ivar description: The operation description. - :vartype description: str - :ivar origin: The operation origin. - :vartype origin: str - :ivar properties: The operation properties. - :vartype properties: JSON - :ivar is_data_action: The dataAction flag to specify the operation type. - :vartype is_data_action: bool - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "origin": {"key": "origin", "type": "str"}, - "properties": {"key": "properties", "type": "object"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - description: Optional[str] = None, - origin: Optional[str] = None, - properties: Optional[JSON] = None, - is_data_action: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The operation name. - :paramtype name: str - :keyword display_name: The operation display name. - :paramtype display_name: str - :keyword description: The operation description. - :paramtype description: str - :keyword origin: The operation origin. - :paramtype origin: str - :keyword properties: The operation properties. - :paramtype properties: JSON - :keyword is_data_action: The dataAction flag to specify the operation type. - :paramtype is_data_action: bool - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.description = description - self.origin = origin - self.properties = properties - self.is_data_action = is_data_action - - -class ProviderOperationsMetadata(_serialization.Model): - """Provider Operations metadata. - - :ivar id: The provider id. - :vartype id: str - :ivar name: The provider name. - :vartype name: str - :ivar type: The provider type. - :vartype type: str - :ivar display_name: The provider display name. - :vartype display_name: str - :ivar resource_types: The provider resource types. - :vartype resource_types: list[~azure.mgmt.authorization.v2022_04_01.models.ResourceType] - :ivar operations: The provider operations. - :vartype operations: list[~azure.mgmt.authorization.v2022_04_01.models.ProviderOperation] - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "resource_types": {"key": "resourceTypes", "type": "[ResourceType]"}, - "operations": {"key": "operations", "type": "[ProviderOperation]"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - display_name: Optional[str] = None, - resource_types: Optional[List["_models.ResourceType"]] = None, - operations: Optional[List["_models.ProviderOperation"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The provider id. - :paramtype id: str - :keyword name: The provider name. - :paramtype name: str - :keyword type: The provider type. - :paramtype type: str - :keyword display_name: The provider display name. - :paramtype display_name: str - :keyword resource_types: The provider resource types. - :paramtype resource_types: list[~azure.mgmt.authorization.v2022_04_01.models.ResourceType] - :keyword operations: The provider operations. - :paramtype operations: list[~azure.mgmt.authorization.v2022_04_01.models.ProviderOperation] - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.type = type - self.display_name = display_name - self.resource_types = resource_types - self.operations = operations - - -class ProviderOperationsMetadataListResult(_serialization.Model): - """Provider operations metadata list. - - :ivar value: The list of providers. - :vartype value: list[~azure.mgmt.authorization.v2022_04_01.models.ProviderOperationsMetadata] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ProviderOperationsMetadata]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ProviderOperationsMetadata"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of providers. - :paramtype value: list[~azure.mgmt.authorization.v2022_04_01.models.ProviderOperationsMetadata] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceType(_serialization.Model): - """Resource Type. - - :ivar name: The resource type name. - :vartype name: str - :ivar display_name: The resource type display name. - :vartype display_name: str - :ivar operations: The resource type operations. - :vartype operations: list[~azure.mgmt.authorization.v2022_04_01.models.ProviderOperation] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "operations": {"key": "operations", "type": "[ProviderOperation]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - operations: Optional[List["_models.ProviderOperation"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The resource type name. - :paramtype name: str - :keyword display_name: The resource type display name. - :paramtype display_name: str - :keyword operations: The resource type operations. - :paramtype operations: list[~azure.mgmt.authorization.v2022_04_01.models.ProviderOperation] - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.operations = operations - - -class RoleAssignment(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Role Assignments. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The role assignment ID. - :vartype id: str - :ivar name: The role assignment name. - :vartype name: str - :ivar type: The role assignment type. - :vartype type: str - :ivar scope: The role assignment scope. - :vartype scope: str - :ivar role_definition_id: The role definition ID. - :vartype role_definition_id: str - :ivar principal_id: The principal ID. - :vartype principal_id: str - :ivar principal_type: The principal type of the assigned principal ID. Known values are: - "User", "Group", "ServicePrincipal", "ForeignGroup", and "Device". - :vartype principal_type: str or ~azure.mgmt.authorization.v2022_04_01.models.PrincipalType - :ivar description: Description of role assignment. - :vartype description: str - :ivar 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'. - :vartype condition: str - :ivar condition_version: Version of the condition. Currently the only accepted value is '2.0'. - :vartype condition_version: str - :ivar created_on: Time it was created. - :vartype created_on: ~datetime.datetime - :ivar updated_on: Time it was updated. - :vartype updated_on: ~datetime.datetime - :ivar created_by: Id of the user who created the assignment. - :vartype created_by: str - :ivar updated_by: Id of the user who updated the assignment. - :vartype updated_by: str - :ivar delegated_managed_identity_resource_id: Id of the delegated managed identity resource. - :vartype delegated_managed_identity_resource_id: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "scope": {"readonly": True}, - "created_on": {"readonly": True}, - "updated_on": {"readonly": True}, - "created_by": {"readonly": True}, - "updated_by": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "scope": {"key": "properties.scope", "type": "str"}, - "role_definition_id": {"key": "properties.roleDefinitionId", "type": "str"}, - "principal_id": {"key": "properties.principalId", "type": "str"}, - "principal_type": {"key": "properties.principalType", "type": "str"}, - "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, - *, - role_definition_id: Optional[str] = None, - principal_id: Optional[str] = None, - principal_type: Union[str, "_models.PrincipalType"] = "User", - description: Optional[str] = None, - condition: Optional[str] = None, - condition_version: Optional[str] = None, - delegated_managed_identity_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword role_definition_id: The role definition ID. - :paramtype role_definition_id: str - :keyword principal_id: The principal ID. - :paramtype principal_id: str - :keyword principal_type: The principal type of the assigned principal ID. Known values are: - "User", "Group", "ServicePrincipal", "ForeignGroup", and "Device". - :paramtype principal_type: str or ~azure.mgmt.authorization.v2022_04_01.models.PrincipalType - :keyword description: Description of role assignment. - :paramtype description: str - :keyword 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'. - :paramtype condition: str - :keyword condition_version: Version of the condition. Currently the only accepted value is - '2.0'. - :paramtype condition_version: str - :keyword delegated_managed_identity_resource_id: Id of the delegated managed identity resource. - :paramtype delegated_managed_identity_resource_id: str - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.scope = None - self.role_definition_id = role_definition_id - self.principal_id = principal_id - self.principal_type = principal_type - self.description = description - self.condition = condition - self.condition_version = condition_version - self.created_on = None - self.updated_on = None - self.created_by = None - self.updated_by = None - self.delegated_managed_identity_resource_id = delegated_managed_identity_resource_id - - -class RoleAssignmentCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Role assignment create parameters. - - 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 scope: The role assignment scope. - :vartype scope: str - :ivar role_definition_id: The role definition ID. Required. - :vartype role_definition_id: str - :ivar principal_id: The principal ID. Required. - :vartype principal_id: str - :ivar principal_type: The principal type of the assigned principal ID. Known values are: - "User", "Group", "ServicePrincipal", "ForeignGroup", and "Device". - :vartype principal_type: str or ~azure.mgmt.authorization.v2022_04_01.models.PrincipalType - :ivar description: Description of role assignment. - :vartype description: str - :ivar 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'. - :vartype condition: str - :ivar condition_version: Version of the condition. Currently the only accepted value is '2.0'. - :vartype condition_version: str - :ivar created_on: Time it was created. - :vartype created_on: ~datetime.datetime - :ivar updated_on: Time it was updated. - :vartype updated_on: ~datetime.datetime - :ivar created_by: Id of the user who created the assignment. - :vartype created_by: str - :ivar updated_by: Id of the user who updated the assignment. - :vartype updated_by: str - :ivar delegated_managed_identity_resource_id: Id of the delegated managed identity resource. - :vartype delegated_managed_identity_resource_id: str - """ - - _validation = { - "scope": {"readonly": True}, - "role_definition_id": {"required": True}, - "principal_id": {"required": True}, - "created_on": {"readonly": True}, - "updated_on": {"readonly": True}, - "created_by": {"readonly": True}, - "updated_by": {"readonly": True}, - } - - _attribute_map = { - "scope": {"key": "properties.scope", "type": "str"}, - "role_definition_id": {"key": "properties.roleDefinitionId", "type": "str"}, - "principal_id": {"key": "properties.principalId", "type": "str"}, - "principal_type": {"key": "properties.principalType", "type": "str"}, - "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, - *, - role_definition_id: str, - principal_id: str, - principal_type: Union[str, "_models.PrincipalType"] = "User", - description: Optional[str] = None, - condition: Optional[str] = None, - condition_version: Optional[str] = None, - delegated_managed_identity_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword role_definition_id: The role definition ID. Required. - :paramtype role_definition_id: str - :keyword principal_id: The principal ID. Required. - :paramtype principal_id: str - :keyword principal_type: The principal type of the assigned principal ID. Known values are: - "User", "Group", "ServicePrincipal", "ForeignGroup", and "Device". - :paramtype principal_type: str or ~azure.mgmt.authorization.v2022_04_01.models.PrincipalType - :keyword description: Description of role assignment. - :paramtype description: str - :keyword 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'. - :paramtype condition: str - :keyword condition_version: Version of the condition. Currently the only accepted value is - '2.0'. - :paramtype condition_version: str - :keyword delegated_managed_identity_resource_id: Id of the delegated managed identity resource. - :paramtype delegated_managed_identity_resource_id: str - """ - super().__init__(**kwargs) - self.scope = None - self.role_definition_id = role_definition_id - self.principal_id = principal_id - self.principal_type = principal_type - self.description = description - self.condition = condition - self.condition_version = condition_version - self.created_on = None - self.updated_on = None - self.created_by = None - self.updated_by = None - self.delegated_managed_identity_resource_id = delegated_managed_identity_resource_id - - -class RoleAssignmentFilter(_serialization.Model): - """Role Assignments filter. - - :ivar principal_id: Returns role assignment of the specific principal. - :vartype principal_id: str - """ - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - } - - def __init__(self, *, principal_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword principal_id: Returns role assignment of the specific principal. - :paramtype principal_id: str - """ - super().__init__(**kwargs) - self.principal_id = principal_id - - -class RoleAssignmentListResult(_serialization.Model): - """Role assignment list operation result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Role assignment list. - :vartype value: list[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment] - :ivar next_link: The skipToken to use for getting the next set of results. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[RoleAssignment]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.RoleAssignment"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Role assignment list. - :paramtype value: list[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class RoleDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Role definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The role definition ID. - :vartype id: str - :ivar name: The role definition name. - :vartype name: str - :ivar type: The role definition type. - :vartype type: str - :ivar role_name: The role name. - :vartype role_name: str - :ivar description: The role definition description. - :vartype description: str - :ivar role_type: The role type. - :vartype role_type: str - :ivar permissions: Role definition permissions. - :vartype permissions: list[~azure.mgmt.authorization.v2022_04_01.models.Permission] - :ivar assignable_scopes: Role definition assignable scopes. - :vartype assignable_scopes: list[str] - :ivar created_on: Time it was created. - :vartype created_on: ~datetime.datetime - :ivar updated_on: Time it was updated. - :vartype updated_on: ~datetime.datetime - :ivar created_by: Id of the user who created the assignment. - :vartype created_by: str - :ivar updated_by: Id of the user who updated the assignment. - :vartype updated_by: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "created_on": {"readonly": True}, - "updated_on": {"readonly": True}, - "created_by": {"readonly": True}, - "updated_by": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "role_name": {"key": "properties.roleName", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "role_type": {"key": "properties.type", "type": "str"}, - "permissions": {"key": "properties.permissions", "type": "[Permission]"}, - "assignable_scopes": {"key": "properties.assignableScopes", "type": "[str]"}, - "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"}, - } - - def __init__( - self, - *, - role_name: Optional[str] = None, - description: Optional[str] = None, - role_type: Optional[str] = None, - permissions: Optional[List["_models.Permission"]] = None, - assignable_scopes: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword role_name: The role name. - :paramtype role_name: str - :keyword description: The role definition description. - :paramtype description: str - :keyword role_type: The role type. - :paramtype role_type: str - :keyword permissions: Role definition permissions. - :paramtype permissions: list[~azure.mgmt.authorization.v2022_04_01.models.Permission] - :keyword assignable_scopes: Role definition assignable scopes. - :paramtype assignable_scopes: list[str] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.role_name = role_name - self.description = description - self.role_type = role_type - self.permissions = permissions - self.assignable_scopes = assignable_scopes - self.created_on = None - self.updated_on = None - self.created_by = None - self.updated_by = None - - -class RoleDefinitionFilter(_serialization.Model): - """Role Definitions filter. - - :ivar role_name: Returns role definition with the specific name. - :vartype role_name: str - :ivar type: Returns role definition with the specific type. - :vartype type: str - """ - - _attribute_map = { - "role_name": {"key": "roleName", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, role_name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword role_name: Returns role definition with the specific name. - :paramtype role_name: str - :keyword type: Returns role definition with the specific type. - :paramtype type: str - """ - super().__init__(**kwargs) - self.role_name = role_name - self.type = type - - -class RoleDefinitionListResult(_serialization.Model): - """Role definition list operation result. - - :ivar value: Role definition list. - :vartype value: list[~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[RoleDefinition]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.RoleDefinition"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Role definition list. - :paramtype value: list[~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RoleManagementPolicyRule(_serialization.Model): - """The role management policy rule. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - RoleManagementPolicyApprovalRule, RoleManagementPolicyAuthenticationContextRule, - RoleManagementPolicyEnablementRule, RoleManagementPolicyExpirationRule, - RoleManagementPolicyNotificationRule - - All required parameters must be populated in order to send to Azure. - - :ivar id: The id of the rule. - :vartype id: str - :ivar rule_type: The type of rule. Required. Known values are: - "RoleManagementPolicyApprovalRule", "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", "RoleManagementPolicyExpirationRule", and - "RoleManagementPolicyNotificationRule". - :vartype rule_type: str or - ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleType - :ivar target: The target of the current rule. - :vartype target: ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleTarget - """ - - _validation = { - "rule_type": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "rule_type": {"key": "ruleType", "type": "str"}, - "target": {"key": "target", "type": "RoleManagementPolicyRuleTarget"}, - } - - _subtype_map = { - "rule_type": { - "RoleManagementPolicyApprovalRule": "RoleManagementPolicyApprovalRule", - "RoleManagementPolicyAuthenticationContextRule": "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule": "RoleManagementPolicyEnablementRule", - "RoleManagementPolicyExpirationRule": "RoleManagementPolicyExpirationRule", - "RoleManagementPolicyNotificationRule": "RoleManagementPolicyNotificationRule", - } - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the rule. - :paramtype id: str - :keyword target: The target of the current rule. - :paramtype target: ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleTarget - """ - super().__init__(**kwargs) - self.id = id - self.rule_type: Optional[str] = None - self.target = target - - -class RoleManagementPolicyApprovalRule(RoleManagementPolicyRule): - """The role management policy approval rule. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The id of the rule. - :vartype id: str - :ivar rule_type: The type of rule. Required. Known values are: - "RoleManagementPolicyApprovalRule", "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", "RoleManagementPolicyExpirationRule", and - "RoleManagementPolicyNotificationRule". - :vartype rule_type: str or - ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleType - :ivar target: The target of the current rule. - :vartype target: ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleTarget - :ivar setting: The approval setting. - :vartype setting: ~azure.mgmt.authorization.v2022_04_01.models.ApprovalSettings - """ - - _validation = { - "rule_type": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "rule_type": {"key": "ruleType", "type": "str"}, - "target": {"key": "target", "type": "RoleManagementPolicyRuleTarget"}, - "setting": {"key": "setting", "type": "ApprovalSettings"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - setting: Optional["_models.ApprovalSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the rule. - :paramtype id: str - :keyword target: The target of the current rule. - :paramtype target: ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleTarget - :keyword setting: The approval setting. - :paramtype setting: ~azure.mgmt.authorization.v2022_04_01.models.ApprovalSettings - """ - super().__init__(id=id, target=target, **kwargs) - self.rule_type: str = "RoleManagementPolicyApprovalRule" - self.setting = setting - - -class RoleManagementPolicyAuthenticationContextRule(RoleManagementPolicyRule): - """The role management policy authentication context rule. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The id of the rule. - :vartype id: str - :ivar rule_type: The type of rule. Required. Known values are: - "RoleManagementPolicyApprovalRule", "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", "RoleManagementPolicyExpirationRule", and - "RoleManagementPolicyNotificationRule". - :vartype rule_type: str or - ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleType - :ivar target: The target of the current rule. - :vartype target: ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleTarget - :ivar is_enabled: The value indicating if rule is enabled. - :vartype is_enabled: bool - :ivar claim_value: The claim value. - :vartype claim_value: str - """ - - _validation = { - "rule_type": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "rule_type": {"key": "ruleType", "type": "str"}, - "target": {"key": "target", "type": "RoleManagementPolicyRuleTarget"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "claim_value": {"key": "claimValue", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - is_enabled: Optional[bool] = None, - claim_value: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the rule. - :paramtype id: str - :keyword target: The target of the current rule. - :paramtype target: ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleTarget - :keyword is_enabled: The value indicating if rule is enabled. - :paramtype is_enabled: bool - :keyword claim_value: The claim value. - :paramtype claim_value: str - """ - super().__init__(id=id, target=target, **kwargs) - self.rule_type: str = "RoleManagementPolicyAuthenticationContextRule" - self.is_enabled = is_enabled - self.claim_value = claim_value - - -class RoleManagementPolicyEnablementRule(RoleManagementPolicyRule): - """The role management policy enablement rule. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The id of the rule. - :vartype id: str - :ivar rule_type: The type of rule. Required. Known values are: - "RoleManagementPolicyApprovalRule", "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", "RoleManagementPolicyExpirationRule", and - "RoleManagementPolicyNotificationRule". - :vartype rule_type: str or - ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleType - :ivar target: The target of the current rule. - :vartype target: ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleTarget - :ivar enabled_rules: The list of enabled rules. - :vartype enabled_rules: list[str or - ~azure.mgmt.authorization.v2022_04_01.models.EnablementRules] - """ - - _validation = { - "rule_type": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "rule_type": {"key": "ruleType", "type": "str"}, - "target": {"key": "target", "type": "RoleManagementPolicyRuleTarget"}, - "enabled_rules": {"key": "enabledRules", "type": "[str]"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - enabled_rules: Optional[List[Union[str, "_models.EnablementRules"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the rule. - :paramtype id: str - :keyword target: The target of the current rule. - :paramtype target: ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleTarget - :keyword enabled_rules: The list of enabled rules. - :paramtype enabled_rules: list[str or - ~azure.mgmt.authorization.v2022_04_01.models.EnablementRules] - """ - super().__init__(id=id, target=target, **kwargs) - self.rule_type: str = "RoleManagementPolicyEnablementRule" - self.enabled_rules = enabled_rules - - -class RoleManagementPolicyExpirationRule(RoleManagementPolicyRule): - """The role management policy expiration rule. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The id of the rule. - :vartype id: str - :ivar rule_type: The type of rule. Required. Known values are: - "RoleManagementPolicyApprovalRule", "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", "RoleManagementPolicyExpirationRule", and - "RoleManagementPolicyNotificationRule". - :vartype rule_type: str or - ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleType - :ivar target: The target of the current rule. - :vartype target: ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleTarget - :ivar is_expiration_required: The value indicating whether expiration is required. - :vartype is_expiration_required: bool - :ivar maximum_duration: The maximum duration of expiration in timespan. - :vartype maximum_duration: str - """ - - _validation = { - "rule_type": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "rule_type": {"key": "ruleType", "type": "str"}, - "target": {"key": "target", "type": "RoleManagementPolicyRuleTarget"}, - "is_expiration_required": {"key": "isExpirationRequired", "type": "bool"}, - "maximum_duration": {"key": "maximumDuration", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - is_expiration_required: Optional[bool] = None, - maximum_duration: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the rule. - :paramtype id: str - :keyword target: The target of the current rule. - :paramtype target: ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleTarget - :keyword is_expiration_required: The value indicating whether expiration is required. - :paramtype is_expiration_required: bool - :keyword maximum_duration: The maximum duration of expiration in timespan. - :paramtype maximum_duration: str - """ - super().__init__(id=id, target=target, **kwargs) - self.rule_type: str = "RoleManagementPolicyExpirationRule" - self.is_expiration_required = is_expiration_required - self.maximum_duration = maximum_duration - - -class RoleManagementPolicyNotificationRule(RoleManagementPolicyRule): - """The role management policy notification rule. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The id of the rule. - :vartype id: str - :ivar rule_type: The type of rule. Required. Known values are: - "RoleManagementPolicyApprovalRule", "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", "RoleManagementPolicyExpirationRule", and - "RoleManagementPolicyNotificationRule". - :vartype rule_type: str or - ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleType - :ivar target: The target of the current rule. - :vartype target: ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleTarget - :ivar notification_type: The type of notification. "Email" - :vartype notification_type: str or - ~azure.mgmt.authorization.v2022_04_01.models.NotificationDeliveryMechanism - :ivar notification_level: The notification level. Known values are: "None", "Critical", and - "All". - :vartype notification_level: str or - ~azure.mgmt.authorization.v2022_04_01.models.NotificationLevel - :ivar recipient_type: The recipient type. Known values are: "Requestor", "Approver", and - "Admin". - :vartype recipient_type: str or ~azure.mgmt.authorization.v2022_04_01.models.RecipientType - :ivar notification_recipients: The list of notification recipients. - :vartype notification_recipients: list[str] - :ivar is_default_recipients_enabled: Determines if the notification will be sent to the - recipient type specified in the policy rule. - :vartype is_default_recipients_enabled: bool - """ - - _validation = { - "rule_type": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "rule_type": {"key": "ruleType", "type": "str"}, - "target": {"key": "target", "type": "RoleManagementPolicyRuleTarget"}, - "notification_type": {"key": "notificationType", "type": "str"}, - "notification_level": {"key": "notificationLevel", "type": "str"}, - "recipient_type": {"key": "recipientType", "type": "str"}, - "notification_recipients": {"key": "notificationRecipients", "type": "[str]"}, - "is_default_recipients_enabled": {"key": "isDefaultRecipientsEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - notification_type: Optional[Union[str, "_models.NotificationDeliveryMechanism"]] = None, - notification_level: Optional[Union[str, "_models.NotificationLevel"]] = None, - recipient_type: Optional[Union[str, "_models.RecipientType"]] = None, - notification_recipients: Optional[List[str]] = None, - is_default_recipients_enabled: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the rule. - :paramtype id: str - :keyword target: The target of the current rule. - :paramtype target: ~azure.mgmt.authorization.v2022_04_01.models.RoleManagementPolicyRuleTarget - :keyword notification_type: The type of notification. "Email" - :paramtype notification_type: str or - ~azure.mgmt.authorization.v2022_04_01.models.NotificationDeliveryMechanism - :keyword notification_level: The notification level. Known values are: "None", "Critical", and - "All". - :paramtype notification_level: str or - ~azure.mgmt.authorization.v2022_04_01.models.NotificationLevel - :keyword recipient_type: The recipient type. Known values are: "Requestor", "Approver", and - "Admin". - :paramtype recipient_type: str or ~azure.mgmt.authorization.v2022_04_01.models.RecipientType - :keyword notification_recipients: The list of notification recipients. - :paramtype notification_recipients: list[str] - :keyword is_default_recipients_enabled: Determines if the notification will be sent to the - recipient type specified in the policy rule. - :paramtype is_default_recipients_enabled: bool - """ - super().__init__(id=id, target=target, **kwargs) - self.rule_type: str = "RoleManagementPolicyNotificationRule" - self.notification_type = notification_type - self.notification_level = notification_level - self.recipient_type = recipient_type - self.notification_recipients = notification_recipients - self.is_default_recipients_enabled = is_default_recipients_enabled - - -class RoleManagementPolicyRuleTarget(_serialization.Model): - """The role management policy rule target. - - :ivar caller: The caller of the setting. - :vartype caller: str - :ivar operations: The type of operation. - :vartype operations: list[str] - :ivar level: The assignment level to which rule is applied. - :vartype level: str - :ivar target_objects: The list of target objects. - :vartype target_objects: list[str] - :ivar inheritable_settings: The list of inheritable settings. - :vartype inheritable_settings: list[str] - :ivar enforced_settings: The list of enforced settings. - :vartype enforced_settings: list[str] - """ - - _attribute_map = { - "caller": {"key": "caller", "type": "str"}, - "operations": {"key": "operations", "type": "[str]"}, - "level": {"key": "level", "type": "str"}, - "target_objects": {"key": "targetObjects", "type": "[str]"}, - "inheritable_settings": {"key": "inheritableSettings", "type": "[str]"}, - "enforced_settings": {"key": "enforcedSettings", "type": "[str]"}, - } - - def __init__( - self, - *, - caller: Optional[str] = None, - operations: Optional[List[str]] = None, - level: Optional[str] = None, - target_objects: Optional[List[str]] = None, - inheritable_settings: Optional[List[str]] = None, - enforced_settings: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword caller: The caller of the setting. - :paramtype caller: str - :keyword operations: The type of operation. - :paramtype operations: list[str] - :keyword level: The assignment level to which rule is applied. - :paramtype level: str - :keyword target_objects: The list of target objects. - :paramtype target_objects: list[str] - :keyword inheritable_settings: The list of inheritable settings. - :paramtype inheritable_settings: list[str] - :keyword enforced_settings: The list of enforced settings. - :paramtype enforced_settings: list[str] - """ - super().__init__(**kwargs) - self.caller = caller - self.operations = operations - self.level = level - self.target_objects = target_objects - self.inheritable_settings = inheritable_settings - self.enforced_settings = enforced_settings - - -class UserSet(_serialization.Model): - """The detail of a user. - - :ivar user_type: The type of user. Known values are: "User" and "Group". - :vartype user_type: str or ~azure.mgmt.authorization.v2022_04_01.models.UserType - :ivar is_backup: The value indicating whether the user is a backup fallback approver. - :vartype is_backup: bool - :ivar id: The object id of the user. - :vartype id: str - :ivar description: The description of the user. - :vartype description: str - """ - - _attribute_map = { - "user_type": {"key": "userType", "type": "str"}, - "is_backup": {"key": "isBackup", "type": "bool"}, - "id": {"key": "id", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - user_type: Optional[Union[str, "_models.UserType"]] = None, - is_backup: Optional[bool] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword user_type: The type of user. Known values are: "User" and "Group". - :paramtype user_type: str or ~azure.mgmt.authorization.v2022_04_01.models.UserType - :keyword is_backup: The value indicating whether the user is a backup fallback approver. - :paramtype is_backup: bool - :keyword id: The object id of the user. - :paramtype id: str - :keyword description: The description of the user. - :paramtype description: str - """ - super().__init__(**kwargs) - self.user_type = user_type - self.is_backup = is_backup - self.id = id - self.description = description - - -class ValidationResponse(_serialization.Model): - """Validation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar is_valid: Whether or not validation succeeded. - :vartype is_valid: bool - :ivar error_info: Failed validation result details. - :vartype error_info: ~azure.mgmt.authorization.v2022_04_01.models.ValidationResponseErrorInfo - """ - - _validation = { - "is_valid": {"readonly": True}, - } - - _attribute_map = { - "is_valid": {"key": "isValid", "type": "bool"}, - "error_info": {"key": "errorInfo", "type": "ValidationResponseErrorInfo"}, - } - - def __init__(self, *, error_info: Optional["_models.ValidationResponseErrorInfo"] = None, **kwargs: Any) -> None: - """ - :keyword error_info: Failed validation result details. - :paramtype error_info: ~azure.mgmt.authorization.v2022_04_01.models.ValidationResponseErrorInfo - """ - super().__init__(**kwargs) - self.is_valid = None - self.error_info = error_info - - -class ValidationResponseErrorInfo(_serialization.Model): - """Failed validation result details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code indicating why validation failed. - :vartype code: str - :ivar message: Message indicating why validation failed. - :vartype message: str - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/__init__.py deleted file mode 100644 index 336442a84fe5..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._deny_assignments_operations import DenyAssignmentsOperations -from ._provider_operations_metadata_operations import ProviderOperationsMetadataOperations -from ._role_assignments_operations import RoleAssignmentsOperations -from ._permissions_operations import PermissionsOperations -from ._role_definitions_operations import RoleDefinitionsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "DenyAssignmentsOperations", - "ProviderOperationsMetadataOperations", - "RoleAssignmentsOperations", - "PermissionsOperations", - "RoleDefinitionsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_deny_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_deny_assignments_operations.py deleted file mode 100644 index e3c38c4ba49e..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_deny_assignments_operations.py +++ /dev/null @@ -1,776 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_for_resource_request( - resource_group_name: str, - resource_provider_namespace: str, - parent_resource_path: str, - resource_type: str, - resource_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceProviderNamespace": _SERIALIZER.url( - "resource_provider_namespace", resource_provider_namespace, "str", skip_quote=True - ), - "parentResourcePath": _SERIALIZER.url("parent_resource_path", parent_resource_path, "str", skip_quote=True), - "resourceType": _SERIALIZER.url("resource_type", resource_type, "str", skip_quote=True), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_resource_group_request( - resource_group_name: str, subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(scope: str, deny_assignment_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "denyAssignmentId": _SERIALIZER.url("deny_assignment_id", deny_assignment_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_by_id_request(deny_assignment_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{denyAssignmentId}") - path_format_arguments = { - "denyAssignmentId": _SERIALIZER.url("deny_assignment_id", deny_assignment_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/denyAssignments") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class DenyAssignmentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01.AuthorizationManagementClient`'s - :attr:`deny_assignments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_resource( - self, - resource_group_name: str, - resource_provider_namespace: str, - parent_resource_path: str, - resource_type: str, - resource_name: str, - filter: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.DenyAssignment"]: - """Gets deny assignments for a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_provider_namespace: The namespace of the resource provider. Required. - :type resource_provider_namespace: str - :param parent_resource_path: The parent resource identity. Required. - :type parent_resource_path: str - :param resource_type: The resource type of the resource. Required. - :type resource_type: str - :param resource_name: The name of the resource to get deny assignments for. Required. - :type resource_name: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all deny - assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny - assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny - assignments at, above and below the scope for the specified principal. Use - $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the - scope for the specified principal. This filter is different from the principalId filter as it - returns not only those deny assignments that contain the specified principal is the Principals - list but also those deny assignments that contain the specified principal is the - ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny - assignment name and description properties are returned. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DenyAssignment or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_request( - resource_group_name=resource_group_name, - resource_provider_namespace=resource_provider_namespace, - parent_resource_path=parent_resource_path, - resource_type=resource_type, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - template_url=self.list_for_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments" - } - - @distributed_trace - def list_for_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.DenyAssignment"]: - """Gets deny assignments for a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :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 scope. Use $filter=denyAssignmentName eq '{name}' to search deny - assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny - assignments at, above and below the scope for the specified principal. Use - $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the - scope for the specified principal. This filter is different from the principalId filter as it - returns not only those deny assignments that contain the specified principal is the Principals - list but also those deny assignments that contain the specified principal is the - ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny - assignment name and description properties are returned. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DenyAssignment or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - template_url=self.list_for_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments" - } - - @distributed_trace - def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.DenyAssignment"]: - """Gets all deny assignments for the subscription. - - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all deny - assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny - assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny - assignments at, above and below the scope for the specified principal. Use - $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the - scope for the specified principal. This filter is different from the principalId filter as it - returns not only those deny assignments that contain the specified principal is the Principals - list but also those deny assignments that contain the specified principal is the - ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny - assignment name and description properties are returned. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DenyAssignment or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments"} - - @distributed_trace - def get(self, scope: str, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment: - """Get the specified deny assignment. - - :param scope: The scope of the deny assignment. Required. - :type scope: str - :param deny_assignment_id: The ID of the deny assignment to get. Required. - :type deny_assignment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DenyAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - deny_assignment_id=deny_assignment_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DenyAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}"} - - @distributed_trace - def get_by_id(self, deny_assignment_id: str, **kwargs: Any) -> _models.DenyAssignment: - """Gets a deny assignment by ID. - - :param deny_assignment_id: The fully qualified deny assignment ID. For example, use the format, - /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for - subscription level deny assignments, or - /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny - assignments. Required. - :type deny_assignment_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DenyAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DenyAssignment] = kwargs.pop("cls", None) - - request = build_get_by_id_request( - deny_assignment_id=deny_assignment_id, - api_version=api_version, - template_url=self.get_by_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DenyAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_id.metadata = {"url": "/{denyAssignmentId}"} - - @distributed_trace - def list_for_scope( - self, scope: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.DenyAssignment"]: - """Gets deny assignments for a scope. - - :param scope: The scope of the deny assignments. Required. - :type scope: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all deny - assignments at or above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny - assignments by name at specified scope. Use $filter=principalId eq '{id}' to return all deny - assignments at, above and below the scope for the specified principal. Use - $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, above and below the - scope for the specified principal. This filter is different from the principalId filter as it - returns not only those deny assignments that contain the specified principal is the Principals - list but also those deny assignments that contain the specified principal is the - ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, only the deny - assignment name and description properties are returned. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DenyAssignment or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.DenyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.DenyAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - filter=filter, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DenyAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/denyAssignments"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_permissions_operations.py deleted file mode 100644 index 5d68e5e0b826..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_permissions_operations.py +++ /dev/null @@ -1,325 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_for_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_resource_request( - resource_group_name: str, - resource_provider_namespace: str, - parent_resource_path: str, - resource_type: str, - resource_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceProviderNamespace": _SERIALIZER.url( - "resource_provider_namespace", resource_provider_namespace, "str", skip_quote=True - ), - "parentResourcePath": _SERIALIZER.url("parent_resource_path", parent_resource_path, "str", skip_quote=True), - "resourceType": _SERIALIZER.url("resource_type", resource_type, "str", skip_quote=True), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str", pattern=r".+"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class PermissionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01.AuthorizationManagementClient`'s - :attr:`permissions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Permission"]: - """Gets all permissions the caller has for a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Permission or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.Permission] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_for_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PermissionGetResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions" - } - - @distributed_trace - def list_for_resource( - self, - resource_group_name: str, - resource_provider_namespace: str, - parent_resource_path: str, - resource_type: str, - resource_name: str, - **kwargs: Any - ) -> Iterable["_models.Permission"]: - """Gets all permissions the caller has for a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_provider_namespace: The namespace of the resource provider. Required. - :type resource_provider_namespace: str - :param parent_resource_path: The parent resource identity. Required. - :type parent_resource_path: str - :param resource_type: The resource type of the resource. Required. - :type resource_type: str - :param resource_name: The name of the resource to get the permissions for. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Permission or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.Permission] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_request( - resource_group_name=resource_group_name, - resource_provider_namespace=resource_provider_namespace, - parent_resource_path=parent_resource_path, - resource_type=resource_type, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_for_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PermissionGetResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions" - } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_provider_operations_metadata_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_provider_operations_metadata_operations.py deleted file mode 100644 index fa030854e946..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_provider_operations_metadata_operations.py +++ /dev/null @@ -1,254 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_provider_namespace: str, *, expand: str = "resourceTypes", **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}" - ) - path_format_arguments = { - "resourceProviderNamespace": _SERIALIZER.url( - "resource_provider_namespace", resource_provider_namespace, "str", skip_quote=True - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(*, expand: str = "resourceTypes", **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Authorization/providerOperations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ProviderOperationsMetadataOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01.AuthorizationManagementClient`'s - :attr:`provider_operations_metadata` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get( - self, resource_provider_namespace: str, expand: str = "resourceTypes", **kwargs: Any - ) -> _models.ProviderOperationsMetadata: - """Gets provider operations metadata for the specified resource provider. - - :param resource_provider_namespace: The namespace of the resource provider. Required. - :type resource_provider_namespace: str - :param expand: Specifies whether to expand the values. Default value is "resourceTypes". - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ProviderOperationsMetadata or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.ProviderOperationsMetadata - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ProviderOperationsMetadata] = kwargs.pop("cls", None) - - request = build_get_request( - resource_provider_namespace=resource_provider_namespace, - expand=expand, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ProviderOperationsMetadata", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}"} - - @distributed_trace - def list(self, expand: str = "resourceTypes", **kwargs: Any) -> Iterable["_models.ProviderOperationsMetadata"]: - """Gets provider operations metadata for all resource providers. - - :param expand: Specifies whether to expand the values. Default value is "resourceTypes". - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProviderOperationsMetadata or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.ProviderOperationsMetadata] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.ProviderOperationsMetadataListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ProviderOperationsMetadataListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.Authorization/providerOperations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_assignments_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_assignments_operations.py deleted file mode 100644 index 5f8931ac23e9..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_assignments_operations.py +++ /dev/null @@ -1,1364 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_for_subscription_request( - subscription_id: str, *, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True) - if tenant_id is not None: - _params["tenantId"] = _SERIALIZER.query("tenant_id", tenant_id, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True) - if tenant_id is not None: - _params["tenantId"] = _SERIALIZER.query("tenant_id", tenant_id, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_resource_request( - resource_group_name: str, - resource_provider_namespace: str, - resource_type: str, - resource_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceProviderNamespace": _SERIALIZER.url( - "resource_provider_namespace", resource_provider_namespace, "str", skip_quote=True - ), - "resourceType": _SERIALIZER.url("resource_type", resource_type, "str", skip_quote=True), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True) - if tenant_id is not None: - _params["tenantId"] = _SERIALIZER.query("tenant_id", tenant_id, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - scope: str, role_assignment_name: str, *, tenant_id: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if tenant_id is not None: - _params["tenantId"] = _SERIALIZER.query("tenant_id", tenant_id, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request(scope: str, role_assignment_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - scope: str, role_assignment_name: str, *, tenant_id: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleAssignmentName": _SERIALIZER.url("role_assignment_name", role_assignment_name, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if tenant_id is not None: - _params["tenantId"] = _SERIALIZER.query("tenant_id", tenant_id, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_scope_request( - scope: str, - *, - filter: Optional[str] = None, - tenant_id: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleAssignments") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str", skip_quote=True) - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if tenant_id is not None: - _params["tenantId"] = _SERIALIZER.query("tenant_id", tenant_id, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str", skip_quote=True) - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_by_id_request(role_assignment_id: str, *, tenant_id: Optional[str] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{roleAssignmentId}") - path_format_arguments = { - "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if tenant_id is not None: - _params["tenantId"] = _SERIALIZER.query("tenant_id", tenant_id, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_by_id_request(role_assignment_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{roleAssignmentId}") - path_format_arguments = { - "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_by_id_request( - role_assignment_id: str, *, tenant_id: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{roleAssignmentId}") - path_format_arguments = { - "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if tenant_id is not None: - _params["tenantId"] = _SERIALIZER.query("tenant_id", tenant_id, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class RoleAssignmentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01.AuthorizationManagementClient`'s - :attr:`role_assignments` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_subscription( - self, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RoleAssignment"]: - """List all role assignments that apply to a subscription. - - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role - assignments at or above the scope. Use $filter=principalId eq {id} to return all role - assignments at, above or below the scope for the specified principal. Default value is None. - :type filter: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignment or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_subscription_request( - subscription_id=self._config.subscription_id, - filter=filter, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.list_for_subscription.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments" - } - - @distributed_trace - def list_for_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RoleAssignment"]: - """List all role assignments that apply to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role - assignments at or above the scope. Use $filter=principalId eq {id} to return all role - assignments at, above or below the scope for the specified principal. Default value is None. - :type filter: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignment or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - filter=filter, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.list_for_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" - } - - @distributed_trace - def list_for_resource( - self, - resource_group_name: str, - resource_provider_namespace: str, - resource_type: str, - resource_name: str, - filter: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RoleAssignment"]: - """List all role assignments that apply to a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_provider_namespace: The namespace of the resource provider. Required. - :type resource_provider_namespace: str - :param resource_type: The resource type name. For example the type name of a web app is 'sites' - (from Microsoft.Web/sites). Required. - :type resource_type: str - :param resource_name: The resource name. Required. - :type resource_name: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role - assignments at or above the scope. Use $filter=principalId eq {id} to return all role - assignments at, above or below the scope for the specified principal. Default value is None. - :type filter: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignment or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_request( - resource_group_name=resource_group_name, - resource_provider_namespace=resource_provider_namespace, - resource_type=resource_type, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - filter=filter, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.list_for_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" - } - - @distributed_trace - def get( - self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any - ) -> _models.RoleAssignment: - """Get a role assignment by scope and name. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_assignment_name: The name of the role assignment. It can be any valid GUID. - Required. - :type role_assignment_name: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - role_assignment_name=role_assignment_name, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} - - @overload - def create( - self, - scope: str, - role_assignment_name: str, - parameters: _models.RoleAssignmentCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignment: - """Create or update a role assignment by scope and name. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_assignment_name: The name of the role assignment. It can be any valid GUID. - Required. - :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Required. - :type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - scope: str, - role_assignment_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignment: - """Create or update a role assignment by scope and name. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_assignment_name: The name of the role assignment. It can be any valid GUID. - Required. - :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - scope: str, - role_assignment_name: str, - parameters: Union[_models.RoleAssignmentCreateParameters, IO], - **kwargs: Any - ) -> _models.RoleAssignment: - """Create or update a role assignment by scope and name. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_assignment_name: The name of the role assignment. It can be any valid GUID. - Required. - :type role_assignment_name: str - :param parameters: Parameters for the role assignment. Is either a - RoleAssignmentCreateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RoleAssignmentCreateParameters") - - request = build_create_request( - scope=scope, - role_assignment_name=role_assignment_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} - - @distributed_trace - def delete( - self, scope: str, role_assignment_name: str, tenant_id: Optional[str] = None, **kwargs: Any - ) -> Optional[_models.RoleAssignment]: - """Delete a role assignment by scope and name. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_assignment_name: The name of the role assignment. It can be any valid GUID. - Required. - :type role_assignment_name: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or None or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) - - request = build_delete_request( - scope=scope, - role_assignment_name=role_assignment_name, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"} - - @distributed_trace - def list_for_scope( - self, - scope: str, - filter: Optional[str] = None, - tenant_id: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RoleAssignment"]: - """List all role assignments that apply to a scope. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role - assignments at or above the scope. Use $filter=principalId eq {id} to return all role - assignments at, above or below the scope for the specified principal. Default value is None. - :type filter: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :param skip_token: The skipToken to apply on the operation. Use $skipToken={skiptoken} to - return paged role assignments following the skipToken passed. Only supported on provider level - calls. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignment or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleAssignmentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - filter=filter, - tenant_id=tenant_id, - skip_token=skip_token, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RoleAssignmentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignments"} - - @distributed_trace - def get_by_id( - self, role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any - ) -> _models.RoleAssignment: - """Get a role assignment by ID. - - :param role_assignment_id: The fully qualified ID of the role assignment including scope, - resource name, and resource type. Format: - /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. - Required. - :type role_assignment_id: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) - - request = build_get_by_id_request( - role_assignment_id=role_assignment_id, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.get_by_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_id.metadata = {"url": "/{roleAssignmentId}"} - - @overload - def create_by_id( - self, - role_assignment_id: str, - parameters: _models.RoleAssignmentCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignment: - """Create or update a role assignment by ID. - - :param role_assignment_id: The fully qualified ID of the role assignment including scope, - resource name, and resource type. Format: - /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. - Required. - :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Required. - :type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_by_id( - self, role_assignment_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RoleAssignment: - """Create or update a role assignment by ID. - - :param role_assignment_id: The fully qualified ID of the role assignment including scope, - resource name, and resource type. Format: - /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. - Required. - :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_by_id( - self, role_assignment_id: str, parameters: Union[_models.RoleAssignmentCreateParameters, IO], **kwargs: Any - ) -> _models.RoleAssignment: - """Create or update a role assignment by ID. - - :param role_assignment_id: The fully qualified ID of the role assignment including scope, - resource name, and resource type. Format: - /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. - Required. - :type role_assignment_id: str - :param parameters: Parameters for the role assignment. Is either a - RoleAssignmentCreateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignmentCreateParameters - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleAssignment] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RoleAssignmentCreateParameters") - - request = build_create_by_id_request( - role_assignment_id=role_assignment_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_by_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create_by_id.metadata = {"url": "/{roleAssignmentId}"} - - @distributed_trace - def delete_by_id( - self, role_assignment_id: str, tenant_id: Optional[str] = None, **kwargs: Any - ) -> Optional[_models.RoleAssignment]: - """Delete a role assignment by ID. - - :param role_assignment_id: The fully qualified ID of the role assignment including scope, - resource name, and resource type. Format: - /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - /subscriptions/:code:``/resourcegroups/:code:``/providers/Microsoft.Authorization/roleAssignments/:code:``. - Required. - :type role_assignment_id: str - :param tenant_id: Tenant ID for cross-tenant request. Default value is None. - :type tenant_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignment or None or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleAssignment or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Optional[_models.RoleAssignment]] = kwargs.pop("cls", None) - - request = build_delete_by_id_request( - role_assignment_id=role_assignment_id, - tenant_id=tenant_id, - api_version=api_version, - template_url=self.delete_by_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("RoleAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - delete_by_id.metadata = {"url": "/{roleAssignmentId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_definitions_operations.py deleted file mode 100644 index a5f86335ed00..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/operations/_role_definitions_operations.py +++ /dev/null @@ -1,587 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{roleId}") - path_format_arguments = { - "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RoleDefinitionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01.AuthorizationManagementClient`'s - :attr:`role_definitions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional[_models.RoleDefinition]: - """Deletes a role definition. - - :param scope: The scope of the role definition. Required. - :type scope: str - :param role_definition_id: The ID of the role definition to delete. Required. - :type role_definition_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or None or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None) - - request = build_delete_request( - scope=scope, - role_definition_id=role_definition_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} - - @distributed_trace - def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition: - """Get role definition by name (GUID). - - :param scope: The scope of the role definition. Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - role_definition_id=role_definition_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} - - @overload - def create_or_update( - self, - scope: str, - role_definition_id: str, - role_definition: _models.RoleDefinition, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleDefinition: - """Creates or updates a role definition. - - :param scope: The scope of the role definition. Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :param role_definition: The values for the role definition. Required. - :type role_definition: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - scope: str, - role_definition_id: str, - role_definition: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleDefinition: - """Creates or updates a role definition. - - :param scope: The scope of the role definition. Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :param role_definition: The values for the role definition. Required. - :type role_definition: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, scope: str, role_definition_id: str, role_definition: Union[_models.RoleDefinition, IO], **kwargs: Any - ) -> _models.RoleDefinition: - """Creates or updates a role definition. - - :param scope: The scope of the role definition. Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :param role_definition: The values for the role definition. Is either a RoleDefinition type or - a IO type. Required. - :type role_definition: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(role_definition, (IOBase, bytes)): - _content = role_definition - else: - _json = self._serialize.body(role_definition, "RoleDefinition") - - request = build_create_or_update_request( - scope=scope, - role_definition_id=role_definition_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} - - @distributed_trace - def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleDefinition"]: - """Get all role definitions that are applicable at scope and above. - - :param scope: The scope of the role definition. Required. - :type scope: str - :param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below - the given scope as well. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleDefinition or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - scope=scope, - filter=filter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RoleDefinitionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} - - @distributed_trace - def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: - """Gets a role definition by ID. - - :param role_id: The fully qualified role definition ID. Use the format, - /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for - subscription level role definitions, or - /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role - definitions. Required. - :type role_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-04-01")) - cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) - - request = build_get_by_id_request( - role_id=role_id, - api_version=api_version, - template_url=self.get_by_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_id.metadata = {"url": "/{roleId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/py.typed b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/__init__.py deleted file mode 100644 index 019f2f208c14..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._authorization_management_client import AuthorizationManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AuthorizationManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_authorization_management_client.py deleted file mode 100644 index fc34514cd200..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_authorization_management_client.py +++ /dev/null @@ -1,92 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AuthorizationManagementClientConfiguration -from .operations import RoleAssignmentScheduleRequestsOperations, RoleEligibilityScheduleRequestsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword - """Role based access control provides you a way to apply granular level policy administration down - to individual resources or resource groups. These operations enable you to manage role - assignments. A role assignment grants access to Azure Active Directory users. - - :ivar role_assignment_schedule_requests: RoleAssignmentScheduleRequestsOperations operations - :vartype role_assignment_schedule_requests: - azure.mgmt.authorization.v2022_04_01_preview.operations.RoleAssignmentScheduleRequestsOperations - :ivar role_eligibility_schedule_requests: RoleEligibilityScheduleRequestsOperations operations - :vartype role_eligibility_schedule_requests: - azure.mgmt.authorization.v2022_04_01_preview.operations.RoleEligibilityScheduleRequestsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-04-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = AuthorizationManagementClientConfiguration(credential=credential, **kwargs) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.role_assignment_schedule_requests = RoleAssignmentScheduleRequestsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01-preview" - ) - self.role_eligibility_schedule_requests = RoleEligibilityScheduleRequestsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01-preview" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "AuthorizationManagementClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_configuration.py deleted file mode 100644 index d5cab6d0c942..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_configuration.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AuthorizationManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. Default value is "2022-04-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: - super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-04-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.credential = credential - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_metadata.json deleted file mode 100644 index a256424cc2ad..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_metadata.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "chosen_version": "2022-04-01-preview", - "total_api_version_list": ["2022-04-01-preview"], - "client": { - "name": "AuthorizationManagementClient", - "filename": "_authorization_management_client", - "description": "Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role assignments. A role assignment grants access to Azure Active Directory users.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": false, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AuthorizationManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AuthorizationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - } - }, - "constant": { - }, - "call": "credential", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "role_assignment_schedule_requests": "RoleAssignmentScheduleRequestsOperations", - "role_eligibility_schedule_requests": "RoleEligibilityScheduleRequestsOperations" - } -} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_vendor.py deleted file mode 100644 index bd0df84f5319..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_vendor.py +++ /dev/null @@ -1,30 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 typing import List, cast - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_version.py deleted file mode 100644 index 77f53a3589c6..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "4.0.0" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/__init__.py deleted file mode 100644 index a6e41513a3c6..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._authorization_management_client import AuthorizationManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AuthorizationManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_authorization_management_client.py deleted file mode 100644 index cf6c398f9abd..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_authorization_management_client.py +++ /dev/null @@ -1,92 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AuthorizationManagementClientConfiguration -from .operations import RoleAssignmentScheduleRequestsOperations, RoleEligibilityScheduleRequestsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword - """Role based access control provides you a way to apply granular level policy administration down - to individual resources or resource groups. These operations enable you to manage role - assignments. A role assignment grants access to Azure Active Directory users. - - :ivar role_assignment_schedule_requests: RoleAssignmentScheduleRequestsOperations operations - :vartype role_assignment_schedule_requests: - azure.mgmt.authorization.v2022_04_01_preview.aio.operations.RoleAssignmentScheduleRequestsOperations - :ivar role_eligibility_schedule_requests: RoleEligibilityScheduleRequestsOperations operations - :vartype role_eligibility_schedule_requests: - azure.mgmt.authorization.v2022_04_01_preview.aio.operations.RoleEligibilityScheduleRequestsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-04-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = AuthorizationManagementClientConfiguration(credential=credential, **kwargs) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.role_assignment_schedule_requests = RoleAssignmentScheduleRequestsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01-preview" - ) - self.role_eligibility_schedule_requests = RoleEligibilityScheduleRequestsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-04-01-preview" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "AuthorizationManagementClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_configuration.py deleted file mode 100644 index 4682afc08b7d..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_configuration.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AuthorizationManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. Default value is "2022-04-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: - super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-04-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.credential = credential - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/__init__.py deleted file mode 100644 index 8321ef0252af..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations -from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "RoleAssignmentScheduleRequestsOperations", - "RoleEligibilityScheduleRequestsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_assignment_schedule_requests_operations.py deleted file mode 100644 index ca3e5a81d474..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_assignment_schedule_requests_operations.py +++ /dev/null @@ -1,593 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._role_assignment_schedule_requests_operations import ( - build_cancel_request, - build_create_request, - build_get_request, - build_list_for_scope_request, - build_validate_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RoleAssignmentScheduleRequestsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01_preview.aio.AuthorizationManagementClient`'s - :attr:`role_assignment_schedule_requests` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - async def create( - self, - scope: str, - role_assignment_schedule_request_name: str, - parameters: _models.RoleAssignmentScheduleRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Creates a role assignment schedule request. - - :param scope: The scope of the role assignment schedule request to create. The scope can be any - REST resource instance. For example, use - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param role_assignment_schedule_request_name: A GUID for the role assignment to create. The - name must be unique and different for each role assignment. Required. - :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - scope: str, - role_assignment_schedule_request_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Creates a role assignment schedule request. - - :param scope: The scope of the role assignment schedule request to create. The scope can be any - REST resource instance. For example, use - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param role_assignment_schedule_request_name: A GUID for the role assignment to create. The - name must be unique and different for each role assignment. Required. - :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - scope: str, - role_assignment_schedule_request_name: str, - parameters: Union[_models.RoleAssignmentScheduleRequest, IO], - **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Creates a role assignment schedule request. - - :param scope: The scope of the role assignment schedule request to create. The scope can be any - REST resource instance. For example, use - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param role_assignment_schedule_request_name: A GUID for the role assignment to create. The - name must be unique and different for each role assignment. Required. - :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Is either a - RoleAssignmentScheduleRequest type or a IO type. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest") - - request = build_create_request( - scope=scope, - role_assignment_schedule_request_name=role_assignment_schedule_request_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" - } - - @distributed_trace_async - async def get( - self, scope: str, role_assignment_schedule_request_name: str, **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Get the specified role assignment schedule request. - - :param scope: The scope of the role assignment schedule request. Required. - :type scope: str - :param role_assignment_schedule_request_name: The name (guid) of the role assignment schedule - request to get. Required. - :type role_assignment_schedule_request_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - role_assignment_schedule_request_name=role_assignment_schedule_request_name, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" - } - - @distributed_trace - def list_for_scope( - self, scope: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RoleAssignmentScheduleRequest"]: - """Gets role assignment schedule requests for a scope. - - :param scope: The scope of the role assignments schedule requests. Required. - :type scope: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role - assignment schedule requests at or above the scope. Use $filter=principalId eq {id} to return - all role assignment schedule requests at, above or below the scope for the specified principal. - Use $filter=asRequestor() to return all role assignment schedule requests requested by the - current user. Use $filter=asTarget() to return all role assignment schedule requests created - for the current user. Use $filter=asApprover() to return all role assignment schedule requests - where the current user is an approver. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignmentScheduleRequest or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - cls: ClsType[_models.RoleAssignmentScheduleRequestListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - filter=filter, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RoleAssignmentScheduleRequestListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"} - - @distributed_trace_async - async def cancel( # pylint: disable=inconsistent-return-statements - self, scope: str, role_assignment_schedule_request_name: str, **kwargs: Any - ) -> None: - """Cancels a pending role assignment schedule request. - - :param scope: The scope of the role assignment request to cancel. Required. - :type scope: str - :param role_assignment_schedule_request_name: The name of the role assignment request to - cancel. Required. - :type role_assignment_schedule_request_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_cancel_request( - scope=scope, - role_assignment_schedule_request_name=role_assignment_schedule_request_name, - api_version=api_version, - template_url=self.cancel.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - cancel.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel" - } - - @overload - async def validate( - self, - scope: str, - role_assignment_schedule_request_name: str, - parameters: _models.RoleAssignmentScheduleRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Validates a new role assignment schedule request. - - :param scope: The scope of the role assignment request to validate. Required. - :type scope: str - :param role_assignment_schedule_request_name: The name of the role assignment request to - validate. Required. - :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate( - self, - scope: str, - role_assignment_schedule_request_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Validates a new role assignment schedule request. - - :param scope: The scope of the role assignment request to validate. Required. - :type scope: str - :param role_assignment_schedule_request_name: The name of the role assignment request to - validate. Required. - :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate( - self, - scope: str, - role_assignment_schedule_request_name: str, - parameters: Union[_models.RoleAssignmentScheduleRequest, IO], - **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Validates a new role assignment schedule request. - - :param scope: The scope of the role assignment request to validate. Required. - :type scope: str - :param role_assignment_schedule_request_name: The name of the role assignment request to - validate. Required. - :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Is either a - RoleAssignmentScheduleRequest type or a IO type. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest") - - request = build_validate_request( - scope=scope, - role_assignment_schedule_request_name=role_assignment_schedule_request_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.validate.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - validate.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate" - } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_eligibility_schedule_requests_operations.py deleted file mode 100644 index 530046bd23c0..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/aio/operations/_role_eligibility_schedule_requests_operations.py +++ /dev/null @@ -1,593 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._role_eligibility_schedule_requests_operations import ( - build_cancel_request, - build_create_request, - build_get_request, - build_list_for_scope_request, - build_validate_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RoleEligibilityScheduleRequestsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01_preview.aio.AuthorizationManagementClient`'s - :attr:`role_eligibility_schedule_requests` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - async def create( - self, - scope: str, - role_eligibility_schedule_request_name: str, - parameters: _models.RoleEligibilityScheduleRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Creates a role eligibility schedule request. - - :param scope: The scope of the role eligibility schedule request to create. The scope can be - any REST resource instance. For example, use - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility to create. It - can be any valid GUID. Required. - :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - scope: str, - role_eligibility_schedule_request_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Creates a role eligibility schedule request. - - :param scope: The scope of the role eligibility schedule request to create. The scope can be - any REST resource instance. For example, use - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility to create. It - can be any valid GUID. Required. - :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - scope: str, - role_eligibility_schedule_request_name: str, - parameters: Union[_models.RoleEligibilityScheduleRequest, IO], - **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Creates a role eligibility schedule request. - - :param scope: The scope of the role eligibility schedule request to create. The scope can be - any REST resource instance. For example, use - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility to create. It - can be any valid GUID. Required. - :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Is either a - RoleEligibilityScheduleRequest type or a IO type. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest") - - request = build_create_request( - scope=scope, - role_eligibility_schedule_request_name=role_eligibility_schedule_request_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" - } - - @distributed_trace_async - async def get( - self, scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Get the specified role eligibility schedule request. - - :param scope: The scope of the role eligibility schedule request. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name (guid) of the role eligibility schedule - request to get. Required. - :type role_eligibility_schedule_request_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - role_eligibility_schedule_request_name=role_eligibility_schedule_request_name, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" - } - - @distributed_trace - def list_for_scope( - self, scope: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RoleEligibilityScheduleRequest"]: - """Gets role eligibility schedule requests for a scope. - - :param scope: The scope of the role eligibility schedule requests. Required. - :type scope: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role - eligibility schedule requests at or above the scope. Use $filter=principalId eq {id} to return - all role eligibility schedule requests at, above or below the scope for the specified - principal. Use $filter=asRequestor() to return all role eligibility schedule requests requested - by the current user. Use $filter=asTarget() to return all role eligibility schedule requests - created for the current user. Use $filter=asApprover() to return all role eligibility schedule - requests where the current user is an approver. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleEligibilityScheduleRequest or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - cls: ClsType[_models.RoleEligibilityScheduleRequestListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - filter=filter, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RoleEligibilityScheduleRequestListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"} - - @distributed_trace_async - async def cancel( # pylint: disable=inconsistent-return-statements - self, scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any - ) -> None: - """Cancels a pending role eligibility schedule request. - - :param scope: The scope of the role eligibility request to cancel. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility request to - cancel. Required. - :type role_eligibility_schedule_request_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_cancel_request( - scope=scope, - role_eligibility_schedule_request_name=role_eligibility_schedule_request_name, - api_version=api_version, - template_url=self.cancel.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - cancel.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel" - } - - @overload - async def validate( - self, - scope: str, - role_eligibility_schedule_request_name: str, - parameters: _models.RoleEligibilityScheduleRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Validates a new role eligibility schedule request. - - :param scope: The scope of the role eligibility request to validate. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility request to - validate. Required. - :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def validate( - self, - scope: str, - role_eligibility_schedule_request_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Validates a new role eligibility schedule request. - - :param scope: The scope of the role eligibility request to validate. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility request to - validate. Required. - :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def validate( - self, - scope: str, - role_eligibility_schedule_request_name: str, - parameters: Union[_models.RoleEligibilityScheduleRequest, IO], - **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Validates a new role eligibility schedule request. - - :param scope: The scope of the role eligibility request to validate. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility request to - validate. Required. - :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Is either a - RoleEligibilityScheduleRequest type or a IO type. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest") - - request = build_validate_request( - scope=scope, - role_eligibility_schedule_request_name=role_eligibility_schedule_request_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.validate.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - validate.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate" - } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/__init__.py deleted file mode 100644 index dcfd7d49a517..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/__init__.py +++ /dev/null @@ -1,59 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import CloudErrorBody -from ._models_py3 import ExpandedProperties -from ._models_py3 import ExpandedPropertiesPrincipal -from ._models_py3 import ExpandedPropertiesRoleDefinition -from ._models_py3 import ExpandedPropertiesScope -from ._models_py3 import RoleAssignmentScheduleRequest -from ._models_py3 import RoleAssignmentScheduleRequestFilter -from ._models_py3 import RoleAssignmentScheduleRequestListResult -from ._models_py3 import RoleAssignmentScheduleRequestPropertiesScheduleInfo -from ._models_py3 import RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration -from ._models_py3 import RoleAssignmentScheduleRequestPropertiesTicketInfo -from ._models_py3 import RoleEligibilityScheduleRequest -from ._models_py3 import RoleEligibilityScheduleRequestFilter -from ._models_py3 import RoleEligibilityScheduleRequestListResult -from ._models_py3 import RoleEligibilityScheduleRequestPropertiesScheduleInfo -from ._models_py3 import RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration -from ._models_py3 import RoleEligibilityScheduleRequestPropertiesTicketInfo - -from ._authorization_management_client_enums import PrincipalType -from ._authorization_management_client_enums import RequestType -from ._authorization_management_client_enums import Status -from ._authorization_management_client_enums import Type -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "CloudErrorBody", - "ExpandedProperties", - "ExpandedPropertiesPrincipal", - "ExpandedPropertiesRoleDefinition", - "ExpandedPropertiesScope", - "RoleAssignmentScheduleRequest", - "RoleAssignmentScheduleRequestFilter", - "RoleAssignmentScheduleRequestListResult", - "RoleAssignmentScheduleRequestPropertiesScheduleInfo", - "RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration", - "RoleAssignmentScheduleRequestPropertiesTicketInfo", - "RoleEligibilityScheduleRequest", - "RoleEligibilityScheduleRequestFilter", - "RoleEligibilityScheduleRequestListResult", - "RoleEligibilityScheduleRequestPropertiesScheduleInfo", - "RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration", - "RoleEligibilityScheduleRequestPropertiesTicketInfo", - "PrincipalType", - "RequestType", - "Status", - "Type", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/_authorization_management_client_enums.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/_authorization_management_client_enums.py deleted file mode 100644 index ee7835ef7e2e..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/_authorization_management_client_enums.py +++ /dev/null @@ -1,69 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class PrincipalType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The principal type of the assigned principal ID.""" - - USER = "User" - GROUP = "Group" - SERVICE_PRINCIPAL = "ServicePrincipal" - FOREIGN_GROUP = "ForeignGroup" - DEVICE = "Device" - - -class RequestType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc.""" - - ADMIN_ASSIGN = "AdminAssign" - ADMIN_REMOVE = "AdminRemove" - ADMIN_UPDATE = "AdminUpdate" - ADMIN_EXTEND = "AdminExtend" - ADMIN_RENEW = "AdminRenew" - SELF_ACTIVATE = "SelfActivate" - SELF_DEACTIVATE = "SelfDeactivate" - SELF_EXTEND = "SelfExtend" - SELF_RENEW = "SelfRenew" - - -class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The status of the role assignment schedule request.""" - - ACCEPTED = "Accepted" - PENDING_EVALUATION = "PendingEvaluation" - GRANTED = "Granted" - DENIED = "Denied" - PENDING_PROVISIONING = "PendingProvisioning" - PROVISIONED = "Provisioned" - PENDING_REVOCATION = "PendingRevocation" - REVOKED = "Revoked" - CANCELED = "Canceled" - FAILED = "Failed" - PENDING_APPROVAL_PROVISIONING = "PendingApprovalProvisioning" - PENDING_APPROVAL = "PendingApproval" - FAILED_AS_RESOURCE_IS_LOCKED = "FailedAsResourceIsLocked" - PENDING_ADMIN_DECISION = "PendingAdminDecision" - ADMIN_APPROVED = "AdminApproved" - ADMIN_DENIED = "AdminDenied" - TIMED_OUT = "TimedOut" - PROVISIONING_STARTED = "ProvisioningStarted" - INVALID = "Invalid" - PENDING_SCHEDULE_CREATION = "PendingScheduleCreation" - SCHEDULE_CREATED = "ScheduleCreated" - PENDING_EXTERNAL_PROVISIONING = "PendingExternalProvisioning" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of the role assignment schedule expiration.""" - - AFTER_DURATION = "AfterDuration" - AFTER_DATE_TIME = "AfterDateTime" - NO_EXPIRATION = "NoExpiration" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/_models_py3.py deleted file mode 100644 index ae6cb622ab14..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/_models_py3.py +++ /dev/null @@ -1,941 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 datetime -from typing import Any, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class CloudErrorBody(_serialization.Model): - """An error response from the service. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class ExpandedProperties(_serialization.Model): - """Expanded info of resource, role and principal. - - :ivar scope: Details of the resource scope. - :vartype scope: ~azure.mgmt.authorization.v2022_04_01_preview.models.ExpandedPropertiesScope - :ivar role_definition: Details of role definition. - :vartype role_definition: - ~azure.mgmt.authorization.v2022_04_01_preview.models.ExpandedPropertiesRoleDefinition - :ivar principal: Details of the principal. - :vartype principal: - ~azure.mgmt.authorization.v2022_04_01_preview.models.ExpandedPropertiesPrincipal - """ - - _attribute_map = { - "scope": {"key": "scope", "type": "ExpandedPropertiesScope"}, - "role_definition": {"key": "roleDefinition", "type": "ExpandedPropertiesRoleDefinition"}, - "principal": {"key": "principal", "type": "ExpandedPropertiesPrincipal"}, - } - - def __init__( - self, - *, - scope: Optional["_models.ExpandedPropertiesScope"] = None, - role_definition: Optional["_models.ExpandedPropertiesRoleDefinition"] = None, - principal: Optional["_models.ExpandedPropertiesPrincipal"] = None, - **kwargs: Any - ) -> None: - """ - :keyword scope: Details of the resource scope. - :paramtype scope: ~azure.mgmt.authorization.v2022_04_01_preview.models.ExpandedPropertiesScope - :keyword role_definition: Details of role definition. - :paramtype role_definition: - ~azure.mgmt.authorization.v2022_04_01_preview.models.ExpandedPropertiesRoleDefinition - :keyword principal: Details of the principal. - :paramtype principal: - ~azure.mgmt.authorization.v2022_04_01_preview.models.ExpandedPropertiesPrincipal - """ - super().__init__(**kwargs) - self.scope = scope - self.role_definition = role_definition - self.principal = principal - - -class ExpandedPropertiesPrincipal(_serialization.Model): - """Details of the principal. - - :ivar id: Id of the principal. - :vartype id: str - :ivar display_name: Display name of the principal. - :vartype display_name: str - :ivar email: Email id of the principal. - :vartype email: str - :ivar type: Type of the principal. - :vartype type: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "email": {"key": "email", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - display_name: Optional[str] = None, - email: Optional[str] = None, - type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the principal. - :paramtype id: str - :keyword display_name: Display name of the principal. - :paramtype display_name: str - :keyword email: Email id of the principal. - :paramtype email: str - :keyword type: Type of the principal. - :paramtype type: str - """ - super().__init__(**kwargs) - self.id = id - self.display_name = display_name - self.email = email - self.type = type - - -class ExpandedPropertiesRoleDefinition(_serialization.Model): - """Details of role definition. - - :ivar id: Id of the role definition. - :vartype id: str - :ivar display_name: Display name of the role definition. - :vartype display_name: str - :ivar type: Type of the role definition. - :vartype type: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - display_name: Optional[str] = None, - type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Id of the role definition. - :paramtype id: str - :keyword display_name: Display name of the role definition. - :paramtype display_name: str - :keyword type: Type of the role definition. - :paramtype type: str - """ - super().__init__(**kwargs) - self.id = id - self.display_name = display_name - self.type = type - - -class ExpandedPropertiesScope(_serialization.Model): - """Details of the resource scope. - - :ivar id: Scope id of the resource. - :vartype id: str - :ivar display_name: Display name of the resource. - :vartype display_name: str - :ivar type: Type of the resource. - :vartype type: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - display_name: Optional[str] = None, - type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Scope id of the resource. - :paramtype id: str - :keyword display_name: Display name of the resource. - :paramtype display_name: str - :keyword type: Type of the resource. - :paramtype type: str - """ - super().__init__(**kwargs) - self.id = id - self.display_name = display_name - self.type = type - - -class RoleAssignmentScheduleRequest(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Role Assignment schedule request. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The role assignment schedule request ID. - :vartype id: str - :ivar name: The role assignment schedule request name. - :vartype name: str - :ivar type: The role assignment schedule request type. - :vartype type: str - :ivar scope: The role assignment schedule request scope. - :vartype scope: str - :ivar role_definition_id: The role definition ID. - :vartype role_definition_id: str - :ivar principal_id: The principal ID. - :vartype principal_id: str - :ivar principal_type: The principal type of the assigned principal ID. Known values are: - "User", "Group", "ServicePrincipal", "ForeignGroup", and "Device". - :vartype principal_type: str or - ~azure.mgmt.authorization.v2022_04_01_preview.models.PrincipalType - :ivar request_type: The type of the role assignment schedule request. Eg: SelfActivate, - AdminAssign etc. Known values are: "AdminAssign", "AdminRemove", "AdminUpdate", "AdminExtend", - "AdminRenew", "SelfActivate", "SelfDeactivate", "SelfExtend", and "SelfRenew". - :vartype request_type: str or ~azure.mgmt.authorization.v2022_04_01_preview.models.RequestType - :ivar status: The status of the role assignment schedule request. Known values are: "Accepted", - "PendingEvaluation", "Granted", "Denied", "PendingProvisioning", "Provisioned", - "PendingRevocation", "Revoked", "Canceled", "Failed", "PendingApprovalProvisioning", - "PendingApproval", "FailedAsResourceIsLocked", "PendingAdminDecision", "AdminApproved", - "AdminDenied", "TimedOut", "ProvisioningStarted", "Invalid", "PendingScheduleCreation", - "ScheduleCreated", and "PendingExternalProvisioning". - :vartype status: str or ~azure.mgmt.authorization.v2022_04_01_preview.models.Status - :ivar approval_id: The approvalId of the role assignment schedule request. - :vartype approval_id: str - :ivar target_role_assignment_schedule_id: The resultant role assignment schedule id or the role - assignment schedule id being updated. - :vartype target_role_assignment_schedule_id: str - :ivar target_role_assignment_schedule_instance_id: The role assignment schedule instance id - being updated. - :vartype target_role_assignment_schedule_instance_id: str - :ivar schedule_info: Schedule info of the role assignment schedule. - :vartype schedule_info: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequestPropertiesScheduleInfo - :ivar linked_role_eligibility_schedule_id: The linked role eligibility schedule id - to - activate an eligibility. - :vartype linked_role_eligibility_schedule_id: str - :ivar justification: Justification for the role assignment. - :vartype justification: str - :ivar ticket_info: Ticket Info of the role assignment. - :vartype ticket_info: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequestPropertiesTicketInfo - :ivar 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'. - :vartype condition: str - :ivar condition_version: Version of the condition. Currently accepted value is '2.0'. - :vartype condition_version: str - :ivar created_on: DateTime when role assignment schedule request was created. - :vartype created_on: ~datetime.datetime - :ivar requestor_id: Id of the user who created this request. - :vartype requestor_id: str - :ivar expanded_properties: Additional properties of principal, scope and role definition. - :vartype expanded_properties: - ~azure.mgmt.authorization.v2022_04_01_preview.models.ExpandedProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "scope": {"readonly": True}, - "principal_type": {"readonly": True}, - "status": {"readonly": True}, - "approval_id": {"readonly": True}, - "created_on": {"readonly": True}, - "requestor_id": {"readonly": True}, - "expanded_properties": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "scope": {"key": "properties.scope", "type": "str"}, - "role_definition_id": {"key": "properties.roleDefinitionId", "type": "str"}, - "principal_id": {"key": "properties.principalId", "type": "str"}, - "principal_type": {"key": "properties.principalType", "type": "str"}, - "request_type": {"key": "properties.requestType", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "approval_id": {"key": "properties.approvalId", "type": "str"}, - "target_role_assignment_schedule_id": {"key": "properties.targetRoleAssignmentScheduleId", "type": "str"}, - "target_role_assignment_schedule_instance_id": { - "key": "properties.targetRoleAssignmentScheduleInstanceId", - "type": "str", - }, - "schedule_info": { - "key": "properties.scheduleInfo", - "type": "RoleAssignmentScheduleRequestPropertiesScheduleInfo", - }, - "linked_role_eligibility_schedule_id": {"key": "properties.linkedRoleEligibilityScheduleId", "type": "str"}, - "justification": {"key": "properties.justification", "type": "str"}, - "ticket_info": {"key": "properties.ticketInfo", "type": "RoleAssignmentScheduleRequestPropertiesTicketInfo"}, - "condition": {"key": "properties.condition", "type": "str"}, - "condition_version": {"key": "properties.conditionVersion", "type": "str"}, - "created_on": {"key": "properties.createdOn", "type": "iso-8601"}, - "requestor_id": {"key": "properties.requestorId", "type": "str"}, - "expanded_properties": {"key": "properties.expandedProperties", "type": "ExpandedProperties"}, - } - - def __init__( - self, - *, - role_definition_id: Optional[str] = None, - principal_id: Optional[str] = None, - request_type: Optional[Union[str, "_models.RequestType"]] = None, - target_role_assignment_schedule_id: Optional[str] = None, - target_role_assignment_schedule_instance_id: Optional[str] = None, - schedule_info: Optional["_models.RoleAssignmentScheduleRequestPropertiesScheduleInfo"] = None, - linked_role_eligibility_schedule_id: Optional[str] = None, - justification: Optional[str] = None, - ticket_info: Optional["_models.RoleAssignmentScheduleRequestPropertiesTicketInfo"] = None, - condition: Optional[str] = None, - condition_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword role_definition_id: The role definition ID. - :paramtype role_definition_id: str - :keyword principal_id: The principal ID. - :paramtype principal_id: str - :keyword request_type: The type of the role assignment schedule request. Eg: SelfActivate, - AdminAssign etc. Known values are: "AdminAssign", "AdminRemove", "AdminUpdate", "AdminExtend", - "AdminRenew", "SelfActivate", "SelfDeactivate", "SelfExtend", and "SelfRenew". - :paramtype request_type: str or - ~azure.mgmt.authorization.v2022_04_01_preview.models.RequestType - :keyword target_role_assignment_schedule_id: The resultant role assignment schedule id or the - role assignment schedule id being updated. - :paramtype target_role_assignment_schedule_id: str - :keyword target_role_assignment_schedule_instance_id: The role assignment schedule instance id - being updated. - :paramtype target_role_assignment_schedule_instance_id: str - :keyword schedule_info: Schedule info of the role assignment schedule. - :paramtype schedule_info: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequestPropertiesScheduleInfo - :keyword linked_role_eligibility_schedule_id: The linked role eligibility schedule id - to - activate an eligibility. - :paramtype linked_role_eligibility_schedule_id: str - :keyword justification: Justification for the role assignment. - :paramtype justification: str - :keyword ticket_info: Ticket Info of the role assignment. - :paramtype ticket_info: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequestPropertiesTicketInfo - :keyword 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'. - :paramtype condition: str - :keyword condition_version: Version of the condition. Currently accepted value is '2.0'. - :paramtype condition_version: str - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.scope = None - self.role_definition_id = role_definition_id - self.principal_id = principal_id - self.principal_type = None - self.request_type = request_type - self.status = None - self.approval_id = None - self.target_role_assignment_schedule_id = target_role_assignment_schedule_id - self.target_role_assignment_schedule_instance_id = target_role_assignment_schedule_instance_id - self.schedule_info = schedule_info - self.linked_role_eligibility_schedule_id = linked_role_eligibility_schedule_id - self.justification = justification - self.ticket_info = ticket_info - self.condition = condition - self.condition_version = condition_version - self.created_on = None - self.requestor_id = None - self.expanded_properties = None - - -class RoleAssignmentScheduleRequestFilter(_serialization.Model): - """Role assignment schedule request filter. - - :ivar principal_id: Returns role assignment requests of the specific principal. - :vartype principal_id: str - :ivar role_definition_id: Returns role assignment requests of the specific role definition. - :vartype role_definition_id: str - :ivar requestor_id: Returns role assignment requests created by specific principal. - :vartype requestor_id: str - :ivar status: Returns role assignment requests of specific status. - :vartype status: str - """ - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "role_definition_id": {"key": "roleDefinitionId", "type": "str"}, - "requestor_id": {"key": "requestorId", "type": "str"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - principal_id: Optional[str] = None, - role_definition_id: Optional[str] = None, - requestor_id: Optional[str] = None, - status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword principal_id: Returns role assignment requests of the specific principal. - :paramtype principal_id: str - :keyword role_definition_id: Returns role assignment requests of the specific role definition. - :paramtype role_definition_id: str - :keyword requestor_id: Returns role assignment requests created by specific principal. - :paramtype requestor_id: str - :keyword status: Returns role assignment requests of specific status. - :paramtype status: str - """ - super().__init__(**kwargs) - self.principal_id = principal_id - self.role_definition_id = role_definition_id - self.requestor_id = requestor_id - self.status = status - - -class RoleAssignmentScheduleRequestListResult(_serialization.Model): - """Role assignment schedule request list operation result. - - :ivar value: Role assignment schedule request list. - :vartype value: - list[~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[RoleAssignmentScheduleRequest]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.RoleAssignmentScheduleRequest"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Role assignment schedule request list. - :paramtype value: - list[~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RoleAssignmentScheduleRequestPropertiesScheduleInfo(_serialization.Model): - """Schedule info of the role assignment schedule. - - :ivar start_date_time: Start DateTime of the role assignment schedule. - :vartype start_date_time: ~datetime.datetime - :ivar expiration: Expiration of the role assignment schedule. - :vartype expiration: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration - """ - - _attribute_map = { - "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, - "expiration": {"key": "expiration", "type": "RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration"}, - } - - def __init__( - self, - *, - start_date_time: Optional[datetime.datetime] = None, - expiration: Optional["_models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword start_date_time: Start DateTime of the role assignment schedule. - :paramtype start_date_time: ~datetime.datetime - :keyword expiration: Expiration of the role assignment schedule. - :paramtype expiration: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration - """ - super().__init__(**kwargs) - self.start_date_time = start_date_time - self.expiration = expiration - - -class RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration(_serialization.Model): - """Expiration of the role assignment schedule. - - :ivar type: Type of the role assignment schedule expiration. Known values are: "AfterDuration", - "AfterDateTime", and "NoExpiration". - :vartype type: str or ~azure.mgmt.authorization.v2022_04_01_preview.models.Type - :ivar end_date_time: End DateTime of the role assignment schedule. - :vartype end_date_time: ~datetime.datetime - :ivar duration: Duration of the role assignment schedule in TimeSpan. - :vartype duration: str - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "end_date_time": {"key": "endDateTime", "type": "iso-8601"}, - "duration": {"key": "duration", "type": "str"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.Type"]] = None, - end_date_time: Optional[datetime.datetime] = None, - duration: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the role assignment schedule expiration. Known values are: - "AfterDuration", "AfterDateTime", and "NoExpiration". - :paramtype type: str or ~azure.mgmt.authorization.v2022_04_01_preview.models.Type - :keyword end_date_time: End DateTime of the role assignment schedule. - :paramtype end_date_time: ~datetime.datetime - :keyword duration: Duration of the role assignment schedule in TimeSpan. - :paramtype duration: str - """ - super().__init__(**kwargs) - self.type = type - self.end_date_time = end_date_time - self.duration = duration - - -class RoleAssignmentScheduleRequestPropertiesTicketInfo(_serialization.Model): - """Ticket Info of the role assignment. - - :ivar ticket_number: Ticket number for the role assignment. - :vartype ticket_number: str - :ivar ticket_system: Ticket system name for the role assignment. - :vartype ticket_system: str - """ - - _attribute_map = { - "ticket_number": {"key": "ticketNumber", "type": "str"}, - "ticket_system": {"key": "ticketSystem", "type": "str"}, - } - - def __init__( - self, *, ticket_number: Optional[str] = None, ticket_system: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword ticket_number: Ticket number for the role assignment. - :paramtype ticket_number: str - :keyword ticket_system: Ticket system name for the role assignment. - :paramtype ticket_system: str - """ - super().__init__(**kwargs) - self.ticket_number = ticket_number - self.ticket_system = ticket_system - - -class RoleEligibilityScheduleRequest(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Role Eligibility schedule request. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The role eligibility schedule request ID. - :vartype id: str - :ivar name: The role eligibility schedule request name. - :vartype name: str - :ivar type: The role eligibility schedule request type. - :vartype type: str - :ivar scope: The role eligibility schedule request scope. - :vartype scope: str - :ivar role_definition_id: The role definition ID. - :vartype role_definition_id: str - :ivar principal_id: The principal ID. - :vartype principal_id: str - :ivar principal_type: The principal type of the assigned principal ID. Known values are: - "User", "Group", "ServicePrincipal", "ForeignGroup", and "Device". - :vartype principal_type: str or - ~azure.mgmt.authorization.v2022_04_01_preview.models.PrincipalType - :ivar request_type: The type of the role assignment schedule request. Eg: SelfActivate, - AdminAssign etc. Known values are: "AdminAssign", "AdminRemove", "AdminUpdate", "AdminExtend", - "AdminRenew", "SelfActivate", "SelfDeactivate", "SelfExtend", and "SelfRenew". - :vartype request_type: str or ~azure.mgmt.authorization.v2022_04_01_preview.models.RequestType - :ivar status: The status of the role eligibility schedule request. Known values are: - "Accepted", "PendingEvaluation", "Granted", "Denied", "PendingProvisioning", "Provisioned", - "PendingRevocation", "Revoked", "Canceled", "Failed", "PendingApprovalProvisioning", - "PendingApproval", "FailedAsResourceIsLocked", "PendingAdminDecision", "AdminApproved", - "AdminDenied", "TimedOut", "ProvisioningStarted", "Invalid", "PendingScheduleCreation", - "ScheduleCreated", and "PendingExternalProvisioning". - :vartype status: str or ~azure.mgmt.authorization.v2022_04_01_preview.models.Status - :ivar approval_id: The approvalId of the role eligibility schedule request. - :vartype approval_id: str - :ivar schedule_info: Schedule info of the role eligibility schedule. - :vartype schedule_info: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequestPropertiesScheduleInfo - :ivar target_role_eligibility_schedule_id: The resultant role eligibility schedule id or the - role eligibility schedule id being updated. - :vartype target_role_eligibility_schedule_id: str - :ivar target_role_eligibility_schedule_instance_id: The role eligibility schedule instance id - being updated. - :vartype target_role_eligibility_schedule_instance_id: str - :ivar justification: Justification for the role eligibility. - :vartype justification: str - :ivar ticket_info: Ticket Info of the role eligibility. - :vartype ticket_info: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequestPropertiesTicketInfo - :ivar 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'. - :vartype condition: str - :ivar condition_version: Version of the condition. Currently accepted value is '2.0'. - :vartype condition_version: str - :ivar created_on: DateTime when role eligibility schedule request was created. - :vartype created_on: ~datetime.datetime - :ivar requestor_id: Id of the user who created this request. - :vartype requestor_id: str - :ivar expanded_properties: Additional properties of principal, scope and role definition. - :vartype expanded_properties: - ~azure.mgmt.authorization.v2022_04_01_preview.models.ExpandedProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "scope": {"readonly": True}, - "principal_type": {"readonly": True}, - "status": {"readonly": True}, - "approval_id": {"readonly": True}, - "created_on": {"readonly": True}, - "requestor_id": {"readonly": True}, - "expanded_properties": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "scope": {"key": "properties.scope", "type": "str"}, - "role_definition_id": {"key": "properties.roleDefinitionId", "type": "str"}, - "principal_id": {"key": "properties.principalId", "type": "str"}, - "principal_type": {"key": "properties.principalType", "type": "str"}, - "request_type": {"key": "properties.requestType", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "approval_id": {"key": "properties.approvalId", "type": "str"}, - "schedule_info": { - "key": "properties.scheduleInfo", - "type": "RoleEligibilityScheduleRequestPropertiesScheduleInfo", - }, - "target_role_eligibility_schedule_id": {"key": "properties.targetRoleEligibilityScheduleId", "type": "str"}, - "target_role_eligibility_schedule_instance_id": { - "key": "properties.targetRoleEligibilityScheduleInstanceId", - "type": "str", - }, - "justification": {"key": "properties.justification", "type": "str"}, - "ticket_info": {"key": "properties.ticketInfo", "type": "RoleEligibilityScheduleRequestPropertiesTicketInfo"}, - "condition": {"key": "properties.condition", "type": "str"}, - "condition_version": {"key": "properties.conditionVersion", "type": "str"}, - "created_on": {"key": "properties.createdOn", "type": "iso-8601"}, - "requestor_id": {"key": "properties.requestorId", "type": "str"}, - "expanded_properties": {"key": "properties.expandedProperties", "type": "ExpandedProperties"}, - } - - def __init__( - self, - *, - role_definition_id: Optional[str] = None, - principal_id: Optional[str] = None, - request_type: Optional[Union[str, "_models.RequestType"]] = None, - schedule_info: Optional["_models.RoleEligibilityScheduleRequestPropertiesScheduleInfo"] = None, - target_role_eligibility_schedule_id: Optional[str] = None, - target_role_eligibility_schedule_instance_id: Optional[str] = None, - justification: Optional[str] = None, - ticket_info: Optional["_models.RoleEligibilityScheduleRequestPropertiesTicketInfo"] = None, - condition: Optional[str] = None, - condition_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword role_definition_id: The role definition ID. - :paramtype role_definition_id: str - :keyword principal_id: The principal ID. - :paramtype principal_id: str - :keyword request_type: The type of the role assignment schedule request. Eg: SelfActivate, - AdminAssign etc. Known values are: "AdminAssign", "AdminRemove", "AdminUpdate", "AdminExtend", - "AdminRenew", "SelfActivate", "SelfDeactivate", "SelfExtend", and "SelfRenew". - :paramtype request_type: str or - ~azure.mgmt.authorization.v2022_04_01_preview.models.RequestType - :keyword schedule_info: Schedule info of the role eligibility schedule. - :paramtype schedule_info: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequestPropertiesScheduleInfo - :keyword target_role_eligibility_schedule_id: The resultant role eligibility schedule id or the - role eligibility schedule id being updated. - :paramtype target_role_eligibility_schedule_id: str - :keyword target_role_eligibility_schedule_instance_id: The role eligibility schedule instance - id being updated. - :paramtype target_role_eligibility_schedule_instance_id: str - :keyword justification: Justification for the role eligibility. - :paramtype justification: str - :keyword ticket_info: Ticket Info of the role eligibility. - :paramtype ticket_info: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequestPropertiesTicketInfo - :keyword 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'. - :paramtype condition: str - :keyword condition_version: Version of the condition. Currently accepted value is '2.0'. - :paramtype condition_version: str - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.scope = None - self.role_definition_id = role_definition_id - self.principal_id = principal_id - self.principal_type = None - self.request_type = request_type - self.status = None - self.approval_id = None - self.schedule_info = schedule_info - self.target_role_eligibility_schedule_id = target_role_eligibility_schedule_id - self.target_role_eligibility_schedule_instance_id = target_role_eligibility_schedule_instance_id - self.justification = justification - self.ticket_info = ticket_info - self.condition = condition - self.condition_version = condition_version - self.created_on = None - self.requestor_id = None - self.expanded_properties = None - - -class RoleEligibilityScheduleRequestFilter(_serialization.Model): - """Role eligibility schedule request filter. - - :ivar principal_id: Returns role eligibility requests of the specific principal. - :vartype principal_id: str - :ivar role_definition_id: Returns role eligibility requests of the specific role definition. - :vartype role_definition_id: str - :ivar requestor_id: Returns role eligibility requests created by specific principal. - :vartype requestor_id: str - :ivar status: Returns role eligibility requests of specific status. - :vartype status: str - """ - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "role_definition_id": {"key": "roleDefinitionId", "type": "str"}, - "requestor_id": {"key": "requestorId", "type": "str"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - principal_id: Optional[str] = None, - role_definition_id: Optional[str] = None, - requestor_id: Optional[str] = None, - status: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword principal_id: Returns role eligibility requests of the specific principal. - :paramtype principal_id: str - :keyword role_definition_id: Returns role eligibility requests of the specific role definition. - :paramtype role_definition_id: str - :keyword requestor_id: Returns role eligibility requests created by specific principal. - :paramtype requestor_id: str - :keyword status: Returns role eligibility requests of specific status. - :paramtype status: str - """ - super().__init__(**kwargs) - self.principal_id = principal_id - self.role_definition_id = role_definition_id - self.requestor_id = requestor_id - self.status = status - - -class RoleEligibilityScheduleRequestListResult(_serialization.Model): - """Role eligibility schedule request list operation result. - - :ivar value: Role eligibility schedule request list. - :vartype value: - list[~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[RoleEligibilityScheduleRequest]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.RoleEligibilityScheduleRequest"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Role eligibility schedule request list. - :paramtype value: - list[~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RoleEligibilityScheduleRequestPropertiesScheduleInfo(_serialization.Model): - """Schedule info of the role eligibility schedule. - - :ivar start_date_time: Start DateTime of the role eligibility schedule. - :vartype start_date_time: ~datetime.datetime - :ivar expiration: Expiration of the role eligibility schedule. - :vartype expiration: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration - """ - - _attribute_map = { - "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, - "expiration": {"key": "expiration", "type": "RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration"}, - } - - def __init__( - self, - *, - start_date_time: Optional[datetime.datetime] = None, - expiration: Optional["_models.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword start_date_time: Start DateTime of the role eligibility schedule. - :paramtype start_date_time: ~datetime.datetime - :keyword expiration: Expiration of the role eligibility schedule. - :paramtype expiration: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration - """ - super().__init__(**kwargs) - self.start_date_time = start_date_time - self.expiration = expiration - - -class RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration(_serialization.Model): - """Expiration of the role eligibility schedule. - - :ivar type: Type of the role eligibility schedule expiration. Known values are: - "AfterDuration", "AfterDateTime", and "NoExpiration". - :vartype type: str or ~azure.mgmt.authorization.v2022_04_01_preview.models.Type - :ivar end_date_time: End DateTime of the role eligibility schedule. - :vartype end_date_time: ~datetime.datetime - :ivar duration: Duration of the role eligibility schedule in TimeSpan. - :vartype duration: str - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "end_date_time": {"key": "endDateTime", "type": "iso-8601"}, - "duration": {"key": "duration", "type": "str"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.Type"]] = None, - end_date_time: Optional[datetime.datetime] = None, - duration: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of the role eligibility schedule expiration. Known values are: - "AfterDuration", "AfterDateTime", and "NoExpiration". - :paramtype type: str or ~azure.mgmt.authorization.v2022_04_01_preview.models.Type - :keyword end_date_time: End DateTime of the role eligibility schedule. - :paramtype end_date_time: ~datetime.datetime - :keyword duration: Duration of the role eligibility schedule in TimeSpan. - :paramtype duration: str - """ - super().__init__(**kwargs) - self.type = type - self.end_date_time = end_date_time - self.duration = duration - - -class RoleEligibilityScheduleRequestPropertiesTicketInfo(_serialization.Model): - """Ticket Info of the role eligibility. - - :ivar ticket_number: Ticket number for the role eligibility. - :vartype ticket_number: str - :ivar ticket_system: Ticket system name for the role eligibility. - :vartype ticket_system: str - """ - - _attribute_map = { - "ticket_number": {"key": "ticketNumber", "type": "str"}, - "ticket_system": {"key": "ticketSystem", "type": "str"}, - } - - def __init__( - self, *, ticket_number: Optional[str] = None, ticket_system: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword ticket_number: Ticket number for the role eligibility. - :paramtype ticket_number: str - :keyword ticket_system: Ticket system name for the role eligibility. - :paramtype ticket_system: str - """ - super().__init__(**kwargs) - self.ticket_number = ticket_number - self.ticket_system = ticket_system diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/__init__.py deleted file mode 100644 index 8321ef0252af..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._role_assignment_schedule_requests_operations import RoleAssignmentScheduleRequestsOperations -from ._role_eligibility_schedule_requests_operations import RoleEligibilityScheduleRequestsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "RoleAssignmentScheduleRequestsOperations", - "RoleEligibilityScheduleRequestsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_assignment_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_assignment_schedule_requests_operations.py deleted file mode 100644 index fdb871273b10..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_assignment_schedule_requests_operations.py +++ /dev/null @@ -1,741 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request(scope: str, role_assignment_schedule_request_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleAssignmentScheduleRequestName": _SERIALIZER.url( - "role_assignment_schedule_request_name", role_assignment_schedule_request_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(scope: str, role_assignment_schedule_request_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleAssignmentScheduleRequestName": _SERIALIZER.url( - "role_assignment_schedule_request_name", role_assignment_schedule_request_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_cancel_request(scope: str, role_assignment_schedule_request_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel", - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleAssignmentScheduleRequestName": _SERIALIZER.url( - "role_assignment_schedule_request_name", role_assignment_schedule_request_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request(scope: str, role_assignment_schedule_request_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleAssignmentScheduleRequestName": _SERIALIZER.url( - "role_assignment_schedule_request_name", role_assignment_schedule_request_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class RoleAssignmentScheduleRequestsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01_preview.AuthorizationManagementClient`'s - :attr:`role_assignment_schedule_requests` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - def create( - self, - scope: str, - role_assignment_schedule_request_name: str, - parameters: _models.RoleAssignmentScheduleRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Creates a role assignment schedule request. - - :param scope: The scope of the role assignment schedule request to create. The scope can be any - REST resource instance. For example, use - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param role_assignment_schedule_request_name: A GUID for the role assignment to create. The - name must be unique and different for each role assignment. Required. - :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - scope: str, - role_assignment_schedule_request_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Creates a role assignment schedule request. - - :param scope: The scope of the role assignment schedule request to create. The scope can be any - REST resource instance. For example, use - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param role_assignment_schedule_request_name: A GUID for the role assignment to create. The - name must be unique and different for each role assignment. Required. - :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - scope: str, - role_assignment_schedule_request_name: str, - parameters: Union[_models.RoleAssignmentScheduleRequest, IO], - **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Creates a role assignment schedule request. - - :param scope: The scope of the role assignment schedule request to create. The scope can be any - REST resource instance. For example, use - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param role_assignment_schedule_request_name: A GUID for the role assignment to create. The - name must be unique and different for each role assignment. Required. - :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Is either a - RoleAssignmentScheduleRequest type or a IO type. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest") - - request = build_create_request( - scope=scope, - role_assignment_schedule_request_name=role_assignment_schedule_request_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" - } - - @distributed_trace - def get( - self, scope: str, role_assignment_schedule_request_name: str, **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Get the specified role assignment schedule request. - - :param scope: The scope of the role assignment schedule request. Required. - :type scope: str - :param role_assignment_schedule_request_name: The name (guid) of the role assignment schedule - request to get. Required. - :type role_assignment_schedule_request_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - role_assignment_schedule_request_name=role_assignment_schedule_request_name, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" - } - - @distributed_trace - def list_for_scope( - self, scope: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RoleAssignmentScheduleRequest"]: - """Gets role assignment schedule requests for a scope. - - :param scope: The scope of the role assignments schedule requests. Required. - :type scope: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role - assignment schedule requests at or above the scope. Use $filter=principalId eq {id} to return - all role assignment schedule requests at, above or below the scope for the specified principal. - Use $filter=asRequestor() to return all role assignment schedule requests requested by the - current user. Use $filter=asTarget() to return all role assignment schedule requests created - for the current user. Use $filter=asApprover() to return all role assignment schedule requests - where the current user is an approver. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleAssignmentScheduleRequest or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - cls: ClsType[_models.RoleAssignmentScheduleRequestListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - filter=filter, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RoleAssignmentScheduleRequestListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests"} - - @distributed_trace - def cancel( # pylint: disable=inconsistent-return-statements - self, scope: str, role_assignment_schedule_request_name: str, **kwargs: Any - ) -> None: - """Cancels a pending role assignment schedule request. - - :param scope: The scope of the role assignment request to cancel. Required. - :type scope: str - :param role_assignment_schedule_request_name: The name of the role assignment request to - cancel. Required. - :type role_assignment_schedule_request_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_cancel_request( - scope=scope, - role_assignment_schedule_request_name=role_assignment_schedule_request_name, - api_version=api_version, - template_url=self.cancel.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - cancel.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel" - } - - @overload - def validate( - self, - scope: str, - role_assignment_schedule_request_name: str, - parameters: _models.RoleAssignmentScheduleRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Validates a new role assignment schedule request. - - :param scope: The scope of the role assignment request to validate. Required. - :type scope: str - :param role_assignment_schedule_request_name: The name of the role assignment request to - validate. Required. - :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate( - self, - scope: str, - role_assignment_schedule_request_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Validates a new role assignment schedule request. - - :param scope: The scope of the role assignment request to validate. Required. - :type scope: str - :param role_assignment_schedule_request_name: The name of the role assignment request to - validate. Required. - :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate( - self, - scope: str, - role_assignment_schedule_request_name: str, - parameters: Union[_models.RoleAssignmentScheduleRequest, IO], - **kwargs: Any - ) -> _models.RoleAssignmentScheduleRequest: - """Validates a new role assignment schedule request. - - :param scope: The scope of the role assignment request to validate. Required. - :type scope: str - :param role_assignment_schedule_request_name: The name of the role assignment request to - validate. Required. - :type role_assignment_schedule_request_name: str - :param parameters: Parameters for the role assignment schedule request. Is either a - RoleAssignmentScheduleRequest type or a IO type. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleAssignmentScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleAssignmentScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleAssignmentScheduleRequest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RoleAssignmentScheduleRequest") - - request = build_validate_request( - scope=scope, - role_assignment_schedule_request_name=role_assignment_schedule_request_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.validate.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleAssignmentScheduleRequest", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - validate.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate" - } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_eligibility_schedule_requests_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_eligibility_schedule_requests_operations.py deleted file mode 100644 index c1665930d929..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/operations/_role_eligibility_schedule_requests_operations.py +++ /dev/null @@ -1,741 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request(scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleEligibilityScheduleRequestName": _SERIALIZER.url( - "role_eligibility_schedule_request_name", role_eligibility_schedule_request_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleEligibilityScheduleRequestName": _SERIALIZER.url( - "role_eligibility_schedule_request_name", role_eligibility_schedule_request_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_scope_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_cancel_request(scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel", - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleEligibilityScheduleRequestName": _SERIALIZER.url( - "role_eligibility_schedule_request_name", role_eligibility_schedule_request_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_validate_request(scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleEligibilityScheduleRequestName": _SERIALIZER.url( - "role_eligibility_schedule_request_name", role_eligibility_schedule_request_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class RoleEligibilityScheduleRequestsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_04_01_preview.AuthorizationManagementClient`'s - :attr:`role_eligibility_schedule_requests` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - def create( - self, - scope: str, - role_eligibility_schedule_request_name: str, - parameters: _models.RoleEligibilityScheduleRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Creates a role eligibility schedule request. - - :param scope: The scope of the role eligibility schedule request to create. The scope can be - any REST resource instance. For example, use - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility to create. It - can be any valid GUID. Required. - :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - scope: str, - role_eligibility_schedule_request_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Creates a role eligibility schedule request. - - :param scope: The scope of the role eligibility schedule request to create. The scope can be - any REST resource instance. For example, use - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility to create. It - can be any valid GUID. Required. - :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - scope: str, - role_eligibility_schedule_request_name: str, - parameters: Union[_models.RoleEligibilityScheduleRequest, IO], - **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Creates a role eligibility schedule request. - - :param scope: The scope of the role eligibility schedule request to create. The scope can be - any REST resource instance. For example, use - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility to create. It - can be any valid GUID. Required. - :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Is either a - RoleEligibilityScheduleRequest type or a IO type. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest") - - request = build_create_request( - scope=scope, - role_eligibility_schedule_request_name=role_eligibility_schedule_request_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" - } - - @distributed_trace - def get( - self, scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Get the specified role eligibility schedule request. - - :param scope: The scope of the role eligibility schedule request. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name (guid) of the role eligibility schedule - request to get. Required. - :type role_eligibility_schedule_request_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - role_eligibility_schedule_request_name=role_eligibility_schedule_request_name, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" - } - - @distributed_trace - def list_for_scope( - self, scope: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RoleEligibilityScheduleRequest"]: - """Gets role eligibility schedule requests for a scope. - - :param scope: The scope of the role eligibility schedule requests. Required. - :type scope: str - :param filter: The filter to apply on the operation. Use $filter=atScope() to return all role - eligibility schedule requests at or above the scope. Use $filter=principalId eq {id} to return - all role eligibility schedule requests at, above or below the scope for the specified - principal. Use $filter=asRequestor() to return all role eligibility schedule requests requested - by the current user. Use $filter=asTarget() to return all role eligibility schedule requests - created for the current user. Use $filter=asApprover() to return all role eligibility schedule - requests where the current user is an approver. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleEligibilityScheduleRequest or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - cls: ClsType[_models.RoleEligibilityScheduleRequestListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - filter=filter, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RoleEligibilityScheduleRequestListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests"} - - @distributed_trace - def cancel( # pylint: disable=inconsistent-return-statements - self, scope: str, role_eligibility_schedule_request_name: str, **kwargs: Any - ) -> None: - """Cancels a pending role eligibility schedule request. - - :param scope: The scope of the role eligibility request to cancel. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility request to - cancel. Required. - :type role_eligibility_schedule_request_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_cancel_request( - scope=scope, - role_eligibility_schedule_request_name=role_eligibility_schedule_request_name, - api_version=api_version, - template_url=self.cancel.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - cancel.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel" - } - - @overload - def validate( - self, - scope: str, - role_eligibility_schedule_request_name: str, - parameters: _models.RoleEligibilityScheduleRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Validates a new role eligibility schedule request. - - :param scope: The scope of the role eligibility request to validate. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility request to - validate. Required. - :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def validate( - self, - scope: str, - role_eligibility_schedule_request_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Validates a new role eligibility schedule request. - - :param scope: The scope of the role eligibility request to validate. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility request to - validate. Required. - :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def validate( - self, - scope: str, - role_eligibility_schedule_request_name: str, - parameters: Union[_models.RoleEligibilityScheduleRequest, IO], - **kwargs: Any - ) -> _models.RoleEligibilityScheduleRequest: - """Validates a new role eligibility schedule request. - - :param scope: The scope of the role eligibility request to validate. Required. - :type scope: str - :param role_eligibility_schedule_request_name: The name of the role eligibility request to - validate. Required. - :type role_eligibility_schedule_request_name: str - :param parameters: Parameters for the role eligibility schedule request. Is either a - RoleEligibilityScheduleRequest type or a IO type. Required. - :type parameters: - ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleEligibilityScheduleRequest or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_04_01_preview.models.RoleEligibilityScheduleRequest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-04-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleEligibilityScheduleRequest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RoleEligibilityScheduleRequest") - - request = build_validate_request( - scope=scope, - role_eligibility_schedule_request_name=role_eligibility_schedule_request_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.validate.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleEligibilityScheduleRequest", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - validate.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate" - } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/py.typed b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_04_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/__init__.py deleted file mode 100644 index 019f2f208c14..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._authorization_management_client import AuthorizationManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AuthorizationManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_authorization_management_client.py deleted file mode 100644 index 58368cbfc3bf..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_authorization_management_client.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AuthorizationManagementClientConfiguration -from .operations import PermissionsOperations, RoleDefinitionsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword - """Role based access control provides you a way to apply granular level policy administration down - to individual resources or resource groups. These operations allow you to manage role - definitions. A role definition describes the set of actions that can be performed on resources. - - :ivar permissions: PermissionsOperations operations - :vartype permissions: - azure.mgmt.authorization.v2022_05_01_preview.operations.PermissionsOperations - :ivar role_definitions: RoleDefinitionsOperations operations - :vartype role_definitions: - azure.mgmt.authorization.v2022_05_01_preview.operations.RoleDefinitionsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AuthorizationManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.permissions = PermissionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.role_definitions = RoleDefinitionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "AuthorizationManagementClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_configuration.py deleted file mode 100644 index 81e24c62142a..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AuthorizationManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-05-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_metadata.json deleted file mode 100644 index a704fb3cd3fa..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_metadata.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "chosen_version": "2022-05-01-preview", - "total_api_version_list": ["2022-05-01-preview"], - "client": { - "name": "AuthorizationManagementClient", - "filename": "_authorization_management_client", - "description": "Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations allow you to manage role definitions. A role definition describes the set of actions that can be performed on resources.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": false, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AuthorizationManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AuthorizationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "permissions": "PermissionsOperations", - "role_definitions": "RoleDefinitionsOperations" - } -} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_vendor.py deleted file mode 100644 index bd0df84f5319..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_vendor.py +++ /dev/null @@ -1,30 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 typing import List, cast - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_version.py deleted file mode 100644 index 77f53a3589c6..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "4.0.0" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/__init__.py deleted file mode 100644 index a6e41513a3c6..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._authorization_management_client import AuthorizationManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AuthorizationManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_authorization_management_client.py deleted file mode 100644 index 2e673e62c793..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_authorization_management_client.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AuthorizationManagementClientConfiguration -from .operations import PermissionsOperations, RoleDefinitionsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword - """Role based access control provides you a way to apply granular level policy administration down - to individual resources or resource groups. These operations allow you to manage role - definitions. A role definition describes the set of actions that can be performed on resources. - - :ivar permissions: PermissionsOperations operations - :vartype permissions: - azure.mgmt.authorization.v2022_05_01_preview.aio.operations.PermissionsOperations - :ivar role_definitions: RoleDefinitionsOperations operations - :vartype role_definitions: - azure.mgmt.authorization.v2022_05_01_preview.aio.operations.RoleDefinitionsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AuthorizationManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.permissions = PermissionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - self.role_definitions = RoleDefinitionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "AuthorizationManagementClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_configuration.py deleted file mode 100644 index bb2c60526bea..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AuthorizationManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-05-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/__init__.py deleted file mode 100644 index 10fe5b64a01c..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._permissions_operations import PermissionsOperations -from ._role_definitions_operations import RoleDefinitionsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "PermissionsOperations", - "RoleDefinitionsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_permissions_operations.py deleted file mode 100644 index 6427bc44c427..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_permissions_operations.py +++ /dev/null @@ -1,254 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._permissions_operations import build_list_for_resource_group_request, build_list_for_resource_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PermissionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_05_01_preview.aio.AuthorizationManagementClient`'s - :attr:`permissions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Permission"]: - """Gets all permissions the caller has for a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Permission or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_05_01_preview.models.Permission] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_for_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PermissionGetResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions" - } - - @distributed_trace - def list_for_resource( - self, - resource_group_name: str, - resource_provider_namespace: str, - parent_resource_path: str, - resource_type: str, - resource_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.Permission"]: - """Gets all permissions the caller has for a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_provider_namespace: The namespace of the resource provider. Required. - :type resource_provider_namespace: str - :param parent_resource_path: The parent resource identity. Required. - :type parent_resource_path: str - :param resource_type: The resource type of the resource. Required. - :type resource_type: str - :param resource_name: The name of the resource to get the permissions for. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Permission or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_05_01_preview.models.Permission] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_request( - resource_group_name=resource_group_name, - resource_provider_namespace=resource_provider_namespace, - parent_resource_path=parent_resource_path, - resource_type=resource_type, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_for_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PermissionGetResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions" - } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_role_definitions_operations.py deleted file mode 100644 index e29e62d7fb75..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/aio/operations/_role_definitions_operations.py +++ /dev/null @@ -1,498 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._role_definitions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_by_id_request, - build_get_request, - build_list_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RoleDefinitionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_05_01_preview.aio.AuthorizationManagementClient`'s - :attr:`role_definitions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional[_models.RoleDefinition]: - """Deletes a role definition. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_definition_id: The ID of the role definition to delete. Required. - :type role_definition_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or None or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None) - - request = build_delete_request( - scope=scope, - role_definition_id=role_definition_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} - - @distributed_trace_async - async def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition: - """Get role definition by ID (GUID). - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - role_definition_id=role_definition_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} - - @overload - async def create_or_update( - self, - scope: str, - role_definition_id: str, - role_definition: _models.RoleDefinition, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleDefinition: - """Creates or updates a role definition. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :param role_definition: The values for the role definition. Required. - :type role_definition: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - scope: str, - role_definition_id: str, - role_definition: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleDefinition: - """Creates or updates a role definition. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :param role_definition: The values for the role definition. Required. - :type role_definition: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, scope: str, role_definition_id: str, role_definition: Union[_models.RoleDefinition, IO], **kwargs: Any - ) -> _models.RoleDefinition: - """Creates or updates a role definition. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :param role_definition: The values for the role definition. Is either a RoleDefinition type or - a IO type. Required. - :type role_definition: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(role_definition, (IOBase, bytes)): - _content = role_definition - else: - _json = self._serialize.body(role_definition, "RoleDefinition") - - request = build_create_or_update_request( - scope=scope, - role_definition_id=role_definition_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} - - @distributed_trace - def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.RoleDefinition"]: - """Get all role definitions that are applicable at scope and above. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below - the given scope as well. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleDefinition or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - scope=scope, - filter=filter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RoleDefinitionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} - - @distributed_trace_async - async def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: - """Gets a role definition by ID. - - :param role_id: The fully qualified role definition ID. Use the format, - /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for - subscription level role definitions, or - /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role - definitions. Required. - :type role_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) - - request = build_get_by_id_request( - role_id=role_id, - api_version=api_version, - template_url=self.get_by_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_id.metadata = {"url": "/{roleId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/__init__.py deleted file mode 100644 index 8c30802fc8d8..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/__init__.py +++ /dev/null @@ -1,69 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import ApprovalSettings -from ._models_py3 import ApprovalStage -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Permission -from ._models_py3 import PermissionGetResult -from ._models_py3 import Principal -from ._models_py3 import RoleDefinition -from ._models_py3 import RoleDefinitionFilter -from ._models_py3 import RoleDefinitionListResult -from ._models_py3 import RoleManagementPolicyApprovalRule -from ._models_py3 import RoleManagementPolicyAuthenticationContextRule -from ._models_py3 import RoleManagementPolicyEnablementRule -from ._models_py3 import RoleManagementPolicyExpirationRule -from ._models_py3 import RoleManagementPolicyNotificationRule -from ._models_py3 import RoleManagementPolicyRule -from ._models_py3 import RoleManagementPolicyRuleTarget -from ._models_py3 import UserSet - -from ._authorization_management_client_enums import ApprovalMode -from ._authorization_management_client_enums import EnablementRules -from ._authorization_management_client_enums import NotificationDeliveryMechanism -from ._authorization_management_client_enums import NotificationLevel -from ._authorization_management_client_enums import RecipientType -from ._authorization_management_client_enums import RoleManagementPolicyRuleType -from ._authorization_management_client_enums import UserType -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApprovalSettings", - "ApprovalStage", - "ErrorAdditionalInfo", - "ErrorDetail", - "ErrorResponse", - "Permission", - "PermissionGetResult", - "Principal", - "RoleDefinition", - "RoleDefinitionFilter", - "RoleDefinitionListResult", - "RoleManagementPolicyApprovalRule", - "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", - "RoleManagementPolicyExpirationRule", - "RoleManagementPolicyNotificationRule", - "RoleManagementPolicyRule", - "RoleManagementPolicyRuleTarget", - "UserSet", - "ApprovalMode", - "EnablementRules", - "NotificationDeliveryMechanism", - "NotificationLevel", - "RecipientType", - "RoleManagementPolicyRuleType", - "UserType", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/_authorization_management_client_enums.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/_authorization_management_client_enums.py deleted file mode 100644 index fc526582f560..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/_authorization_management_client_enums.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ApprovalMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of rule.""" - - SINGLE_STAGE = "SingleStage" - SERIAL = "Serial" - PARALLEL = "Parallel" - NO_APPROVAL = "NoApproval" - - -class EnablementRules(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of enablement rule.""" - - MULTI_FACTOR_AUTHENTICATION = "MultiFactorAuthentication" - JUSTIFICATION = "Justification" - TICKETING = "Ticketing" - - -class NotificationDeliveryMechanism(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of notification.""" - - EMAIL = "Email" - - -class NotificationLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The notification level.""" - - NONE = "None" - CRITICAL = "Critical" - ALL = "All" - - -class RecipientType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The recipient type.""" - - REQUESTOR = "Requestor" - APPROVER = "Approver" - ADMIN = "Admin" - - -class RoleManagementPolicyRuleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of rule.""" - - ROLE_MANAGEMENT_POLICY_APPROVAL_RULE = "RoleManagementPolicyApprovalRule" - ROLE_MANAGEMENT_POLICY_AUTHENTICATION_CONTEXT_RULE = "RoleManagementPolicyAuthenticationContextRule" - ROLE_MANAGEMENT_POLICY_ENABLEMENT_RULE = "RoleManagementPolicyEnablementRule" - ROLE_MANAGEMENT_POLICY_EXPIRATION_RULE = "RoleManagementPolicyExpirationRule" - ROLE_MANAGEMENT_POLICY_NOTIFICATION_RULE = "RoleManagementPolicyNotificationRule" - - -class UserType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of user.""" - - USER = "User" - GROUP = "Group" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/_models_py3.py deleted file mode 100644 index dbd980877d8d..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/_models_py3.py +++ /dev/null @@ -1,1016 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 typing import Any, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class ApprovalSettings(_serialization.Model): - """The approval settings. - - :ivar is_approval_required: Determines whether approval is required or not. - :vartype is_approval_required: bool - :ivar is_approval_required_for_extension: Determines whether approval is required for - assignment extension. - :vartype is_approval_required_for_extension: bool - :ivar is_requestor_justification_required: Determine whether requestor justification is - required. - :vartype is_requestor_justification_required: bool - :ivar approval_mode: The type of rule. Known values are: "SingleStage", "Serial", "Parallel", - and "NoApproval". - :vartype approval_mode: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.ApprovalMode - :ivar approval_stages: The approval stages of the request. - :vartype approval_stages: - list[~azure.mgmt.authorization.v2022_05_01_preview.models.ApprovalStage] - """ - - _attribute_map = { - "is_approval_required": {"key": "isApprovalRequired", "type": "bool"}, - "is_approval_required_for_extension": {"key": "isApprovalRequiredForExtension", "type": "bool"}, - "is_requestor_justification_required": {"key": "isRequestorJustificationRequired", "type": "bool"}, - "approval_mode": {"key": "approvalMode", "type": "str"}, - "approval_stages": {"key": "approvalStages", "type": "[ApprovalStage]"}, - } - - def __init__( - self, - *, - is_approval_required: Optional[bool] = None, - is_approval_required_for_extension: Optional[bool] = None, - is_requestor_justification_required: Optional[bool] = None, - approval_mode: Optional[Union[str, "_models.ApprovalMode"]] = None, - approval_stages: Optional[List["_models.ApprovalStage"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword is_approval_required: Determines whether approval is required or not. - :paramtype is_approval_required: bool - :keyword is_approval_required_for_extension: Determines whether approval is required for - assignment extension. - :paramtype is_approval_required_for_extension: bool - :keyword is_requestor_justification_required: Determine whether requestor justification is - required. - :paramtype is_requestor_justification_required: bool - :keyword approval_mode: The type of rule. Known values are: "SingleStage", "Serial", - "Parallel", and "NoApproval". - :paramtype approval_mode: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.ApprovalMode - :keyword approval_stages: The approval stages of the request. - :paramtype approval_stages: - list[~azure.mgmt.authorization.v2022_05_01_preview.models.ApprovalStage] - """ - super().__init__(**kwargs) - self.is_approval_required = is_approval_required - self.is_approval_required_for_extension = is_approval_required_for_extension - self.is_requestor_justification_required = is_requestor_justification_required - self.approval_mode = approval_mode - self.approval_stages = approval_stages - - -class ApprovalStage(_serialization.Model): - """The approval stage. - - :ivar approval_stage_time_out_in_days: The time in days when approval request would be timed - out. - :vartype approval_stage_time_out_in_days: int - :ivar is_approver_justification_required: Determines whether approver need to provide - justification for his decision. - :vartype is_approver_justification_required: bool - :ivar escalation_time_in_minutes: The time in minutes when the approval request would be - escalated if the primary approver does not approve. - :vartype escalation_time_in_minutes: int - :ivar primary_approvers: The primary approver of the request. - :vartype primary_approvers: list[~azure.mgmt.authorization.v2022_05_01_preview.models.UserSet] - :ivar is_escalation_enabled: The value determine whether escalation feature is enabled. - :vartype is_escalation_enabled: bool - :ivar escalation_approvers: The escalation approver of the request. - :vartype escalation_approvers: - list[~azure.mgmt.authorization.v2022_05_01_preview.models.UserSet] - """ - - _attribute_map = { - "approval_stage_time_out_in_days": {"key": "approvalStageTimeOutInDays", "type": "int"}, - "is_approver_justification_required": {"key": "isApproverJustificationRequired", "type": "bool"}, - "escalation_time_in_minutes": {"key": "escalationTimeInMinutes", "type": "int"}, - "primary_approvers": {"key": "primaryApprovers", "type": "[UserSet]"}, - "is_escalation_enabled": {"key": "isEscalationEnabled", "type": "bool"}, - "escalation_approvers": {"key": "escalationApprovers", "type": "[UserSet]"}, - } - - def __init__( - self, - *, - approval_stage_time_out_in_days: Optional[int] = None, - is_approver_justification_required: Optional[bool] = None, - escalation_time_in_minutes: Optional[int] = None, - primary_approvers: Optional[List["_models.UserSet"]] = None, - is_escalation_enabled: Optional[bool] = None, - escalation_approvers: Optional[List["_models.UserSet"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword approval_stage_time_out_in_days: The time in days when approval request would be timed - out. - :paramtype approval_stage_time_out_in_days: int - :keyword is_approver_justification_required: Determines whether approver need to provide - justification for his decision. - :paramtype is_approver_justification_required: bool - :keyword escalation_time_in_minutes: The time in minutes when the approval request would be - escalated if the primary approver does not approve. - :paramtype escalation_time_in_minutes: int - :keyword primary_approvers: The primary approver of the request. - :paramtype primary_approvers: - list[~azure.mgmt.authorization.v2022_05_01_preview.models.UserSet] - :keyword is_escalation_enabled: The value determine whether escalation feature is enabled. - :paramtype is_escalation_enabled: bool - :keyword escalation_approvers: The escalation approver of the request. - :paramtype escalation_approvers: - list[~azure.mgmt.authorization.v2022_05_01_preview.models.UserSet] - """ - super().__init__(**kwargs) - self.approval_stage_time_out_in_days = approval_stage_time_out_in_days - self.is_approver_justification_required = is_approver_justification_required - self.escalation_time_in_minutes = escalation_time_in_minutes - self.primary_approvers = primary_approvers - self.is_escalation_enabled = is_escalation_enabled - self.escalation_approvers = escalation_approvers - - -class ErrorAdditionalInfo(_serialization.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: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.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.v2022_05_01_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.authorization.v2022_05_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.authorization.v2022_05_01_preview.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.authorization.v2022_05_01_preview.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class Permission(_serialization.Model): - """Role definition permissions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar actions: Allowed actions. - :vartype actions: list[str] - :ivar not_actions: Denied actions. - :vartype not_actions: list[str] - :ivar data_actions: Allowed Data actions. - :vartype data_actions: list[str] - :ivar not_data_actions: Denied Data actions. - :vartype not_data_actions: list[str] - :ivar condition: The conditions on the role definition. This limits the resources it can be - assigned to. e.g.: - @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] - StringEqualsIgnoreCase 'foo_storage_container'. - :vartype condition: str - :ivar condition_version: Version of the condition. Currently the only accepted value is '2.0'. - :vartype condition_version: str - """ - - _validation = { - "condition": {"readonly": True}, - "condition_version": {"readonly": True}, - } - - _attribute_map = { - "actions": {"key": "actions", "type": "[str]"}, - "not_actions": {"key": "notActions", "type": "[str]"}, - "data_actions": {"key": "dataActions", "type": "[str]"}, - "not_data_actions": {"key": "notDataActions", "type": "[str]"}, - "condition": {"key": "condition", "type": "str"}, - "condition_version": {"key": "conditionVersion", "type": "str"}, - } - - def __init__( - self, - *, - actions: Optional[List[str]] = None, - not_actions: Optional[List[str]] = None, - data_actions: Optional[List[str]] = None, - not_data_actions: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword actions: Allowed actions. - :paramtype actions: list[str] - :keyword not_actions: Denied actions. - :paramtype not_actions: list[str] - :keyword data_actions: Allowed Data actions. - :paramtype data_actions: list[str] - :keyword not_data_actions: Denied Data actions. - :paramtype not_data_actions: list[str] - """ - super().__init__(**kwargs) - self.actions = actions - self.not_actions = not_actions - self.data_actions = data_actions - self.not_data_actions = not_data_actions - self.condition = None - self.condition_version = None - - -class PermissionGetResult(_serialization.Model): - """Permissions information. - - :ivar value: An array of permissions. - :vartype value: list[~azure.mgmt.authorization.v2022_05_01_preview.models.Permission] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Permission]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Permission"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: An array of permissions. - :paramtype value: list[~azure.mgmt.authorization.v2022_05_01_preview.models.Permission] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Principal(_serialization.Model): - """The name of the entity last modified it. - - :ivar id: The id of the principal made changes. - :vartype id: str - :ivar display_name: The name of the principal made changes. - :vartype display_name: str - :ivar type: Type of principal such as user , group etc. - :vartype type: str - :ivar email: Email of principal. - :vartype email: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "email": {"key": "email", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - display_name: Optional[str] = None, - type: Optional[str] = None, - email: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the principal made changes. - :paramtype id: str - :keyword display_name: The name of the principal made changes. - :paramtype display_name: str - :keyword type: Type of principal such as user , group etc. - :paramtype type: str - :keyword email: Email of principal. - :paramtype email: str - """ - super().__init__(**kwargs) - self.id = id - self.display_name = display_name - self.type = type - self.email = email - - -class RoleDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Role definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The role definition ID. - :vartype id: str - :ivar name: The role definition name. - :vartype name: str - :ivar type: The role definition type. - :vartype type: str - :ivar role_name: The role name. - :vartype role_name: str - :ivar description: The role definition description. - :vartype description: str - :ivar role_type: The role type. - :vartype role_type: str - :ivar permissions: Role definition permissions. - :vartype permissions: list[~azure.mgmt.authorization.v2022_05_01_preview.models.Permission] - :ivar assignable_scopes: Role definition assignable scopes. - :vartype assignable_scopes: list[str] - :ivar created_on: Time it was created. - :vartype created_on: ~datetime.datetime - :ivar updated_on: Time it was updated. - :vartype updated_on: ~datetime.datetime - :ivar created_by: Id of the user who created the assignment. - :vartype created_by: str - :ivar updated_by: Id of the user who updated the assignment. - :vartype updated_by: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "created_on": {"readonly": True}, - "updated_on": {"readonly": True}, - "created_by": {"readonly": True}, - "updated_by": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "role_name": {"key": "properties.roleName", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "role_type": {"key": "properties.type", "type": "str"}, - "permissions": {"key": "properties.permissions", "type": "[Permission]"}, - "assignable_scopes": {"key": "properties.assignableScopes", "type": "[str]"}, - "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"}, - } - - def __init__( - self, - *, - role_name: Optional[str] = None, - description: Optional[str] = None, - role_type: Optional[str] = None, - permissions: Optional[List["_models.Permission"]] = None, - assignable_scopes: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword role_name: The role name. - :paramtype role_name: str - :keyword description: The role definition description. - :paramtype description: str - :keyword role_type: The role type. - :paramtype role_type: str - :keyword permissions: Role definition permissions. - :paramtype permissions: list[~azure.mgmt.authorization.v2022_05_01_preview.models.Permission] - :keyword assignable_scopes: Role definition assignable scopes. - :paramtype assignable_scopes: list[str] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.role_name = role_name - self.description = description - self.role_type = role_type - self.permissions = permissions - self.assignable_scopes = assignable_scopes - self.created_on = None - self.updated_on = None - self.created_by = None - self.updated_by = None - - -class RoleDefinitionFilter(_serialization.Model): - """Role Definitions filter. - - :ivar role_name: Returns role definition with the specific name. - :vartype role_name: str - :ivar type: Returns role definition with the specific type. - :vartype type: str - """ - - _attribute_map = { - "role_name": {"key": "roleName", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, role_name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword role_name: Returns role definition with the specific name. - :paramtype role_name: str - :keyword type: Returns role definition with the specific type. - :paramtype type: str - """ - super().__init__(**kwargs) - self.role_name = role_name - self.type = type - - -class RoleDefinitionListResult(_serialization.Model): - """Role definition list operation result. - - :ivar value: Role definition list. - :vartype value: list[~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[RoleDefinition]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.RoleDefinition"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Role definition list. - :paramtype value: list[~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RoleManagementPolicyRule(_serialization.Model): - """The role management policy rule. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - RoleManagementPolicyApprovalRule, RoleManagementPolicyAuthenticationContextRule, - RoleManagementPolicyEnablementRule, RoleManagementPolicyExpirationRule, - RoleManagementPolicyNotificationRule - - All required parameters must be populated in order to send to Azure. - - :ivar id: The id of the rule. - :vartype id: str - :ivar rule_type: The type of rule. Required. Known values are: - "RoleManagementPolicyApprovalRule", "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", "RoleManagementPolicyExpirationRule", and - "RoleManagementPolicyNotificationRule". - :vartype rule_type: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleType - :ivar target: The target of the current rule. - :vartype target: - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleTarget - """ - - _validation = { - "rule_type": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "rule_type": {"key": "ruleType", "type": "str"}, - "target": {"key": "target", "type": "RoleManagementPolicyRuleTarget"}, - } - - _subtype_map = { - "rule_type": { - "RoleManagementPolicyApprovalRule": "RoleManagementPolicyApprovalRule", - "RoleManagementPolicyAuthenticationContextRule": "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule": "RoleManagementPolicyEnablementRule", - "RoleManagementPolicyExpirationRule": "RoleManagementPolicyExpirationRule", - "RoleManagementPolicyNotificationRule": "RoleManagementPolicyNotificationRule", - } - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the rule. - :paramtype id: str - :keyword target: The target of the current rule. - :paramtype target: - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleTarget - """ - super().__init__(**kwargs) - self.id = id - self.rule_type: Optional[str] = None - self.target = target - - -class RoleManagementPolicyApprovalRule(RoleManagementPolicyRule): - """The role management policy approval rule. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The id of the rule. - :vartype id: str - :ivar rule_type: The type of rule. Required. Known values are: - "RoleManagementPolicyApprovalRule", "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", "RoleManagementPolicyExpirationRule", and - "RoleManagementPolicyNotificationRule". - :vartype rule_type: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleType - :ivar target: The target of the current rule. - :vartype target: - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleTarget - :ivar setting: The approval setting. - :vartype setting: ~azure.mgmt.authorization.v2022_05_01_preview.models.ApprovalSettings - """ - - _validation = { - "rule_type": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "rule_type": {"key": "ruleType", "type": "str"}, - "target": {"key": "target", "type": "RoleManagementPolicyRuleTarget"}, - "setting": {"key": "setting", "type": "ApprovalSettings"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - setting: Optional["_models.ApprovalSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the rule. - :paramtype id: str - :keyword target: The target of the current rule. - :paramtype target: - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleTarget - :keyword setting: The approval setting. - :paramtype setting: ~azure.mgmt.authorization.v2022_05_01_preview.models.ApprovalSettings - """ - super().__init__(id=id, target=target, **kwargs) - self.rule_type: str = "RoleManagementPolicyApprovalRule" - self.setting = setting - - -class RoleManagementPolicyAuthenticationContextRule(RoleManagementPolicyRule): - """The role management policy authentication context rule. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The id of the rule. - :vartype id: str - :ivar rule_type: The type of rule. Required. Known values are: - "RoleManagementPolicyApprovalRule", "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", "RoleManagementPolicyExpirationRule", and - "RoleManagementPolicyNotificationRule". - :vartype rule_type: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleType - :ivar target: The target of the current rule. - :vartype target: - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleTarget - :ivar is_enabled: The value indicating if rule is enabled. - :vartype is_enabled: bool - :ivar claim_value: The claim value. - :vartype claim_value: str - """ - - _validation = { - "rule_type": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "rule_type": {"key": "ruleType", "type": "str"}, - "target": {"key": "target", "type": "RoleManagementPolicyRuleTarget"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "claim_value": {"key": "claimValue", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - is_enabled: Optional[bool] = None, - claim_value: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the rule. - :paramtype id: str - :keyword target: The target of the current rule. - :paramtype target: - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleTarget - :keyword is_enabled: The value indicating if rule is enabled. - :paramtype is_enabled: bool - :keyword claim_value: The claim value. - :paramtype claim_value: str - """ - super().__init__(id=id, target=target, **kwargs) - self.rule_type: str = "RoleManagementPolicyAuthenticationContextRule" - self.is_enabled = is_enabled - self.claim_value = claim_value - - -class RoleManagementPolicyEnablementRule(RoleManagementPolicyRule): - """The role management policy enablement rule. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The id of the rule. - :vartype id: str - :ivar rule_type: The type of rule. Required. Known values are: - "RoleManagementPolicyApprovalRule", "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", "RoleManagementPolicyExpirationRule", and - "RoleManagementPolicyNotificationRule". - :vartype rule_type: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleType - :ivar target: The target of the current rule. - :vartype target: - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleTarget - :ivar enabled_rules: The list of enabled rules. - :vartype enabled_rules: list[str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.EnablementRules] - """ - - _validation = { - "rule_type": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "rule_type": {"key": "ruleType", "type": "str"}, - "target": {"key": "target", "type": "RoleManagementPolicyRuleTarget"}, - "enabled_rules": {"key": "enabledRules", "type": "[str]"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - enabled_rules: Optional[List[Union[str, "_models.EnablementRules"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the rule. - :paramtype id: str - :keyword target: The target of the current rule. - :paramtype target: - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleTarget - :keyword enabled_rules: The list of enabled rules. - :paramtype enabled_rules: list[str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.EnablementRules] - """ - super().__init__(id=id, target=target, **kwargs) - self.rule_type: str = "RoleManagementPolicyEnablementRule" - self.enabled_rules = enabled_rules - - -class RoleManagementPolicyExpirationRule(RoleManagementPolicyRule): - """The role management policy expiration rule. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The id of the rule. - :vartype id: str - :ivar rule_type: The type of rule. Required. Known values are: - "RoleManagementPolicyApprovalRule", "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", "RoleManagementPolicyExpirationRule", and - "RoleManagementPolicyNotificationRule". - :vartype rule_type: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleType - :ivar target: The target of the current rule. - :vartype target: - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleTarget - :ivar is_expiration_required: The value indicating whether expiration is required. - :vartype is_expiration_required: bool - :ivar maximum_duration: The maximum duration of expiration in timespan. - :vartype maximum_duration: str - """ - - _validation = { - "rule_type": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "rule_type": {"key": "ruleType", "type": "str"}, - "target": {"key": "target", "type": "RoleManagementPolicyRuleTarget"}, - "is_expiration_required": {"key": "isExpirationRequired", "type": "bool"}, - "maximum_duration": {"key": "maximumDuration", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - is_expiration_required: Optional[bool] = None, - maximum_duration: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the rule. - :paramtype id: str - :keyword target: The target of the current rule. - :paramtype target: - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleTarget - :keyword is_expiration_required: The value indicating whether expiration is required. - :paramtype is_expiration_required: bool - :keyword maximum_duration: The maximum duration of expiration in timespan. - :paramtype maximum_duration: str - """ - super().__init__(id=id, target=target, **kwargs) - self.rule_type: str = "RoleManagementPolicyExpirationRule" - self.is_expiration_required = is_expiration_required - self.maximum_duration = maximum_duration - - -class RoleManagementPolicyNotificationRule(RoleManagementPolicyRule): - """The role management policy notification rule. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The id of the rule. - :vartype id: str - :ivar rule_type: The type of rule. Required. Known values are: - "RoleManagementPolicyApprovalRule", "RoleManagementPolicyAuthenticationContextRule", - "RoleManagementPolicyEnablementRule", "RoleManagementPolicyExpirationRule", and - "RoleManagementPolicyNotificationRule". - :vartype rule_type: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleType - :ivar target: The target of the current rule. - :vartype target: - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleTarget - :ivar notification_type: The type of notification. "Email" - :vartype notification_type: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.NotificationDeliveryMechanism - :ivar notification_level: The notification level. Known values are: "None", "Critical", and - "All". - :vartype notification_level: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.NotificationLevel - :ivar recipient_type: The recipient type. Known values are: "Requestor", "Approver", and - "Admin". - :vartype recipient_type: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.RecipientType - :ivar notification_recipients: The list of notification recipients. - :vartype notification_recipients: list[str] - :ivar is_default_recipients_enabled: Determines if the notification will be sent to the - recipient type specified in the policy rule. - :vartype is_default_recipients_enabled: bool - """ - - _validation = { - "rule_type": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "rule_type": {"key": "ruleType", "type": "str"}, - "target": {"key": "target", "type": "RoleManagementPolicyRuleTarget"}, - "notification_type": {"key": "notificationType", "type": "str"}, - "notification_level": {"key": "notificationLevel", "type": "str"}, - "recipient_type": {"key": "recipientType", "type": "str"}, - "notification_recipients": {"key": "notificationRecipients", "type": "[str]"}, - "is_default_recipients_enabled": {"key": "isDefaultRecipientsEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - target: Optional["_models.RoleManagementPolicyRuleTarget"] = None, - notification_type: Optional[Union[str, "_models.NotificationDeliveryMechanism"]] = None, - notification_level: Optional[Union[str, "_models.NotificationLevel"]] = None, - recipient_type: Optional[Union[str, "_models.RecipientType"]] = None, - notification_recipients: Optional[List[str]] = None, - is_default_recipients_enabled: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The id of the rule. - :paramtype id: str - :keyword target: The target of the current rule. - :paramtype target: - ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleManagementPolicyRuleTarget - :keyword notification_type: The type of notification. "Email" - :paramtype notification_type: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.NotificationDeliveryMechanism - :keyword notification_level: The notification level. Known values are: "None", "Critical", and - "All". - :paramtype notification_level: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.NotificationLevel - :keyword recipient_type: The recipient type. Known values are: "Requestor", "Approver", and - "Admin". - :paramtype recipient_type: str or - ~azure.mgmt.authorization.v2022_05_01_preview.models.RecipientType - :keyword notification_recipients: The list of notification recipients. - :paramtype notification_recipients: list[str] - :keyword is_default_recipients_enabled: Determines if the notification will be sent to the - recipient type specified in the policy rule. - :paramtype is_default_recipients_enabled: bool - """ - super().__init__(id=id, target=target, **kwargs) - self.rule_type: str = "RoleManagementPolicyNotificationRule" - self.notification_type = notification_type - self.notification_level = notification_level - self.recipient_type = recipient_type - self.notification_recipients = notification_recipients - self.is_default_recipients_enabled = is_default_recipients_enabled - - -class RoleManagementPolicyRuleTarget(_serialization.Model): - """The role management policy rule target. - - :ivar caller: The caller of the setting. - :vartype caller: str - :ivar operations: The type of operation. - :vartype operations: list[str] - :ivar level: The assignment level to which rule is applied. - :vartype level: str - :ivar target_objects: The list of target objects. - :vartype target_objects: list[str] - :ivar inheritable_settings: The list of inheritable settings. - :vartype inheritable_settings: list[str] - :ivar enforced_settings: The list of enforced settings. - :vartype enforced_settings: list[str] - """ - - _attribute_map = { - "caller": {"key": "caller", "type": "str"}, - "operations": {"key": "operations", "type": "[str]"}, - "level": {"key": "level", "type": "str"}, - "target_objects": {"key": "targetObjects", "type": "[str]"}, - "inheritable_settings": {"key": "inheritableSettings", "type": "[str]"}, - "enforced_settings": {"key": "enforcedSettings", "type": "[str]"}, - } - - def __init__( - self, - *, - caller: Optional[str] = None, - operations: Optional[List[str]] = None, - level: Optional[str] = None, - target_objects: Optional[List[str]] = None, - inheritable_settings: Optional[List[str]] = None, - enforced_settings: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword caller: The caller of the setting. - :paramtype caller: str - :keyword operations: The type of operation. - :paramtype operations: list[str] - :keyword level: The assignment level to which rule is applied. - :paramtype level: str - :keyword target_objects: The list of target objects. - :paramtype target_objects: list[str] - :keyword inheritable_settings: The list of inheritable settings. - :paramtype inheritable_settings: list[str] - :keyword enforced_settings: The list of enforced settings. - :paramtype enforced_settings: list[str] - """ - super().__init__(**kwargs) - self.caller = caller - self.operations = operations - self.level = level - self.target_objects = target_objects - self.inheritable_settings = inheritable_settings - self.enforced_settings = enforced_settings - - -class UserSet(_serialization.Model): - """The detail of a user. - - :ivar user_type: The type of user. Known values are: "User" and "Group". - :vartype user_type: str or ~azure.mgmt.authorization.v2022_05_01_preview.models.UserType - :ivar is_backup: The value indicating whether the user is a backup fallback approver. - :vartype is_backup: bool - :ivar id: The object id of the user. - :vartype id: str - :ivar description: The description of the user. - :vartype description: str - """ - - _attribute_map = { - "user_type": {"key": "userType", "type": "str"}, - "is_backup": {"key": "isBackup", "type": "bool"}, - "id": {"key": "id", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - user_type: Optional[Union[str, "_models.UserType"]] = None, - is_backup: Optional[bool] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword user_type: The type of user. Known values are: "User" and "Group". - :paramtype user_type: str or ~azure.mgmt.authorization.v2022_05_01_preview.models.UserType - :keyword is_backup: The value indicating whether the user is a backup fallback approver. - :paramtype is_backup: bool - :keyword id: The object id of the user. - :paramtype id: str - :keyword description: The description of the user. - :paramtype description: str - """ - super().__init__(**kwargs) - self.user_type = user_type - self.is_backup = is_backup - self.id = id - self.description = description diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/__init__.py deleted file mode 100644 index 10fe5b64a01c..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._permissions_operations import PermissionsOperations -from ._role_definitions_operations import RoleDefinitionsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "PermissionsOperations", - "RoleDefinitionsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_permissions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_permissions_operations.py deleted file mode 100644 index bbebc9f28537..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_permissions_operations.py +++ /dev/null @@ -1,331 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_for_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_resource_request( - resource_group_name: str, - resource_provider_namespace: str, - parent_resource_path: str, - resource_type: str, - resource_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "resourceProviderNamespace": _SERIALIZER.url( - "resource_provider_namespace", resource_provider_namespace, "str", skip_quote=True - ), - "parentResourcePath": _SERIALIZER.url("parent_resource_path", parent_resource_path, "str", skip_quote=True), - "resourceType": _SERIALIZER.url("resource_type", resource_type, "str", skip_quote=True), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str", pattern=r".+"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class PermissionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_05_01_preview.AuthorizationManagementClient`'s - :attr:`permissions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_for_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Permission"]: - """Gets all permissions the caller has for a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Permission or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_05_01_preview.models.Permission] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_for_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PermissionGetResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions" - } - - @distributed_trace - def list_for_resource( - self, - resource_group_name: str, - resource_provider_namespace: str, - parent_resource_path: str, - resource_type: str, - resource_name: str, - **kwargs: Any - ) -> Iterable["_models.Permission"]: - """Gets all permissions the caller has for a resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_provider_namespace: The namespace of the resource provider. Required. - :type resource_provider_namespace: str - :param parent_resource_path: The parent resource identity. Required. - :type parent_resource_path: str - :param resource_type: The resource type of the resource. Required. - :type resource_type: str - :param resource_name: The name of the resource to get the permissions for. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Permission or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_05_01_preview.models.Permission] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.PermissionGetResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_resource_request( - resource_group_name=resource_group_name, - resource_provider_namespace=resource_provider_namespace, - parent_resource_path=parent_resource_path, - resource_type=resource_type, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_for_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PermissionGetResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions" - } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_role_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_role_definitions_operations.py deleted file mode 100644 index f214db91e563..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/operations/_role_definitions_operations.py +++ /dev/null @@ -1,622 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request(scope: str, role_definition_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(scope: str, role_definition_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request(scope: str, role_definition_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(scope: str, *, filter: Optional[str] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleDefinitions") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_by_id_request(role_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{roleId}") - path_format_arguments = { - "roleId": _SERIALIZER.url("role_id", role_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RoleDefinitionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_05_01_preview.AuthorizationManagementClient`'s - :attr:`role_definitions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def delete(self, scope: str, role_definition_id: str, **kwargs: Any) -> Optional[_models.RoleDefinition]: - """Deletes a role definition. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_definition_id: The ID of the role definition to delete. Required. - :type role_definition_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or None or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[Optional[_models.RoleDefinition]] = kwargs.pop("cls", None) - - request = build_delete_request( - scope=scope, - role_definition_id=role_definition_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - delete.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} - - @distributed_trace - def get(self, scope: str, role_definition_id: str, **kwargs: Any) -> _models.RoleDefinition: - """Get role definition by ID (GUID). - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - role_definition_id=role_definition_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} - - @overload - def create_or_update( - self, - scope: str, - role_definition_id: str, - role_definition: _models.RoleDefinition, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleDefinition: - """Creates or updates a role definition. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :param role_definition: The values for the role definition. Required. - :type role_definition: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - scope: str, - role_definition_id: str, - role_definition: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RoleDefinition: - """Creates or updates a role definition. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :param role_definition: The values for the role definition. Required. - :type role_definition: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, scope: str, role_definition_id: str, role_definition: Union[_models.RoleDefinition, IO], **kwargs: Any - ) -> _models.RoleDefinition: - """Creates or updates a role definition. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param role_definition_id: The ID of the role definition. Required. - :type role_definition_id: str - :param role_definition: The values for the role definition. Is either a RoleDefinition type or - a IO type. Required. - :type role_definition: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(role_definition, (IOBase, bytes)): - _content = role_definition - else: - _json = self._serialize.body(role_definition, "RoleDefinition") - - request = build_create_or_update_request( - scope=scope, - role_definition_id=role_definition_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}"} - - @distributed_trace - def list(self, scope: str, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RoleDefinition"]: - """Get all role definitions that are applicable at scope and above. - - :param scope: The scope of the operation or resource. Valid scopes are: subscription (format: - '/subscriptions/{subscriptionId}'), resource group (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. - Required. - :type scope: str - :param filter: The filter to apply on the operation. Use atScopeAndBelow filter to search below - the given scope as well. Default value is None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RoleDefinition or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.RoleDefinitionListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - scope=scope, - filter=filter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RoleDefinitionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleDefinitions"} - - @distributed_trace - def get_by_id(self, role_id: str, **kwargs: Any) -> _models.RoleDefinition: - """Gets a role definition by ID. - - :param role_id: The fully qualified role definition ID. Use the format, - /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for - subscription level role definitions, or - /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role - definitions. Required. - :type role_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RoleDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_05_01_preview.models.RoleDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") - ) - cls: ClsType[_models.RoleDefinition] = kwargs.pop("cls", None) - - request = build_get_by_id_request( - role_id=role_id, - api_version=api_version, - template_url=self.get_by_id.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RoleDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_by_id.metadata = {"url": "/{roleId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/py.typed b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_05_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/__init__.py deleted file mode 100644 index 019f2f208c14..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._authorization_management_client import AuthorizationManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AuthorizationManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_authorization_management_client.py deleted file mode 100644 index b1dfd0af0d72..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_authorization_management_client.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AuthorizationManagementClientConfiguration -from .operations import ( - AlertConfigurationsOperations, - AlertDefinitionsOperations, - AlertIncidentsOperations, - AlertOperationOperations, - AlertsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword - """Role based access control provides you a way to apply granular level policy administration down - to individual resources or resource groups. These operations enable you to manage role - assignments. A role assignment grants access to Azure Active Directory users. - - :ivar alerts: AlertsOperations operations - :vartype alerts: azure.mgmt.authorization.v2022_08_01_preview.operations.AlertsOperations - :ivar alert_configurations: AlertConfigurationsOperations operations - :vartype alert_configurations: - azure.mgmt.authorization.v2022_08_01_preview.operations.AlertConfigurationsOperations - :ivar alert_definitions: AlertDefinitionsOperations operations - :vartype alert_definitions: - azure.mgmt.authorization.v2022_08_01_preview.operations.AlertDefinitionsOperations - :ivar alert_incidents: AlertIncidentsOperations operations - :vartype alert_incidents: - azure.mgmt.authorization.v2022_08_01_preview.operations.AlertIncidentsOperations - :ivar alert_operation: AlertOperationOperations operations - :vartype alert_operation: - azure.mgmt.authorization.v2022_08_01_preview.operations.AlertOperationOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = AuthorizationManagementClientConfiguration(credential=credential, **kwargs) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-08-01-preview" - ) - self.alert_configurations = AlertConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-08-01-preview" - ) - self.alert_definitions = AlertDefinitionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-08-01-preview" - ) - self.alert_incidents = AlertIncidentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-08-01-preview" - ) - self.alert_operation = AlertOperationOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-08-01-preview" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "AuthorizationManagementClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_configuration.py deleted file mode 100644 index 033d7e5798b5..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_configuration.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AuthorizationManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: - super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-08-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.credential = credential - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_metadata.json b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_metadata.json deleted file mode 100644 index 53b46ccb1488..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_metadata.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "chosen_version": "2022-08-01-preview", - "total_api_version_list": ["2022-08-01-preview"], - "client": { - "name": "AuthorizationManagementClient", - "filename": "_authorization_management_client", - "description": "Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role assignments. A role assignment grants access to Azure Active Directory users.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AuthorizationManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AuthorizationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - } - }, - "constant": { - }, - "call": "credential", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "alerts": "AlertsOperations", - "alert_configurations": "AlertConfigurationsOperations", - "alert_definitions": "AlertDefinitionsOperations", - "alert_incidents": "AlertIncidentsOperations", - "alert_operation": "AlertOperationOperations" - } -} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_vendor.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_vendor.py deleted file mode 100644 index bd0df84f5319..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_vendor.py +++ /dev/null @@ -1,30 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 typing import List, cast - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_version.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_version.py deleted file mode 100644 index 77f53a3589c6..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "4.0.0" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/__init__.py deleted file mode 100644 index a6e41513a3c6..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._authorization_management_client import AuthorizationManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AuthorizationManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_authorization_management_client.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_authorization_management_client.py deleted file mode 100644 index ea3406cd35a0..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_authorization_management_client.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import AuthorizationManagementClientConfiguration -from .operations import ( - AlertConfigurationsOperations, - AlertDefinitionsOperations, - AlertIncidentsOperations, - AlertOperationOperations, - AlertsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AuthorizationManagementClient: # pylint: disable=client-accepts-api-version-keyword - """Role based access control provides you a way to apply granular level policy administration down - to individual resources or resource groups. These operations enable you to manage role - assignments. A role assignment grants access to Azure Active Directory users. - - :ivar alerts: AlertsOperations operations - :vartype alerts: azure.mgmt.authorization.v2022_08_01_preview.aio.operations.AlertsOperations - :ivar alert_configurations: AlertConfigurationsOperations operations - :vartype alert_configurations: - azure.mgmt.authorization.v2022_08_01_preview.aio.operations.AlertConfigurationsOperations - :ivar alert_definitions: AlertDefinitionsOperations operations - :vartype alert_definitions: - azure.mgmt.authorization.v2022_08_01_preview.aio.operations.AlertDefinitionsOperations - :ivar alert_incidents: AlertIncidentsOperations operations - :vartype alert_incidents: - azure.mgmt.authorization.v2022_08_01_preview.aio.operations.AlertIncidentsOperations - :ivar alert_operation: AlertOperationOperations operations - :vartype alert_operation: - azure.mgmt.authorization.v2022_08_01_preview.aio.operations.AlertOperationOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = AuthorizationManagementClientConfiguration(credential=credential, **kwargs) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.alerts = AlertsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-08-01-preview" - ) - self.alert_configurations = AlertConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-08-01-preview" - ) - self.alert_definitions = AlertDefinitionsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-08-01-preview" - ) - self.alert_incidents = AlertIncidentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-08-01-preview" - ) - self.alert_operation = AlertOperationOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-08-01-preview" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "AuthorizationManagementClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_configuration.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_configuration.py deleted file mode 100644 index 278d20daec1f..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_configuration.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AuthorizationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AuthorizationManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: - super(AuthorizationManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-08-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.credential = credential - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-authorization/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/__init__.py deleted file mode 100644 index f755caaa9c2a..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._alerts_operations import AlertsOperations -from ._alert_configurations_operations import AlertConfigurationsOperations -from ._alert_definitions_operations import AlertDefinitionsOperations -from ._alert_incidents_operations import AlertIncidentsOperations -from ._alert_operation_operations import AlertOperationOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AlertsOperations", - "AlertConfigurationsOperations", - "AlertDefinitionsOperations", - "AlertIncidentsOperations", - "AlertOperationOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_configurations_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_configurations_operations.py deleted file mode 100644 index d9f81bb3f78b..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_configurations_operations.py +++ /dev/null @@ -1,335 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._alert_configurations_operations import ( - build_get_request, - build_list_for_scope_request, - build_update_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AlertConfigurationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_08_01_preview.aio.AuthorizationManagementClient`'s - :attr:`alert_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertConfiguration: - """Get the specified alert configuration. - - :param scope: The scope of the alert configuration. The scope can be any REST resource - instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' - for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param alert_id: The name of the alert configuration to get. Required. - :type alert_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertConfiguration] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - alert_id=alert_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AlertConfiguration", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}"} - - @overload - async def update( # pylint: disable=inconsistent-return-statements - self, - scope: str, - alert_id: str, - parameters: _models.AlertConfiguration, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Update an alert configuration. - - :param scope: The scope of the alert configuration. Required. - :type scope: str - :param alert_id: The name of the alert configuration to update. Required. - :type alert_id: str - :param parameters: Parameters for the alert configuration. Required. - :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( # pylint: disable=inconsistent-return-statements - self, scope: str, alert_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Update an alert configuration. - - :param scope: The scope of the alert configuration. Required. - :type scope: str - :param alert_id: The name of the alert configuration to update. Required. - :type alert_id: str - :param parameters: Parameters for the alert configuration. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( # pylint: disable=inconsistent-return-statements - self, scope: str, alert_id: str, parameters: Union[_models.AlertConfiguration, IO], **kwargs: Any - ) -> None: - """Update an alert configuration. - - :param scope: The scope of the alert configuration. Required. - :type scope: str - :param alert_id: The name of the alert configuration to update. Required. - :type alert_id: str - :param parameters: Parameters for the alert configuration. Is either a AlertConfiguration type - or a IO type. Required. - :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AlertConfiguration") - - request = build_update_request( - scope=scope, - alert_id=alert_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}"} - - @distributed_trace - def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.AlertConfiguration"]: - """Gets alert configurations for a resource scope. - - :param scope: The scope of the alert configuration. Required. - :type scope: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AlertConfiguration or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertConfigurationListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AlertConfigurationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_definitions_operations.py deleted file mode 100644 index 2b61202b6850..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_definitions_operations.py +++ /dev/null @@ -1,208 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._alert_definitions_operations import build_get_request, build_list_for_scope_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AlertDefinitionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_08_01_preview.aio.AuthorizationManagementClient`'s - :attr:`alert_definitions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _models.AlertDefinition: - """Get the specified alert definition. - - :param scope: The scope of the alert definition. The scope can be any REST resource instance. - For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a - subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param alert_definition_id: The name of the alert definition to get. Required. - :type alert_definition_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertDefinition] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - alert_definition_id=alert_definition_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AlertDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions/{alertDefinitionId}" - } - - @distributed_trace - def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.AlertDefinition"]: - """Gets alert definitions for a resource scope. - - :param scope: The scope of the alert definition. Required. - :type scope: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AlertDefinition or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertDefinitionListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AlertDefinitionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_incidents_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_incidents_operations.py deleted file mode 100644 index 8d81b33abf64..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_incidents_operations.py +++ /dev/null @@ -1,283 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._alert_incidents_operations import ( - build_get_request, - build_list_for_scope_request, - build_remediate_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AlertIncidentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_08_01_preview.aio.AuthorizationManagementClient`'s - :attr:`alert_incidents` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any) -> _models.AlertIncident: - """Get the specified alert incident. - - :param scope: The scope of the alert incident. The scope can be any REST resource instance. For - example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a - subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param alert_id: The name of the alert. Required. - :type alert_id: str - :param alert_incident_id: The name of the alert incident to get. Required. - :type alert_incident_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertIncident or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertIncident - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertIncident] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - alert_id=alert_id, - alert_incident_id=alert_incident_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AlertIncident", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}" - } - - @distributed_trace - def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> AsyncIterable["_models.AlertIncident"]: - """Gets alert incidents for a resource scope. - - :param scope: The scope of the alert incident. Required. - :type scope: str - :param alert_id: The name of the alert. Required. - :type alert_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AlertIncident or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertIncident] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertIncidentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - alert_id=alert_id, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AlertIncidentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_scope.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents" - } - - @distributed_trace_async - async def remediate( # pylint: disable=inconsistent-return-statements - self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any - ) -> None: - """Remediate an alert incident. - - :param scope: The scope of the alert incident. Required. - :type scope: str - :param alert_id: The name of the alert. Required. - :type alert_id: str - :param alert_incident_id: The name of the alert incident to remediate. Required. - :type alert_incident_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_remediate_request( - scope=scope, - alert_id=alert_id, - alert_incident_id=alert_incident_id, - api_version=api_version, - template_url=self.remediate.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - remediate.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}/remediate" - } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_operation_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_operation_operations.py deleted file mode 100644 index 66abb7247b37..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alert_operation_operations.py +++ /dev/null @@ -1,112 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._alert_operation_operations import build_get_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AlertOperationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_08_01_preview.aio.AuthorizationManagementClient`'s - :attr:`alert_operation` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.AlertOperationResult: - """Get the specified alert operation. - - :param scope: The scope of the alert operation. Required. - :type scope: str - :param operation_id: The id of the alert operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertOperationResult or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertOperationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - operation_id=operation_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AlertOperationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations/{operationId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alerts_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alerts_operations.py deleted file mode 100644 index 309ec8b6fca5..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_alerts_operations.py +++ /dev/null @@ -1,582 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._alerts_operations import ( - build_get_request, - build_list_for_scope_request, - build_refresh_all_request, - build_refresh_request, - build_update_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AlertsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_08_01_preview.aio.AuthorizationManagementClient`'s - :attr:`alerts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: - """Get the specified alert. - - :param scope: The scope of the alert. The scope can be any REST resource instance. For example, - use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param alert_id: The name of the alert to get. Required. - :type alert_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.Alert - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.Alert] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - alert_id=alert_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Alert", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}"} - - @overload - async def update( # pylint: disable=inconsistent-return-statements - self, - scope: str, - alert_id: str, - parameters: _models.Alert, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Update an alert. - - :param scope: The scope of the alert. Required. - :type scope: str - :param alert_id: The name of the alert to dismiss. Required. - :type alert_id: str - :param parameters: Parameters for the alert. Required. - :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.Alert - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( # pylint: disable=inconsistent-return-statements - self, scope: str, alert_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Update an alert. - - :param scope: The scope of the alert. Required. - :type scope: str - :param alert_id: The name of the alert to dismiss. Required. - :type alert_id: str - :param parameters: Parameters for the alert. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( # pylint: disable=inconsistent-return-statements - self, scope: str, alert_id: str, parameters: Union[_models.Alert, IO], **kwargs: Any - ) -> None: - """Update an alert. - - :param scope: The scope of the alert. Required. - :type scope: str - :param alert_id: The name of the alert to dismiss. Required. - :type alert_id: str - :param parameters: Parameters for the alert. Is either a Alert type or a IO type. Required. - :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.Alert or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Alert") - - request = build_update_request( - scope=scope, - alert_id=alert_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}"} - - @distributed_trace - def list_for_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Alert"]: - """Gets alerts for a resource scope. - - :param scope: The scope of the alert. Required. - :type scope: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Alert or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.Alert] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AlertListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts"} - - async def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertOperationResult: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) - - request = build_refresh_request( - scope=scope, - alert_id=alert_id, - api_version=api_version, - template_url=self._refresh_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("AlertOperationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _refresh_initial.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh" - } - - @distributed_trace_async - async def begin_refresh( - self, scope: str, alert_id: str, **kwargs: Any - ) -> AsyncLROPoller[_models.AlertOperationResult]: - """Refresh an alert. - - :param scope: The scope of the alert. Required. - :type scope: str - :param alert_id: The name of the alert to refresh. Required. - :type alert_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AlertOperationResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._refresh_initial( - scope=scope, - alert_id=alert_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("AlertOperationResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_refresh.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh" - } - - async def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.AlertOperationResult: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) - - request = build_refresh_all_request( - scope=scope, - api_version=api_version, - template_url=self._refresh_all_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("AlertOperationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _refresh_all_initial.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh"} - - @distributed_trace_async - async def begin_refresh_all(self, scope: str, **kwargs: Any) -> AsyncLROPoller[_models.AlertOperationResult]: - """Refresh all alerts for a resource scope. - - :param scope: The scope of the alert. Required. - :type scope: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AlertOperationResult or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._refresh_all_initial( - scope=scope, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("AlertOperationResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_refresh_all.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/__init__.py deleted file mode 100644 index 96b97b97e7c8..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/__init__.py +++ /dev/null @@ -1,59 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import Alert -from ._models_py3 import AlertConfiguration -from ._models_py3 import AlertConfigurationListResult -from ._models_py3 import AlertConfigurationProperties -from ._models_py3 import AlertDefinition -from ._models_py3 import AlertDefinitionListResult -from ._models_py3 import AlertIncident -from ._models_py3 import AlertIncidentListResult -from ._models_py3 import AlertIncidentProperties -from ._models_py3 import AlertListResult -from ._models_py3 import AlertOperationResult -from ._models_py3 import AzureRolesAssignedOutsidePimAlertConfigurationProperties -from ._models_py3 import AzureRolesAssignedOutsidePimAlertIncidentProperties -from ._models_py3 import CloudErrorBody -from ._models_py3 import DuplicateRoleCreatedAlertConfigurationProperties -from ._models_py3 import DuplicateRoleCreatedAlertIncidentProperties -from ._models_py3 import TooManyOwnersAssignedToResourceAlertConfigurationProperties -from ._models_py3 import TooManyOwnersAssignedToResourceAlertIncidentProperties -from ._models_py3 import TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties -from ._models_py3 import TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties - -from ._authorization_management_client_enums import SeverityLevel -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Alert", - "AlertConfiguration", - "AlertConfigurationListResult", - "AlertConfigurationProperties", - "AlertDefinition", - "AlertDefinitionListResult", - "AlertIncident", - "AlertIncidentListResult", - "AlertIncidentProperties", - "AlertListResult", - "AlertOperationResult", - "AzureRolesAssignedOutsidePimAlertConfigurationProperties", - "AzureRolesAssignedOutsidePimAlertIncidentProperties", - "CloudErrorBody", - "DuplicateRoleCreatedAlertConfigurationProperties", - "DuplicateRoleCreatedAlertIncidentProperties", - "TooManyOwnersAssignedToResourceAlertConfigurationProperties", - "TooManyOwnersAssignedToResourceAlertIncidentProperties", - "TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties", - "TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties", - "SeverityLevel", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/_authorization_management_client_enums.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/_authorization_management_client_enums.py deleted file mode 100644 index bca84eec8e53..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/_authorization_management_client_enums.py +++ /dev/null @@ -1,18 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class SeverityLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Severity level of the alert.""" - - LOW = "Low" - MEDIUM = "Medium" - HIGH = "High" diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/_models_py3.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/_models_py3.py deleted file mode 100644 index ba2f22ba8cb7..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/_models_py3.py +++ /dev/null @@ -1,987 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# 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 typing import Any, List, Optional, TYPE_CHECKING - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class Alert(_serialization.Model): # pylint: disable=too-many-instance-attributes - """The alert. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The alert ID. - :vartype id: str - :ivar name: The alert name. - :vartype name: str - :ivar type: The alert type. - :vartype type: str - :ivar scope: The alert scope. - :vartype scope: str - :ivar is_active: False by default; true if the alert is active. - :vartype is_active: bool - :ivar incident_count: The number of generated incidents of the alert. - :vartype incident_count: int - :ivar last_modified_date_time: The date time when the alert configuration was updated or new - incidents were generated. - :vartype last_modified_date_time: ~datetime.datetime - :ivar last_scanned_date_time: The date time when the alert was last scanned. - :vartype last_scanned_date_time: ~datetime.datetime - :ivar alert_definition: The alert definition. - :vartype alert_definition: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition - :ivar alert_incidents: The alert incidents. - :vartype alert_incidents: - list[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertIncident] - :ivar alert_configuration: The alert configuration. - :vartype alert_configuration: - ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "scope": {"readonly": True}, - "incident_count": {"readonly": True}, - "last_modified_date_time": {"readonly": True}, - "last_scanned_date_time": {"readonly": True}, - "alert_definition": {"readonly": True}, - "alert_incidents": {"readonly": True}, - "alert_configuration": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "scope": {"key": "properties.scope", "type": "str"}, - "is_active": {"key": "properties.isActive", "type": "bool"}, - "incident_count": {"key": "properties.incidentCount", "type": "int"}, - "last_modified_date_time": {"key": "properties.lastModifiedDateTime", "type": "iso-8601"}, - "last_scanned_date_time": {"key": "properties.lastScannedDateTime", "type": "iso-8601"}, - "alert_definition": {"key": "properties.alertDefinition", "type": "AlertDefinition"}, - "alert_incidents": {"key": "properties.alertIncidents", "type": "[AlertIncident]"}, - "alert_configuration": {"key": "properties.alertConfiguration", "type": "AlertConfiguration"}, - } - - def __init__(self, *, is_active: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword is_active: False by default; true if the alert is active. - :paramtype is_active: bool - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.scope = None - self.is_active = is_active - self.incident_count = None - self.last_modified_date_time = None - self.last_scanned_date_time = None - self.alert_definition = None - self.alert_incidents = None - self.alert_configuration = None - - -class AlertConfiguration(_serialization.Model): - """Alert configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The alert configuration ID. - :vartype id: str - :ivar name: The alert configuration name. - :vartype name: str - :ivar type: The alert configuration type. - :vartype type: str - :ivar alert_definition_id: The alert definition ID. - :vartype alert_definition_id: str - :ivar scope: The alert scope. - :vartype scope: str - :ivar is_enabled: True if the alert is enabled, false will disable the scanning for the - specific alert. - :vartype is_enabled: bool - :ivar alert_configuration_type: The alert configuration type. - :vartype alert_configuration_type: str - :ivar alert_definition: The alert definition. - :vartype alert_definition: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "alert_definition_id": {"readonly": True}, - "scope": {"readonly": True}, - "alert_definition": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "alert_definition_id": {"key": "properties.alertDefinitionId", "type": "str"}, - "scope": {"key": "properties.scope", "type": "str"}, - "is_enabled": {"key": "properties.isEnabled", "type": "bool"}, - "alert_configuration_type": {"key": "properties.alertConfigurationType", "type": "str"}, - "alert_definition": {"key": "properties.alertDefinition", "type": "AlertDefinition"}, - } - - def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword is_enabled: True if the alert is enabled, false will disable the scanning for the - specific alert. - :paramtype is_enabled: bool - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.alert_definition_id = None - self.scope = None - self.is_enabled = is_enabled - self.alert_configuration_type: Optional[str] = None - self.alert_definition = None - - -class AlertConfigurationListResult(_serialization.Model): - """Alert configuration list operation result. - - :ivar value: Alert configuration list. - :vartype value: list[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AlertConfiguration]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.AlertConfiguration"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Alert configuration list. - :paramtype value: list[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AlertConfigurationProperties(_serialization.Model): - """Alert configuration properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureRolesAssignedOutsidePimAlertConfigurationProperties, - DuplicateRoleCreatedAlertConfigurationProperties, - TooManyOwnersAssignedToResourceAlertConfigurationProperties, - TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties - - 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 alert_definition_id: The alert definition ID. - :vartype alert_definition_id: str - :ivar scope: The alert scope. - :vartype scope: str - :ivar is_enabled: True if the alert is enabled, false will disable the scanning for the - specific alert. - :vartype is_enabled: bool - :ivar alert_configuration_type: The alert configuration type. Required. - :vartype alert_configuration_type: str - :ivar alert_definition: The alert definition. - :vartype alert_definition: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition - """ - - _validation = { - "alert_definition_id": {"readonly": True}, - "scope": {"readonly": True}, - "alert_configuration_type": {"required": True}, - "alert_definition": {"readonly": True}, - } - - _attribute_map = { - "alert_definition_id": {"key": "alertDefinitionId", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "alert_configuration_type": {"key": "alertConfigurationType", "type": "str"}, - "alert_definition": {"key": "alertDefinition", "type": "AlertDefinition"}, - } - - _subtype_map = { - "alert_configuration_type": { - "AzureRolesAssignedOutsidePimAlertConfiguration": "AzureRolesAssignedOutsidePimAlertConfigurationProperties", - "DuplicateRoleCreatedAlertConfiguration": "DuplicateRoleCreatedAlertConfigurationProperties", - "TooManyOwnersAssignedToResourceAlertConfiguration": "TooManyOwnersAssignedToResourceAlertConfigurationProperties", - "TooManyPermanentOwnersAssignedToResourceAlertConfiguration": "TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties", - } - } - - def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword is_enabled: True if the alert is enabled, false will disable the scanning for the - specific alert. - :paramtype is_enabled: bool - """ - super().__init__(**kwargs) - self.alert_definition_id = None - self.scope = None - self.is_enabled = is_enabled - self.alert_configuration_type: Optional[str] = None - self.alert_definition = None - - -class AlertDefinition(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Alert definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The alert definition ID. - :vartype id: str - :ivar name: The alert definition name. - :vartype name: str - :ivar type: The alert definition type. - :vartype type: str - :ivar display_name: The alert display name. - :vartype display_name: str - :ivar scope: The alert scope. - :vartype scope: str - :ivar description: The alert description. - :vartype description: str - :ivar severity_level: Severity level of the alert. Known values are: "Low", "Medium", and - "High". - :vartype severity_level: str or - ~azure.mgmt.authorization.v2022_08_01_preview.models.SeverityLevel - :ivar security_impact: Security impact of the alert. - :vartype security_impact: str - :ivar mitigation_steps: The methods to mitigate the alert. - :vartype mitigation_steps: str - :ivar how_to_prevent: The ways to prevent the alert. - :vartype how_to_prevent: str - :ivar is_remediatable: True if the alert can be remediated; false, otherwise. - :vartype is_remediatable: bool - :ivar is_configurable: True if the alert configuration can be configured; false, otherwise. - :vartype is_configurable: bool - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "display_name": {"readonly": True}, - "scope": {"readonly": True}, - "description": {"readonly": True}, - "severity_level": {"readonly": True}, - "security_impact": {"readonly": True}, - "mitigation_steps": {"readonly": True}, - "how_to_prevent": {"readonly": True}, - "is_remediatable": {"readonly": True}, - "is_configurable": {"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"}, - "scope": {"key": "properties.scope", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "severity_level": {"key": "properties.severityLevel", "type": "str"}, - "security_impact": {"key": "properties.securityImpact", "type": "str"}, - "mitigation_steps": {"key": "properties.mitigationSteps", "type": "str"}, - "how_to_prevent": {"key": "properties.howToPrevent", "type": "str"}, - "is_remediatable": {"key": "properties.isRemediatable", "type": "bool"}, - "is_configurable": {"key": "properties.isConfigurable", "type": "bool"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.display_name = None - self.scope = None - self.description = None - self.severity_level = None - self.security_impact = None - self.mitigation_steps = None - self.how_to_prevent = None - self.is_remediatable = None - self.is_configurable = None - - -class AlertDefinitionListResult(_serialization.Model): - """Alert definition list operation result. - - :ivar value: Alert definition list. - :vartype value: list[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AlertDefinition]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AlertDefinition"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Alert definition list. - :paramtype value: list[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AlertIncident(_serialization.Model): - """Alert incident. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The alert incident ID. - :vartype id: str - :ivar name: The alert incident name. - :vartype name: str - :ivar type: The alert incident type. - :vartype type: str - :ivar alert_incident_type: The alert incident type. - :vartype alert_incident_type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "alert_incident_type": {"key": "properties.alertIncidentType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.alert_incident_type: Optional[str] = None - - -class AlertIncidentListResult(_serialization.Model): - """Alert incident list operation result. - - :ivar value: Alert incident list. - :vartype value: list[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertIncident] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AlertIncident]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AlertIncident"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Alert incident list. - :paramtype value: list[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertIncident] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AlertIncidentProperties(_serialization.Model): - """Alert incident properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureRolesAssignedOutsidePimAlertIncidentProperties, - DuplicateRoleCreatedAlertIncidentProperties, - TooManyOwnersAssignedToResourceAlertIncidentProperties, - TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties - - All required parameters must be populated in order to send to Azure. - - :ivar alert_incident_type: The alert incident type. Required. - :vartype alert_incident_type: str - """ - - _validation = { - "alert_incident_type": {"required": True}, - } - - _attribute_map = { - "alert_incident_type": {"key": "alertIncidentType", "type": "str"}, - } - - _subtype_map = { - "alert_incident_type": { - "AzureRolesAssignedOutsidePimAlertIncident": "AzureRolesAssignedOutsidePimAlertIncidentProperties", - "DuplicateRoleCreatedAlertIncident": "DuplicateRoleCreatedAlertIncidentProperties", - "TooManyOwnersAssignedToResourceAlertIncident": "TooManyOwnersAssignedToResourceAlertIncidentProperties", - "TooManyPermanentOwnersAssignedToResourceAlertIncident": "TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.alert_incident_type: Optional[str] = None - - -class AlertListResult(_serialization.Model): - """Alert list operation result. - - :ivar value: Alert list. - :vartype value: list[~azure.mgmt.authorization.v2022_08_01_preview.models.Alert] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Alert]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Alert"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Alert list. - :paramtype value: list[~azure.mgmt.authorization.v2022_08_01_preview.models.Alert] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AlertOperationResult(_serialization.Model): - """Alert operation result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The id of the alert operation. - :vartype id: str - :ivar status: The status of the alert operation. - :vartype status: str - :ivar status_detail: The status detail of the alert operation. - :vartype status_detail: str - :ivar created_date_time: The created date of the alert operation. - :vartype created_date_time: ~datetime.datetime - :ivar last_action_date_time: The last action date of the alert operation. - :vartype last_action_date_time: ~datetime.datetime - :ivar resource_location: The location of the alert associated with the operation. - :vartype resource_location: str - """ - - _validation = { - "id": {"readonly": True}, - "status": {"readonly": True}, - "status_detail": {"readonly": True}, - "created_date_time": {"readonly": True}, - "last_action_date_time": {"readonly": True}, - "resource_location": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "status_detail": {"key": "statusDetail", "type": "str"}, - "created_date_time": {"key": "createdDateTime", "type": "iso-8601"}, - "last_action_date_time": {"key": "lastActionDateTime", "type": "iso-8601"}, - "resource_location": {"key": "resourceLocation", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.status = None - self.status_detail = None - self.created_date_time = None - self.last_action_date_time = None - self.resource_location = None - - -class AzureRolesAssignedOutsidePimAlertConfigurationProperties(AlertConfigurationProperties): - """The Azure roles assigned outside PIM alert configuration properties. - - 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 alert_definition_id: The alert definition ID. - :vartype alert_definition_id: str - :ivar scope: The alert scope. - :vartype scope: str - :ivar is_enabled: True if the alert is enabled, false will disable the scanning for the - specific alert. - :vartype is_enabled: bool - :ivar alert_configuration_type: The alert configuration type. Required. - :vartype alert_configuration_type: str - :ivar alert_definition: The alert definition. - :vartype alert_definition: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition - """ - - _validation = { - "alert_definition_id": {"readonly": True}, - "scope": {"readonly": True}, - "alert_configuration_type": {"required": True}, - "alert_definition": {"readonly": True}, - } - - _attribute_map = { - "alert_definition_id": {"key": "alertDefinitionId", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "alert_configuration_type": {"key": "alertConfigurationType", "type": "str"}, - "alert_definition": {"key": "alertDefinition", "type": "AlertDefinition"}, - } - - def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword is_enabled: True if the alert is enabled, false will disable the scanning for the - specific alert. - :paramtype is_enabled: bool - """ - super().__init__(is_enabled=is_enabled, **kwargs) - self.alert_configuration_type: str = "AzureRolesAssignedOutsidePimAlertConfiguration" - - -class AzureRolesAssignedOutsidePimAlertIncidentProperties( - AlertIncidentProperties -): # pylint: disable=too-many-instance-attributes - """Azure roles assigned outside PIM alert incident properties. - - 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 alert_incident_type: The alert incident type. Required. - :vartype alert_incident_type: str - :ivar assignee_display_name: The assignee display name. - :vartype assignee_display_name: str - :ivar assignee_user_principal_name: The assignee user principal name. - :vartype assignee_user_principal_name: str - :ivar assignee_id: The assignee ID. - :vartype assignee_id: str - :ivar role_display_name: The role display name. - :vartype role_display_name: str - :ivar role_template_id: The role template ID. - :vartype role_template_id: str - :ivar role_definition_id: The role definition ID. - :vartype role_definition_id: str - :ivar assignment_activated_date: The date the assignment was activated. - :vartype assignment_activated_date: ~datetime.datetime - :ivar requestor_id: The requestor ID. - :vartype requestor_id: str - :ivar requestor_display_name: The requestor display name. - :vartype requestor_display_name: str - :ivar requestor_user_principal_name: The requestor user principal name. - :vartype requestor_user_principal_name: str - """ - - _validation = { - "alert_incident_type": {"required": True}, - "assignee_display_name": {"readonly": True}, - "assignee_user_principal_name": {"readonly": True}, - "assignee_id": {"readonly": True}, - "role_display_name": {"readonly": True}, - "role_template_id": {"readonly": True}, - "role_definition_id": {"readonly": True}, - "assignment_activated_date": {"readonly": True}, - "requestor_id": {"readonly": True}, - "requestor_display_name": {"readonly": True}, - "requestor_user_principal_name": {"readonly": True}, - } - - _attribute_map = { - "alert_incident_type": {"key": "alertIncidentType", "type": "str"}, - "assignee_display_name": {"key": "assigneeDisplayName", "type": "str"}, - "assignee_user_principal_name": {"key": "assigneeUserPrincipalName", "type": "str"}, - "assignee_id": {"key": "assigneeId", "type": "str"}, - "role_display_name": {"key": "roleDisplayName", "type": "str"}, - "role_template_id": {"key": "roleTemplateId", "type": "str"}, - "role_definition_id": {"key": "roleDefinitionId", "type": "str"}, - "assignment_activated_date": {"key": "assignmentActivatedDate", "type": "iso-8601"}, - "requestor_id": {"key": "requestorId", "type": "str"}, - "requestor_display_name": {"key": "requestorDisplayName", "type": "str"}, - "requestor_user_principal_name": {"key": "requestorUserPrincipalName", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.alert_incident_type: str = "AzureRolesAssignedOutsidePimAlertIncident" - self.assignee_display_name = None - self.assignee_user_principal_name = None - self.assignee_id = None - self.role_display_name = None - self.role_template_id = None - self.role_definition_id = None - self.assignment_activated_date = None - self.requestor_id = None - self.requestor_display_name = None - self.requestor_user_principal_name = None - - -class CloudErrorBody(_serialization.Model): - """An error response from the service. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class DuplicateRoleCreatedAlertConfigurationProperties(AlertConfigurationProperties): - """The duplicate role created alert configuration. - - 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 alert_definition_id: The alert definition ID. - :vartype alert_definition_id: str - :ivar scope: The alert scope. - :vartype scope: str - :ivar is_enabled: True if the alert is enabled, false will disable the scanning for the - specific alert. - :vartype is_enabled: bool - :ivar alert_configuration_type: The alert configuration type. Required. - :vartype alert_configuration_type: str - :ivar alert_definition: The alert definition. - :vartype alert_definition: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition - """ - - _validation = { - "alert_definition_id": {"readonly": True}, - "scope": {"readonly": True}, - "alert_configuration_type": {"required": True}, - "alert_definition": {"readonly": True}, - } - - _attribute_map = { - "alert_definition_id": {"key": "alertDefinitionId", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "alert_configuration_type": {"key": "alertConfigurationType", "type": "str"}, - "alert_definition": {"key": "alertDefinition", "type": "AlertDefinition"}, - } - - def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword is_enabled: True if the alert is enabled, false will disable the scanning for the - specific alert. - :paramtype is_enabled: bool - """ - super().__init__(is_enabled=is_enabled, **kwargs) - self.alert_configuration_type: str = "DuplicateRoleCreatedAlertConfiguration" - - -class DuplicateRoleCreatedAlertIncidentProperties(AlertIncidentProperties): - """Duplicate role created alert incident properties. - - 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 alert_incident_type: The alert incident type. Required. - :vartype alert_incident_type: str - :ivar role_name: The role name. - :vartype role_name: str - :ivar duplicate_roles: The duplicate roles. - :vartype duplicate_roles: str - :ivar reason: The reason for the incident. - :vartype reason: str - """ - - _validation = { - "alert_incident_type": {"required": True}, - "role_name": {"readonly": True}, - "duplicate_roles": {"readonly": True}, - "reason": {"readonly": True}, - } - - _attribute_map = { - "alert_incident_type": {"key": "alertIncidentType", "type": "str"}, - "role_name": {"key": "roleName", "type": "str"}, - "duplicate_roles": {"key": "duplicateRoles", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.alert_incident_type: str = "DuplicateRoleCreatedAlertIncident" - self.role_name = None - self.duplicate_roles = None - self.reason = None - - -class TooManyOwnersAssignedToResourceAlertConfigurationProperties(AlertConfigurationProperties): - """Too many owners assigned to resource alert configuration properties. - - 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 alert_definition_id: The alert definition ID. - :vartype alert_definition_id: str - :ivar scope: The alert scope. - :vartype scope: str - :ivar is_enabled: True if the alert is enabled, false will disable the scanning for the - specific alert. - :vartype is_enabled: bool - :ivar alert_configuration_type: The alert configuration type. Required. - :vartype alert_configuration_type: str - :ivar alert_definition: The alert definition. - :vartype alert_definition: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition - :ivar threshold_number_of_owners: The threshold number of owners. - :vartype threshold_number_of_owners: int - :ivar threshold_percentage_of_owners_out_of_all_role_members: The threshold percentage of - owners out of all role members. - :vartype threshold_percentage_of_owners_out_of_all_role_members: int - """ - - _validation = { - "alert_definition_id": {"readonly": True}, - "scope": {"readonly": True}, - "alert_configuration_type": {"required": True}, - "alert_definition": {"readonly": True}, - } - - _attribute_map = { - "alert_definition_id": {"key": "alertDefinitionId", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "alert_configuration_type": {"key": "alertConfigurationType", "type": "str"}, - "alert_definition": {"key": "alertDefinition", "type": "AlertDefinition"}, - "threshold_number_of_owners": {"key": "thresholdNumberOfOwners", "type": "int"}, - "threshold_percentage_of_owners_out_of_all_role_members": { - "key": "thresholdPercentageOfOwnersOutOfAllRoleMembers", - "type": "int", - }, - } - - def __init__( - self, - *, - is_enabled: Optional[bool] = None, - threshold_number_of_owners: Optional[int] = None, - threshold_percentage_of_owners_out_of_all_role_members: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword is_enabled: True if the alert is enabled, false will disable the scanning for the - specific alert. - :paramtype is_enabled: bool - :keyword threshold_number_of_owners: The threshold number of owners. - :paramtype threshold_number_of_owners: int - :keyword threshold_percentage_of_owners_out_of_all_role_members: The threshold percentage of - owners out of all role members. - :paramtype threshold_percentage_of_owners_out_of_all_role_members: int - """ - super().__init__(is_enabled=is_enabled, **kwargs) - self.alert_configuration_type: str = "TooManyOwnersAssignedToResourceAlertConfiguration" - self.threshold_number_of_owners = threshold_number_of_owners - self.threshold_percentage_of_owners_out_of_all_role_members = ( - threshold_percentage_of_owners_out_of_all_role_members - ) - - -class TooManyOwnersAssignedToResourceAlertIncidentProperties(AlertIncidentProperties): - """Too many owners assigned to resource alert incident properties. - - 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 alert_incident_type: The alert incident type. Required. - :vartype alert_incident_type: str - :ivar assignee_name: The assignee name. - :vartype assignee_name: str - :ivar assignee_type: The assignee type. - :vartype assignee_type: str - """ - - _validation = { - "alert_incident_type": {"required": True}, - "assignee_name": {"readonly": True}, - "assignee_type": {"readonly": True}, - } - - _attribute_map = { - "alert_incident_type": {"key": "alertIncidentType", "type": "str"}, - "assignee_name": {"key": "assigneeName", "type": "str"}, - "assignee_type": {"key": "assigneeType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.alert_incident_type: str = "TooManyOwnersAssignedToResourceAlertIncident" - self.assignee_name = None - self.assignee_type = None - - -class TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties(AlertConfigurationProperties): - """Too many permanent owners assigned to resource alert configuration properties. - - 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 alert_definition_id: The alert definition ID. - :vartype alert_definition_id: str - :ivar scope: The alert scope. - :vartype scope: str - :ivar is_enabled: True if the alert is enabled, false will disable the scanning for the - specific alert. - :vartype is_enabled: bool - :ivar alert_configuration_type: The alert configuration type. Required. - :vartype alert_configuration_type: str - :ivar alert_definition: The alert definition. - :vartype alert_definition: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition - :ivar threshold_number_of_permanent_owners: The threshold number of permanent owners. - :vartype threshold_number_of_permanent_owners: int - :ivar threshold_percentage_of_permanent_owners_out_of_all_owners: The threshold percentage of - permanent owners out of all owners. - :vartype threshold_percentage_of_permanent_owners_out_of_all_owners: int - """ - - _validation = { - "alert_definition_id": {"readonly": True}, - "scope": {"readonly": True}, - "alert_configuration_type": {"required": True}, - "alert_definition": {"readonly": True}, - } - - _attribute_map = { - "alert_definition_id": {"key": "alertDefinitionId", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "alert_configuration_type": {"key": "alertConfigurationType", "type": "str"}, - "alert_definition": {"key": "alertDefinition", "type": "AlertDefinition"}, - "threshold_number_of_permanent_owners": {"key": "thresholdNumberOfPermanentOwners", "type": "int"}, - "threshold_percentage_of_permanent_owners_out_of_all_owners": { - "key": "thresholdPercentageOfPermanentOwnersOutOfAllOwners", - "type": "int", - }, - } - - def __init__( - self, - *, - is_enabled: Optional[bool] = None, - threshold_number_of_permanent_owners: Optional[int] = None, - threshold_percentage_of_permanent_owners_out_of_all_owners: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword is_enabled: True if the alert is enabled, false will disable the scanning for the - specific alert. - :paramtype is_enabled: bool - :keyword threshold_number_of_permanent_owners: The threshold number of permanent owners. - :paramtype threshold_number_of_permanent_owners: int - :keyword threshold_percentage_of_permanent_owners_out_of_all_owners: The threshold percentage - of permanent owners out of all owners. - :paramtype threshold_percentage_of_permanent_owners_out_of_all_owners: int - """ - super().__init__(is_enabled=is_enabled, **kwargs) - self.alert_configuration_type: str = "TooManyPermanentOwnersAssignedToResourceAlertConfiguration" - self.threshold_number_of_permanent_owners = threshold_number_of_permanent_owners - self.threshold_percentage_of_permanent_owners_out_of_all_owners = ( - threshold_percentage_of_permanent_owners_out_of_all_owners - ) - - -class TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties(AlertIncidentProperties): - """Too many permanent owners assigned to resource alert incident properties. - - 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 alert_incident_type: The alert incident type. Required. - :vartype alert_incident_type: str - :ivar assignee_name: The assignee name. - :vartype assignee_name: str - :ivar assignee_type: The assignee type. - :vartype assignee_type: str - """ - - _validation = { - "alert_incident_type": {"required": True}, - "assignee_name": {"readonly": True}, - "assignee_type": {"readonly": True}, - } - - _attribute_map = { - "alert_incident_type": {"key": "alertIncidentType", "type": "str"}, - "assignee_name": {"key": "assigneeName", "type": "str"}, - "assignee_type": {"key": "assigneeType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.alert_incident_type: str = "TooManyPermanentOwnersAssignedToResourceAlertIncident" - self.assignee_name = None - self.assignee_type = None diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/__init__.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/__init__.py deleted file mode 100644 index f755caaa9c2a..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._alerts_operations import AlertsOperations -from ._alert_configurations_operations import AlertConfigurationsOperations -from ._alert_definitions_operations import AlertDefinitionsOperations -from ._alert_incidents_operations import AlertIncidentsOperations -from ._alert_operation_operations import AlertOperationOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AlertsOperations", - "AlertConfigurationsOperations", - "AlertDefinitionsOperations", - "AlertIncidentsOperations", - "AlertOperationOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_configurations_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_configurations_operations.py deleted file mode 100644 index 5685979c2f3e..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_configurations_operations.py +++ /dev/null @@ -1,414 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class AlertConfigurationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_08_01_preview.AuthorizationManagementClient`'s - :attr:`alert_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertConfiguration: - """Get the specified alert configuration. - - :param scope: The scope of the alert configuration. The scope can be any REST resource - instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' - for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param alert_id: The name of the alert configuration to get. Required. - :type alert_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertConfiguration] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - alert_id=alert_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AlertConfiguration", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}"} - - @overload - def update( # pylint: disable=inconsistent-return-statements - self, - scope: str, - alert_id: str, - parameters: _models.AlertConfiguration, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Update an alert configuration. - - :param scope: The scope of the alert configuration. Required. - :type scope: str - :param alert_id: The name of the alert configuration to update. Required. - :type alert_id: str - :param parameters: Parameters for the alert configuration. Required. - :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( # pylint: disable=inconsistent-return-statements - self, scope: str, alert_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Update an alert configuration. - - :param scope: The scope of the alert configuration. Required. - :type scope: str - :param alert_id: The name of the alert configuration to update. Required. - :type alert_id: str - :param parameters: Parameters for the alert configuration. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( # pylint: disable=inconsistent-return-statements - self, scope: str, alert_id: str, parameters: Union[_models.AlertConfiguration, IO], **kwargs: Any - ) -> None: - """Update an alert configuration. - - :param scope: The scope of the alert configuration. Required. - :type scope: str - :param alert_id: The name of the alert configuration to update. Required. - :type alert_id: str - :param parameters: Parameters for the alert configuration. Is either a AlertConfiguration type - or a IO type. Required. - :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AlertConfiguration") - - request = build_update_request( - scope=scope, - alert_id=alert_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}"} - - @distributed_trace - def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertConfiguration"]: - """Gets alert configurations for a resource scope. - - :param scope: The scope of the alert configuration. Required. - :type scope: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AlertConfiguration or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertConfigurationListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AlertConfigurationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_definitions_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_definitions_operations.py deleted file mode 100644 index c6975619eab0..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_definitions_operations.py +++ /dev/null @@ -1,261 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(scope: str, alert_definition_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions/{alertDefinitionId}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "alertDefinitionId": _SERIALIZER.url("alert_definition_id", alert_definition_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class AlertDefinitionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_08_01_preview.AuthorizationManagementClient`'s - :attr:`alert_definitions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get(self, scope: str, alert_definition_id: str, **kwargs: Any) -> _models.AlertDefinition: - """Get the specified alert definition. - - :param scope: The scope of the alert definition. The scope can be any REST resource instance. - For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a - subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param alert_definition_id: The name of the alert definition to get. Required. - :type alert_definition_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertDefinition or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertDefinition] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - alert_definition_id=alert_definition_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AlertDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions/{alertDefinitionId}" - } - - @distributed_trace - def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.AlertDefinition"]: - """Gets alert definitions for a resource scope. - - :param scope: The scope of the alert definition. Required. - :type scope: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AlertDefinition or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertDefinition] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertDefinitionListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AlertDefinitionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_incidents_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_incidents_operations.py deleted file mode 100644 index 3b5931f1527a..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_incidents_operations.py +++ /dev/null @@ -1,366 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), - "alertIncidentId": _SERIALIZER.url("alert_incident_id", alert_incident_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_scope_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents" - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_remediate_request(scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}/remediate", - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), - "alertIncidentId": _SERIALIZER.url("alert_incident_id", alert_incident_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AlertIncidentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_08_01_preview.AuthorizationManagementClient`'s - :attr:`alert_incidents` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get(self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any) -> _models.AlertIncident: - """Get the specified alert incident. - - :param scope: The scope of the alert incident. The scope can be any REST resource instance. For - example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a - subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param alert_id: The name of the alert. Required. - :type alert_id: str - :param alert_incident_id: The name of the alert incident to get. Required. - :type alert_incident_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertIncident or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertIncident - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertIncident] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - alert_id=alert_id, - alert_incident_id=alert_incident_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AlertIncident", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}" - } - - @distributed_trace - def list_for_scope(self, scope: str, alert_id: str, **kwargs: Any) -> Iterable["_models.AlertIncident"]: - """Gets alert incidents for a resource scope. - - :param scope: The scope of the alert incident. Required. - :type scope: str - :param alert_id: The name of the alert. Required. - :type alert_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AlertIncident or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertIncident] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertIncidentListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - alert_id=alert_id, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AlertIncidentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_scope.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents" - } - - @distributed_trace - def remediate( # pylint: disable=inconsistent-return-statements - self, scope: str, alert_id: str, alert_incident_id: str, **kwargs: Any - ) -> None: - """Remediate an alert incident. - - :param scope: The scope of the alert incident. Required. - :type scope: str - :param alert_id: The name of the alert. Required. - :type alert_id: str - :param alert_incident_id: The name of the alert incident to remediate. Required. - :type alert_incident_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_remediate_request( - scope=scope, - alert_id=alert_id, - alert_incident_id=alert_incident_id, - api_version=api_version, - template_url=self.remediate.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - remediate.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}/remediate" - } diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_operation_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_operation_operations.py deleted file mode 100644 index 6677021599f0..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alert_operation_operations.py +++ /dev/null @@ -1,142 +0,0 @@ -# pylint: disable=too-many-lines -# 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 typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(scope: str, operation_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations/{operationId}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class AlertOperationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_08_01_preview.AuthorizationManagementClient`'s - :attr:`alert_operation` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get(self, scope: str, operation_id: str, **kwargs: Any) -> _models.AlertOperationResult: - """Get the specified alert operation. - - :param scope: The scope of the alert operation. Required. - :type scope: str - :param operation_id: The id of the alert operation. Required. - :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AlertOperationResult or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.AlertOperationResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - operation_id=operation_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AlertOperationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations/{operationId}"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alerts_operations.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alerts_operations.py deleted file mode 100644 index 04c84dc29506..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_alerts_operations.py +++ /dev/null @@ -1,704 +0,0 @@ -# pylint: disable=too-many-lines -# 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 io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_for_scope_request(scope: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_refresh_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh" - ) - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_refresh_all_request(scope: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh") - path_format_arguments = { - "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AlertsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.authorization.v2022_08_01_preview.AuthorizationManagementClient`'s - :attr:`alerts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: - """Get the specified alert. - - :param scope: The scope of the alert. The scope can be any REST resource instance. For example, - use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a subscription, - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - for a resource group, and - '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - for a resource. Required. - :type scope: str - :param alert_id: The name of the alert to get. Required. - :type alert_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Alert or the result of cls(response) - :rtype: ~azure.mgmt.authorization.v2022_08_01_preview.models.Alert - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.Alert] = kwargs.pop("cls", None) - - request = build_get_request( - scope=scope, - alert_id=alert_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Alert", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}"} - - @overload - def update( # pylint: disable=inconsistent-return-statements - self, - scope: str, - alert_id: str, - parameters: _models.Alert, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Update an alert. - - :param scope: The scope of the alert. Required. - :type scope: str - :param alert_id: The name of the alert to dismiss. Required. - :type alert_id: str - :param parameters: Parameters for the alert. Required. - :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.Alert - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( # pylint: disable=inconsistent-return-statements - self, scope: str, alert_id: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Update an alert. - - :param scope: The scope of the alert. Required. - :type scope: str - :param alert_id: The name of the alert to dismiss. Required. - :type alert_id: str - :param parameters: Parameters for the alert. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( # pylint: disable=inconsistent-return-statements - self, scope: str, alert_id: str, parameters: Union[_models.Alert, IO], **kwargs: Any - ) -> None: - """Update an alert. - - :param scope: The scope of the alert. Required. - :type scope: str - :param alert_id: The name of the alert to dismiss. Required. - :type alert_id: str - :param parameters: Parameters for the alert. Is either a Alert type or a IO type. Required. - :type parameters: ~azure.mgmt.authorization.v2022_08_01_preview.models.Alert or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Alert") - - request = build_update_request( - scope=scope, - alert_id=alert_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - update.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}"} - - @distributed_trace - def list_for_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.Alert"]: - """Gets alerts for a resource scope. - - :param scope: The scope of the alert. Required. - :type scope: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Alert or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.authorization.v2022_08_01_preview.models.Alert] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_scope_request( - scope=scope, - api_version=api_version, - template_url=self.list_for_scope.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AlertListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_for_scope.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts"} - - def _refresh_initial(self, scope: str, alert_id: str, **kwargs: Any) -> _models.AlertOperationResult: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) - - request = build_refresh_request( - scope=scope, - alert_id=alert_id, - api_version=api_version, - template_url=self._refresh_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("AlertOperationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _refresh_initial.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh" - } - - @distributed_trace - def begin_refresh(self, scope: str, alert_id: str, **kwargs: Any) -> LROPoller[_models.AlertOperationResult]: - """Refresh an alert. - - :param scope: The scope of the alert. Required. - :type scope: str - :param alert_id: The name of the alert to refresh. Required. - :type alert_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AlertOperationResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._refresh_initial( - scope=scope, - alert_id=alert_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("AlertOperationResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_refresh.metadata = { - "url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh" - } - - def _refresh_all_initial(self, scope: str, **kwargs: Any) -> _models.AlertOperationResult: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) - - request = build_refresh_all_request( - scope=scope, - api_version=api_version, - template_url=self._refresh_all_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("AlertOperationResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized - - _refresh_all_initial.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh"} - - @distributed_trace - def begin_refresh_all(self, scope: str, **kwargs: Any) -> LROPoller[_models.AlertOperationResult]: - """Refresh all alerts for a resource scope. - - :param scope: The scope of the alert. Required. - :type scope: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AlertOperationResult or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.authorization.v2022_08_01_preview.models.AlertOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") - ) - cls: ClsType[_models.AlertOperationResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._refresh_all_initial( - scope=scope, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("AlertOperationResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, response_headers) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_refresh_all.metadata = {"url": "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh"} diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_patch.py b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/py.typed b/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2022_08_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/tools/azure-sdk-tools/packaging_tools/generate_utils.py b/tools/azure-sdk-tools/packaging_tools/generate_utils.py index 5804015c14ed..a772f44cf635 100644 --- a/tools/azure-sdk-tools/packaging_tools/generate_utils.py +++ b/tools/azure-sdk-tools/packaging_tools/generate_utils.py @@ -12,6 +12,7 @@ from glob import glob import yaml +from . import build_packaging from .swaggertosdk.autorest_tools import build_autorest_options, generate_code from .swaggertosdk.SwaggerToSdkCore import CONFIG_FILE_DPG, read_config from .conf import CONF_NAME @@ -62,10 +63,17 @@ def get_package_names(sdk_folder): def call_build_config(package_name: str, folder_name: str): - check_call( - f"python -m packaging_tools --build-conf {package_name} -o {folder_name}", - shell=True, + build_packaging( + folder_name, + os.environ.get("GH_TOKEN", None), + packages=[package_name], + build_conf=True, ) + # Replace this check_call by in process equivalent call, for better debugging + # check_call( + # f"python -m packaging_tools --build-conf {package_name} -o {folder_name}", + # shell=True, + # ) def init_new_service(package_name, folder_name, is_typespec = False): if not is_typespec: