diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/CHANGELOG.md b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/CHANGELOG.md index 4ea7f2df6938..75656e3de209 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/CHANGELOG.md +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/CHANGELOG.md @@ -1,5 +1,20 @@ # Release History +## 3.3.0 (2024-06-17) + +### Features Added + + - Added operation MobileNetworksOperations.list_sim_groups + - Added operation SimsOperations.begin_clone + - Added operation SimsOperations.begin_move + - Added operation group RoutingInfoOperations + - Model InterfaceProperties has a new parameter bfd_ipv4_endpoints + - Model InterfaceProperties has a new parameter ipv4_address_list + - Model InterfaceProperties has a new parameter vlan_id + - Model PacketCoreControlPlane has a new parameter user_consent + - Model Platform has a new parameter ha_upgrades_available + - Model SignalingConfiguration has a new parameter nas_encryption + ## 3.2.0 (2024-03-18) ### Features Added diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/_meta.json b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/_meta.json index 37f400d83c9a..07dd75ec3649 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/_meta.json +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/_meta.json @@ -1,11 +1,11 @@ { - "commit": "c7b8df506c79231f08e1d878b1c4917a5abb1113", + "commit": "f6f50c6388fd5836fa142384641b8353a99874ef", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.13.16", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/mobilenetwork/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/mobilenetwork/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.13.16 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/mobilenetwork/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/assets.json b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/assets.json index 70ea9dbcd398..c03fdfe19f5a 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/assets.json +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/mobilenetwork/azure-mgmt-mobilenetwork", - "Tag": "python/mobilenetwork/azure-mgmt-mobilenetwork_f697b1e70b" + "Tag": "python/mobilenetwork/azure-mgmt-mobilenetwork_3467978f5a" } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_configuration.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_configuration.py index afdfee030d0d..d08350927072 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_configuration.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_configuration.py @@ -8,7 +8,6 @@ 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 @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class MobileNetworkManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class MobileNetworkManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for MobileNetworkManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,13 @@ class MobileNetworkManagementClientConfiguration(Configuration): # pylint: disa :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-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(MobileNetworkManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2024-02-01") + api_version: str = kwargs.pop("api_version", "2024-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-mobilenetwork/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: 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.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_mobile_network_management_client.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_mobile_network_management_client.py index af1bc6613e2e..be0d777443e2 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_mobile_network_management_client.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_mobile_network_management_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import MobileNetworkManagementClientConfiguration @@ -26,6 +28,7 @@ PacketCoreControlPlaneVersionsOperations, PacketCoreControlPlanesOperations, PacketCoreDataPlanesOperations, + RoutingInfoOperations, ServicesOperations, SimGroupsOperations, SimPoliciesOperations, @@ -61,6 +64,8 @@ class MobileNetworkManagementClient: # pylint: disable=client-accepts-api-versi :ivar packet_core_control_planes: PacketCoreControlPlanesOperations operations :vartype packet_core_control_planes: azure.mgmt.mobilenetwork.operations.PacketCoreControlPlanesOperations + :ivar routing_info: RoutingInfoOperations operations + :vartype routing_info: azure.mgmt.mobilenetwork.operations.RoutingInfoOperations :ivar packet_core_control_plane_versions: PacketCoreControlPlaneVersionsOperations operations :vartype packet_core_control_plane_versions: azure.mgmt.mobilenetwork.operations.PacketCoreControlPlaneVersionsOperations @@ -90,7 +95,7 @@ class MobileNetworkManagementClient: # pylint: disable=client-accepts-api-versi :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 "2024-02-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-04-01". 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 @@ -107,7 +112,25 @@ def __init__( self._config = MobileNetworkManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -126,6 +149,7 @@ def __init__( self.packet_core_control_planes = PacketCoreControlPlanesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.routing_info = RoutingInfoOperations(self._client, self._config, self._serialize, self._deserialize) self.packet_core_control_plane_versions = PacketCoreControlPlaneVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -143,7 +167,7 @@ def __init__( ) self.ue_information = UeInformationOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -163,7 +187,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_patch.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_patch.py index f99e77fef986..17dbc073e01b 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_patch.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_patch.py @@ -25,6 +25,7 @@ # # -------------------------------------------------------------------------- + # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_serialization.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_serialization.py index 4bae2292227b..2f781d740827 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_serialization.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,7 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +288,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +333,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +344,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +383,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +408,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +438,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,7 +661,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -710,7 +703,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -730,6 +723,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -744,7 +738,7 @@ def query(self, name, data, data_type, **kwargs): :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 + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +747,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return 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) @@ -804,7 +798,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -824,7 +818,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -993,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1170,10 +1164,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1209,7 +1203,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1230,7 +1223,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1371,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1444,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1481,7 +1473,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1515,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1578,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1652,7 +1644,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1700,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1757,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1808,7 +1800,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1862,10 +1853,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1893,7 +1884,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1910,7 +1901,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1945,7 +1936,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1982,7 +1973,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1998,9 +1989,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_version.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_version.py index 509b38085125..a78dee7e23cf 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_version.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.2.0" +VERSION = "3.3.0" diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/_configuration.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/_configuration.py index 6c0793dd77c4..a3c2d7cfe487 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/_configuration.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/_configuration.py @@ -8,7 +8,6 @@ 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 @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MobileNetworkManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class MobileNetworkManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for MobileNetworkManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,13 @@ class MobileNetworkManagementClientConfiguration(Configuration): # pylint: disa :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-02-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-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(MobileNetworkManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2024-02-01") + api_version: str = kwargs.pop("api_version", "2024-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-mobilenetwork/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: 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.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/_mobile_network_management_client.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/_mobile_network_management_client.py index f2d95d305f97..fceb563b8855 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/_mobile_network_management_client.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/_mobile_network_management_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -26,6 +28,7 @@ PacketCoreControlPlaneVersionsOperations, PacketCoreControlPlanesOperations, PacketCoreDataPlanesOperations, + RoutingInfoOperations, ServicesOperations, SimGroupsOperations, SimPoliciesOperations, @@ -61,6 +64,8 @@ class MobileNetworkManagementClient: # pylint: disable=client-accepts-api-versi :ivar packet_core_control_planes: PacketCoreControlPlanesOperations operations :vartype packet_core_control_planes: azure.mgmt.mobilenetwork.aio.operations.PacketCoreControlPlanesOperations + :ivar routing_info: RoutingInfoOperations operations + :vartype routing_info: azure.mgmt.mobilenetwork.aio.operations.RoutingInfoOperations :ivar packet_core_control_plane_versions: PacketCoreControlPlaneVersionsOperations operations :vartype packet_core_control_plane_versions: azure.mgmt.mobilenetwork.aio.operations.PacketCoreControlPlaneVersionsOperations @@ -90,7 +95,7 @@ class MobileNetworkManagementClient: # pylint: disable=client-accepts-api-versi :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 "2024-02-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-04-01". 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 @@ -107,7 +112,25 @@ def __init__( self._config = MobileNetworkManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -126,6 +149,7 @@ def __init__( self.packet_core_control_planes = PacketCoreControlPlanesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.routing_info = RoutingInfoOperations(self._client, self._config, self._serialize, self._deserialize) self.packet_core_control_plane_versions = PacketCoreControlPlaneVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -143,7 +167,9 @@ def __init__( ) self.ue_information = UeInformationOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -163,7 +189,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/_patch.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/_patch.py index f99e77fef986..17dbc073e01b 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/_patch.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/_patch.py @@ -25,6 +25,7 @@ # # -------------------------------------------------------------------------- + # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/__init__.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/__init__.py index c6893634e771..c62772e8ee3b 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/__init__.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/__init__.py @@ -13,6 +13,7 @@ from ._operations import Operations from ._packet_captures_operations import PacketCapturesOperations from ._packet_core_control_planes_operations import PacketCoreControlPlanesOperations +from ._routing_info_operations import RoutingInfoOperations from ._packet_core_control_plane_versions_operations import PacketCoreControlPlaneVersionsOperations from ._packet_core_data_planes_operations import PacketCoreDataPlanesOperations from ._services_operations import ServicesOperations @@ -36,6 +37,7 @@ "Operations", "PacketCapturesOperations", "PacketCoreControlPlanesOperations", + "RoutingInfoOperations", "PacketCoreControlPlaneVersionsOperations", "PacketCoreDataPlanesOperations", "ServicesOperations", diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_attached_data_networks_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_attached_data_networks_operations.py index bddaa8fc042e..ce1fe47a6915 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_attached_data_networks_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_attached_data_networks_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ build_update_tags_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +75,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements attached_data_network_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,23 +89,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, attached_data_network_name=attached_data_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -111,11 +115,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -137,14 +137,6 @@ async def begin_delete( :type packet_core_data_plane_name: str :param attached_data_network_name: The name of the attached data network. Required. :type attached_data_network_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -173,7 +165,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -184,17 +176,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -216,12 +204,11 @@ async def get( :type packet_core_data_plane_name: str :param attached_data_network_name: The name of the attached data network. Required. :type attached_data_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AttachedDataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.AttachedDataNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -235,23 +222,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AttachedDataNetwork] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, attached_data_network_name=attached_data_network_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -264,13 +250,9 @@ async def get( deserialized = self._deserialize("AttachedDataNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -278,10 +260,10 @@ async def _create_or_update_initial( packet_core_control_plane_name: str, packet_core_data_plane_name: str, attached_data_network_name: str, - parameters: Union[_models.AttachedDataNetwork, IO], + parameters: Union[_models.AttachedDataNetwork, IO[bytes]], **kwargs: Any ) -> _models.AttachedDataNetwork: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -304,7 +286,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "AttachedDataNetwork") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, @@ -314,16 +296,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -344,10 +325,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}" - } - @overload async def begin_create_or_update( self, @@ -378,14 +355,6 @@ async def begin_create_or_update( :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 - :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 AttachedDataNetwork or the result of cls(response) :rtype: @@ -400,7 +369,7 @@ async def begin_create_or_update( packet_core_control_plane_name: str, packet_core_data_plane_name: str, attached_data_network_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -419,18 +388,10 @@ async def begin_create_or_update( :type attached_data_network_name: str :param parameters: Parameters supplied to the create or update attached data network operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 AttachedDataNetwork or the result of cls(response) :rtype: @@ -445,7 +406,7 @@ async def begin_create_or_update( packet_core_control_plane_name: str, packet_core_data_plane_name: str, attached_data_network_name: str, - parameters: Union[_models.AttachedDataNetwork, IO], + parameters: Union[_models.AttachedDataNetwork, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.AttachedDataNetwork]: """Creates or updates an attached data network. Must be created in the same location as its parent @@ -461,19 +422,8 @@ async def begin_create_or_update( :param attached_data_network_name: The name of the attached data network. Required. :type attached_data_network_name: str :param parameters: Parameters supplied to the create or update attached data network operation. - Is either a AttachedDataNetwork type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.AttachedDataNetwork 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 - :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. + Is either a AttachedDataNetwork type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.AttachedDataNetwork or IO[bytes] :return: An instance of AsyncLROPoller that returns either AttachedDataNetwork or the result of cls(response) :rtype: @@ -508,7 +458,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AttachedDataNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -521,17 +471,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.AttachedDataNetwork].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}" - } + return AsyncLROPoller[_models.AttachedDataNetwork]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update_tags( @@ -561,7 +509,6 @@ async def update_tags( :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: AttachedDataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.AttachedDataNetwork :raises ~azure.core.exceptions.HttpResponseError: @@ -574,7 +521,7 @@ async def update_tags( packet_core_control_plane_name: str, packet_core_data_plane_name: str, attached_data_network_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -591,11 +538,10 @@ async def update_tags( :param attached_data_network_name: The name of the attached data network. Required. :type attached_data_network_name: str :param parameters: Parameters supplied to update attached data network tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: AttachedDataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.AttachedDataNetwork :raises ~azure.core.exceptions.HttpResponseError: @@ -608,7 +554,7 @@ async def update_tags( packet_core_control_plane_name: str, packet_core_data_plane_name: str, attached_data_network_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.AttachedDataNetwork: """Updates an attached data network tags. @@ -623,17 +569,13 @@ async def update_tags( :param attached_data_network_name: The name of the attached data network. Required. :type attached_data_network_name: str :param parameters: Parameters supplied to update attached data network tags. Is either a - TagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + TagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: AttachedDataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.AttachedDataNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,7 +598,7 @@ async def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, @@ -666,16 +608,15 @@ async def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -688,13 +629,9 @@ async def update_tags( deserialized = self._deserialize("AttachedDataNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}" - } + return deserialized # type: ignore @distributed_trace def list_by_packet_core_data_plane( @@ -713,7 +650,6 @@ def list_by_packet_core_data_plane( :type packet_core_control_plane_name: str :param packet_core_data_plane_name: The name of the packet core data plane. Required. :type packet_core_data_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AttachedDataNetwork or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.AttachedDataNetwork] @@ -725,7 +661,7 @@ def list_by_packet_core_data_plane( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AttachedDataNetworkListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -736,18 +672,17 @@ def list_by_packet_core_data_plane( def prepare_request(next_link=None): if not next_link: - request = build_list_by_packet_core_data_plane_request( + _request = build_list_by_packet_core_data_plane_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_packet_core_data_plane.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -759,13 +694,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("AttachedDataNetworkListResult", pipeline_response) @@ -775,11 +710,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -791,7 +726,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_packet_core_data_plane.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_data_networks_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_data_networks_operations.py index cd8275460713..9455bc73e43a 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_data_networks_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_data_networks_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ build_update_tags_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +70,7 @@ def __init__(self, *args, **kwargs) -> None: async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, data_network_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,22 +84,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, data_network_name=data_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -105,11 +109,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -124,14 +124,6 @@ async def begin_delete( :type mobile_network_name: str :param data_network_name: The name of the data network. Required. :type data_network_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -159,7 +151,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -170,17 +162,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -195,12 +183,11 @@ async def get( :type mobile_network_name: str :param data_network_name: The name of the data network. Required. :type data_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.DataNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,22 +201,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataNetwork] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, data_network_name=data_network_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,23 +228,19 @@ async def get( deserialized = self._deserialize("DataNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, mobile_network_name: str, data_network_name: str, - parameters: Union[_models.DataNetwork, IO], + parameters: Union[_models.DataNetwork, IO[bytes]], **kwargs: Any ) -> _models.DataNetwork: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -281,7 +263,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "DataNetwork") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, data_network_name=data_network_name, @@ -290,16 +272,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -320,10 +301,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}" - } - @overload async def begin_create_or_update( self, @@ -351,14 +328,6 @@ async def begin_create_or_update( :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 - :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 DataNetwork or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.DataNetwork] @@ -371,7 +340,7 @@ async def begin_create_or_update( resource_group_name: str, mobile_network_name: str, data_network_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -388,18 +357,10 @@ async def begin_create_or_update( :type data_network_name: str :param parameters: Parameters supplied to the create or update data network operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 DataNetwork or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.DataNetwork] @@ -412,7 +373,7 @@ async def begin_create_or_update( resource_group_name: str, mobile_network_name: str, data_network_name: str, - parameters: Union[_models.DataNetwork, IO], + parameters: Union[_models.DataNetwork, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DataNetwork]: """Creates or updates a data network. Must be created in the same location as its parent mobile @@ -426,19 +387,8 @@ async def begin_create_or_update( :param data_network_name: The name of the data network. Required. :type data_network_name: str :param parameters: Parameters supplied to the create or update data network operation. Is - either a DataNetwork type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.DataNetwork 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 - :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. + either a DataNetwork type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.DataNetwork or IO[bytes] :return: An instance of AsyncLROPoller that returns either DataNetwork or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.DataNetwork] @@ -471,7 +421,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DataNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -484,17 +434,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DataNetwork].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}" - } + return AsyncLROPoller[_models.DataNetwork]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update_tags( @@ -521,7 +469,6 @@ async def update_tags( :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: DataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.DataNetwork :raises ~azure.core.exceptions.HttpResponseError: @@ -533,7 +480,7 @@ async def update_tags( resource_group_name: str, mobile_network_name: str, data_network_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -548,11 +495,10 @@ async def update_tags( :param data_network_name: The name of the data network. Required. :type data_network_name: str :param parameters: Parameters supplied to update data network tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: DataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.DataNetwork :raises ~azure.core.exceptions.HttpResponseError: @@ -564,7 +510,7 @@ async def update_tags( resource_group_name: str, mobile_network_name: str, data_network_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.DataNetwork: """Updates data network tags. @@ -577,17 +523,13 @@ async def update_tags( :param data_network_name: The name of the data network. Required. :type data_network_name: str :param parameters: Parameters supplied to update data network tags. Is either a TagsObject type - or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: DataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.DataNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -610,7 +552,7 @@ async def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, data_network_name=data_network_name, @@ -619,16 +561,15 @@ async def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -641,13 +582,9 @@ async def update_tags( deserialized = self._deserialize("DataNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}" - } + return deserialized # type: ignore @distributed_trace def list_by_mobile_network( @@ -660,7 +597,6 @@ def list_by_mobile_network( :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataNetwork or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.DataNetwork] :raises ~azure.core.exceptions.HttpResponseError: @@ -671,7 +607,7 @@ def list_by_mobile_network( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataNetworkListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -682,17 +618,16 @@ def list_by_mobile_network( def prepare_request(next_link=None): if not next_link: - request = build_list_by_mobile_network_request( + _request = build_list_by_mobile_network_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_mobile_network.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -704,13 +639,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("DataNetworkListResult", pipeline_response) @@ -720,11 +655,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -736,7 +671,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_mobile_network.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_diagnostics_packages_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_diagnostics_packages_operations.py index c1d51938a8cf..bffdb276e558 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_diagnostics_packages_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_diagnostics_packages_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,6 +38,10 @@ build_list_by_packet_core_control_plane_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +72,7 @@ async def _create_or_update_initial( diagnostics_package_name: str, **kwargs: Any ) -> _models.DiagnosticsPackage: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -81,22 +86,21 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticsPackage] = kwargs.pop("cls", None) - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, diagnostics_package_name=diagnostics_package_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -117,10 +121,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" - } - @distributed_trace_async async def begin_create_or_update( self, @@ -138,14 +138,6 @@ async def begin_create_or_update( :type packet_core_control_plane_name: str :param diagnostics_package_name: The name of the diagnostics package. Required. :type diagnostics_package_name: 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 DiagnosticsPackage or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.DiagnosticsPackage] @@ -175,7 +167,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DiagnosticsPackage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -188,17 +180,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DiagnosticsPackage].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" - } + return AsyncLROPoller[_models.DiagnosticsPackage]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def get( @@ -217,12 +207,11 @@ async def get( :type packet_core_control_plane_name: str :param diagnostics_package_name: The name of the diagnostics package. Required. :type diagnostics_package_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticsPackage or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.DiagnosticsPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -236,22 +225,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticsPackage] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, diagnostics_package_name=diagnostics_package_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -264,13 +252,9 @@ async def get( deserialized = self._deserialize("DiagnosticsPackage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" - } + return deserialized # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -279,7 +263,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements diagnostics_package_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -293,22 +277,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, diagnostics_package_name=diagnostics_package_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,11 +302,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -342,14 +321,6 @@ async def begin_delete( :type packet_core_control_plane_name: str :param diagnostics_package_name: The name of the diagnostics package. Required. :type diagnostics_package_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -377,7 +348,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -388,17 +359,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_by_packet_core_control_plane( @@ -411,7 +378,6 @@ def list_by_packet_core_control_plane( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiagnosticsPackage or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.DiagnosticsPackage] @@ -423,7 +389,7 @@ def list_by_packet_core_control_plane( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticsPackageListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -434,17 +400,16 @@ def list_by_packet_core_control_plane( def prepare_request(next_link=None): if not next_link: - request = build_list_by_packet_core_control_plane_request( + _request = build_list_by_packet_core_control_plane_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_packet_core_control_plane.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -456,13 +421,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("DiagnosticsPackageListResult", pipeline_response) @@ -472,11 +437,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -488,7 +453,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_packet_core_control_plane.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_extended_ue_information_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_extended_ue_information_operations.py index 562e12187303..a9eeaa3331b6 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_extended_ue_information_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_extended_ue_information_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._extended_ue_information_operations import build_get_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,12 +68,11 @@ async def get( :type packet_core_control_plane_name: str :param ue_id: IMSI of a UE. Required. :type ue_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ExtendedUeInfo or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.ExtendedUeInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -82,22 +86,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ExtendedUeInfo] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, ue_id=ue_id, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -110,10 +113,6 @@ async def get( deserialized = self._deserialize("ExtendedUeInfo", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/ues/{ueId}/extendedInformation/default" - } + return deserialized # type: ignore diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_mobile_networks_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_mobile_networks_operations.py index 9ebaf77a6310..2e90d04ea8c6 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_mobile_networks_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_mobile_networks_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,9 +38,14 @@ build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, + build_list_sim_groups_request, build_update_tags_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +72,7 @@ def __init__(self, *args, **kwargs) -> None: async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -80,21 +86,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -105,11 +110,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -122,14 +123,6 @@ async def begin_delete( :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -156,7 +149,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -167,17 +160,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, mobile_network_name: str, **kwargs: Any) -> _models.MobileNetwork: @@ -188,12 +177,11 @@ async def get(self, resource_group_name: str, mobile_network_name: str, **kwargs :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MobileNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.MobileNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,21 +195,20 @@ async def get(self, resource_group_name: str, mobile_network_name: str, **kwargs api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MobileNetwork] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,22 +221,18 @@ async def get(self, resource_group_name: str, mobile_network_name: str, **kwargs deserialized = self._deserialize("MobileNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, mobile_network_name: str, - parameters: Union[_models.MobileNetwork, IO], + parameters: Union[_models.MobileNetwork, IO[bytes]], **kwargs: Any ) -> _models.MobileNetwork: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -272,7 +255,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "MobileNetwork") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, @@ -280,16 +263,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -310,10 +292,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}" - } - @overload async def begin_create_or_update( self, @@ -337,14 +315,6 @@ async def begin_create_or_update( :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 - :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 MobileNetwork or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.MobileNetwork] @@ -356,7 +326,7 @@ async def begin_create_or_update( self, resource_group_name: str, mobile_network_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -370,18 +340,10 @@ async def begin_create_or_update( :type mobile_network_name: str :param parameters: Parameters supplied to the create or update mobile network operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 MobileNetwork or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.MobileNetwork] @@ -393,7 +355,7 @@ async def begin_create_or_update( self, resource_group_name: str, mobile_network_name: str, - parameters: Union[_models.MobileNetwork, IO], + parameters: Union[_models.MobileNetwork, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.MobileNetwork]: """Creates or updates a mobile network. @@ -404,19 +366,8 @@ async def begin_create_or_update( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param parameters: Parameters supplied to the create or update mobile network operation. Is - either a MobileNetwork type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.MobileNetwork 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 - :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. + either a MobileNetwork type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.MobileNetwork or IO[bytes] :return: An instance of AsyncLROPoller that returns either MobileNetwork or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.MobileNetwork] @@ -448,7 +399,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("MobileNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -461,17 +412,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.MobileNetwork].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}" - } + return AsyncLROPoller[_models.MobileNetwork]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update_tags( @@ -495,7 +444,6 @@ async def update_tags( :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: MobileNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.MobileNetwork :raises ~azure.core.exceptions.HttpResponseError: @@ -506,7 +454,7 @@ async def update_tags( self, resource_group_name: str, mobile_network_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -519,11 +467,10 @@ async def update_tags( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param parameters: Parameters supplied to update mobile network tags and/or identity. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: MobileNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.MobileNetwork :raises ~azure.core.exceptions.HttpResponseError: @@ -534,7 +481,7 @@ async def update_tags( self, resource_group_name: str, mobile_network_name: str, - parameters: Union[_models.IdentityAndTagsObject, IO], + parameters: Union[_models.IdentityAndTagsObject, IO[bytes]], **kwargs: Any ) -> _models.MobileNetwork: """Updates mobile network tags and managed identity. @@ -545,17 +492,13 @@ async def update_tags( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param parameters: Parameters supplied to update mobile network tags and/or identity. Is either - a IdentityAndTagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject 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 + a IdentityAndTagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject or IO[bytes] :return: MobileNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.MobileNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -578,7 +521,7 @@ async def update_tags( else: _json = self._serialize.body(parameters, "IdentityAndTagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, @@ -586,16 +529,15 @@ async def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -608,19 +550,14 @@ async def update_tags( deserialized = self._deserialize("MobileNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}" - } + return deserialized # type: ignore @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.MobileNetwork"]: """Lists all the mobile networks in a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MobileNetwork or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.MobileNetwork] :raises ~azure.core.exceptions.HttpResponseError: @@ -631,7 +568,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.MobileNe api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MobileNetworkListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -642,15 +579,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.MobileNe def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -662,13 +598,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("MobileNetworkListResult", pipeline_response) @@ -678,11 +614,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -695,10 +631,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/mobileNetworks" - } - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.MobileNetwork"]: """Lists all the mobile networks in a resource group. @@ -706,7 +638,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy :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 MobileNetwork or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.MobileNetwork] :raises ~azure.core.exceptions.HttpResponseError: @@ -717,7 +648,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MobileNetworkListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -728,16 +659,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -749,13 +679,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("MobileNetworkListResult", pipeline_response) @@ -765,11 +695,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -782,6 +712,88 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks" - } + @distributed_trace + def list_sim_groups( + self, resource_group_name: str, mobile_network_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SimGroup"]: + """Gets all the SIM groups assigned to a mobile network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param mobile_network_name: The name of the mobile network. Required. + :type mobile_network_name: str + :return: An iterator like instance of either SimGroup or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.SimGroup] + :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._config.api_version)) + cls: ClsType[_models.SimGroupListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_sim_groups_request( + resource_group_name=resource_group_name, + mobile_network_name=mobile_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("SimGroupListResult", 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) diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_operations.py index 5f86ca18898f..34417dd8262f 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +61,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Gets a list of the operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -67,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -78,14 +82,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( 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) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -97,13 +100,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("OperationList", pipeline_response) @@ -113,11 +116,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,5 +132,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.MobileNetwork/operations"} diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_captures_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_captures_operations.py index c1badbfab9c6..968fd802f71e 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_captures_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_captures_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ build_stop_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,10 +72,10 @@ async def _create_or_update_initial( resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, - parameters: Union[_models.PacketCapture, IO], + parameters: Union[_models.PacketCapture, IO[bytes]], **kwargs: Any ) -> _models.PacketCapture: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +98,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "PacketCapture") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_capture_name=packet_capture_name, @@ -102,16 +107,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,10 +136,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" - } - @overload async def begin_create_or_update( self, @@ -162,14 +162,6 @@ async def begin_create_or_update( :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 - :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 PacketCapture or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.PacketCapture] @@ -182,7 +174,7 @@ async def begin_create_or_update( resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -198,18 +190,10 @@ async def begin_create_or_update( :type packet_capture_name: str :param parameters: Parameters supplied to the create or update packet capture operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 PacketCapture or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.PacketCapture] @@ -222,7 +206,7 @@ async def begin_create_or_update( resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, - parameters: Union[_models.PacketCapture, IO], + parameters: Union[_models.PacketCapture, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PacketCapture]: """Creates or updates a packet capture. @@ -235,19 +219,8 @@ async def begin_create_or_update( :param packet_capture_name: The name of the packet capture session. Required. :type packet_capture_name: str :param parameters: Parameters supplied to the create or update packet capture operation. Is - either a PacketCapture type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCapture 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 - :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. + either a PacketCapture type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCapture or IO[bytes] :return: An instance of AsyncLROPoller that returns either PacketCapture or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.PacketCapture] @@ -280,7 +253,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PacketCapture", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -293,17 +266,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PacketCapture].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" - } + return AsyncLROPoller[_models.PacketCapture]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def get( @@ -318,12 +289,11 @@ async def get( :type packet_core_control_plane_name: str :param packet_capture_name: The name of the packet capture session. Required. :type packet_capture_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PacketCapture or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCapture :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,22 +307,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCapture] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_capture_name=packet_capture_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -365,18 +334,14 @@ async def get( deserialized = self._deserialize("PacketCapture", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" - } + return deserialized # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -390,22 +355,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_capture_name=packet_capture_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -416,11 +380,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -435,14 +395,6 @@ async def begin_delete( :type packet_core_control_plane_name: str :param packet_capture_name: The name of the packet capture session. Required. :type packet_capture_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -470,7 +422,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -481,22 +433,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _stop_initial( self, resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,22 +458,21 @@ async def _stop_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.AsyncOperationStatus]] = kwargs.pop("cls", None) - request = build_stop_request( + _request = build_stop_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_capture_name=packet_capture_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,13 +487,9 @@ async def _stop_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}/stop" - } + return deserialized # type: ignore @distributed_trace_async async def begin_stop( @@ -561,14 +504,6 @@ async def begin_stop( :type packet_core_control_plane_name: str :param packet_capture_name: The name of the packet capture session. Required. :type packet_capture_name: 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 AsyncOperationStatus or the result of cls(response) :rtype: @@ -599,7 +534,7 @@ async def begin_stop( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -611,17 +546,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.AsyncOperationStatus].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_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}/stop" - } + return AsyncLROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_packet_core_control_plane( @@ -634,7 +567,6 @@ def list_by_packet_core_control_plane( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PacketCapture or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.PacketCapture] :raises ~azure.core.exceptions.HttpResponseError: @@ -645,7 +577,7 @@ def list_by_packet_core_control_plane( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCaptureListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,17 +588,16 @@ def list_by_packet_core_control_plane( def prepare_request(next_link=None): if not next_link: - request = build_list_by_packet_core_control_plane_request( + _request = build_list_by_packet_core_control_plane_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_packet_core_control_plane.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -678,13 +609,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PacketCaptureListResult", pipeline_response) @@ -694,11 +625,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -710,7 +641,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_packet_core_control_plane.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_control_plane_versions_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_control_plane_versions_operations.py index c7c34634c898..b285685f617f 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_control_plane_versions_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_control_plane_versions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,12 +69,11 @@ async def get(self, version_name: str, **kwargs: Any) -> _models.PacketCoreContr :param version_name: The name of the packet core control plane version. Required. :type version_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PacketCoreControlPlaneVersion or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -83,19 +87,18 @@ async def get(self, version_name: str, **kwargs: Any) -> _models.PacketCoreContr api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlaneVersion] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( version_name=version_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -108,17 +111,14 @@ async def get(self, version_name: str, **kwargs: Any) -> _models.PacketCoreContr deserialized = self._deserialize("PacketCoreControlPlaneVersion", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = {"url": "/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName}"} + return deserialized # type: ignore @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.PacketCoreControlPlaneVersion"]: """Lists all supported packet core control planes versions. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PacketCoreControlPlaneVersion or the result of cls(response) :rtype: @@ -131,7 +131,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.PacketCoreControlPlaneVe api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlaneVersionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -142,14 +142,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.PacketCoreControlPlaneVe def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( 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) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -161,13 +160,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PacketCoreControlPlaneVersionListResult", pipeline_response) @@ -177,11 +176,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -194,20 +193,17 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions"} - @distributed_trace_async async def get_by_subscription(self, version_name: str, **kwargs: Any) -> _models.PacketCoreControlPlaneVersion: """Gets information about the specified packet core control plane version. :param version_name: The name of the packet core control plane version. Required. :type version_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PacketCoreControlPlaneVersion or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,20 +217,19 @@ async def get_by_subscription(self, version_name: str, **kwargs: Any) -> _models api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlaneVersion] = kwargs.pop("cls", None) - request = build_get_by_subscription_request( + _request = build_get_by_subscription_request( version_name=version_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,19 +242,14 @@ async def get_by_subscription(self, version_name: str, **kwargs: Any) -> _models deserialized = self._deserialize("PacketCoreControlPlaneVersion", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName}" - } + return deserialized # type: ignore @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PacketCoreControlPlaneVersion"]: """Lists all supported packet core control planes versions. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PacketCoreControlPlaneVersion or the result of cls(response) :rtype: @@ -272,7 +262,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PacketCo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlaneVersionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -283,15 +273,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PacketCo def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -303,13 +292,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PacketCoreControlPlaneVersionListResult", pipeline_response) @@ -319,11 +308,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,7 +324,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_control_planes_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_control_planes_operations.py index e88d50057322..2c2d3ff60cc8 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_control_planes_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_control_planes_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -43,6 +44,10 @@ build_update_tags_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +74,7 @@ def __init__(self, *args, **kwargs) -> None: async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -83,21 +88,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -108,11 +112,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -125,14 +125,6 @@ async def begin_delete( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -159,7 +151,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -170,17 +162,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -193,12 +181,11 @@ async def get( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PacketCoreControlPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -212,21 +199,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlane] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,22 +225,18 @@ async def get( deserialized = self._deserialize("PacketCoreControlPlane", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: Union[_models.PacketCoreControlPlane, IO], + parameters: Union[_models.PacketCoreControlPlane, IO[bytes]], **kwargs: Any ) -> _models.PacketCoreControlPlane: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +259,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "PacketCoreControlPlane") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, @@ -285,16 +267,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -315,10 +296,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}" - } - @overload async def begin_create_or_update( self, @@ -342,14 +319,6 @@ async def begin_create_or_update( :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 - :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 PacketCoreControlPlane or the result of cls(response) :rtype: @@ -362,7 +331,7 @@ async def begin_create_or_update( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -376,18 +345,10 @@ async def begin_create_or_update( :type packet_core_control_plane_name: str :param parameters: Parameters supplied to the create or update packet core control plane operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 PacketCoreControlPlane or the result of cls(response) :rtype: @@ -400,7 +361,7 @@ async def begin_create_or_update( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: Union[_models.PacketCoreControlPlane, IO], + parameters: Union[_models.PacketCoreControlPlane, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PacketCoreControlPlane]: """Creates or updates a packet core control plane. @@ -411,19 +372,8 @@ async def begin_create_or_update( :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str :param parameters: Parameters supplied to the create or update packet core control plane - operation. Is either a PacketCoreControlPlane type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane 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 - :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. + operation. Is either a PacketCoreControlPlane type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane or IO[bytes] :return: An instance of AsyncLROPoller that returns either PacketCoreControlPlane or the result of cls(response) :rtype: @@ -456,7 +406,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PacketCoreControlPlane", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -469,17 +419,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PacketCoreControlPlane].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}" - } + return AsyncLROPoller[_models.PacketCoreControlPlane]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update_tags( @@ -503,7 +451,6 @@ async def update_tags( :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: PacketCoreControlPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane :raises ~azure.core.exceptions.HttpResponseError: @@ -514,7 +461,7 @@ async def update_tags( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -527,11 +474,10 @@ async def update_tags( :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str :param parameters: Parameters supplied to patch packet core control plane resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: PacketCoreControlPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane :raises ~azure.core.exceptions.HttpResponseError: @@ -542,7 +488,7 @@ async def update_tags( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: Union[_models.IdentityAndTagsObject, IO], + parameters: Union[_models.IdentityAndTagsObject, IO[bytes]], **kwargs: Any ) -> _models.PacketCoreControlPlane: """Patch packet core control plane resource. @@ -553,17 +499,13 @@ async def update_tags( :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str :param parameters: Parameters supplied to patch packet core control plane resource. Is either a - IdentityAndTagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject 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 + IdentityAndTagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject or IO[bytes] :return: PacketCoreControlPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -586,7 +528,7 @@ async def update_tags( else: _json = self._serialize.body(parameters, "IdentityAndTagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, @@ -594,16 +536,15 @@ async def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -616,19 +557,14 @@ async def update_tags( deserialized = self._deserialize("PacketCoreControlPlane", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}" - } + return deserialized # type: ignore @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PacketCoreControlPlane"]: """Lists all the packet core control planes in a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PacketCoreControlPlane or the result of cls(response) :rtype: @@ -641,7 +577,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PacketCo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlaneListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -652,15 +588,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PacketCo def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -672,13 +607,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PacketCoreControlPlaneListResult", pipeline_response) @@ -688,11 +623,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -705,10 +640,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes" - } - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any @@ -718,7 +649,6 @@ def list_by_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 PacketCoreControlPlane or the result of cls(response) :rtype: @@ -731,7 +661,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlaneListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -742,16 +672,15 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -763,13 +692,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PacketCoreControlPlaneListResult", pipeline_response) @@ -779,11 +708,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -796,14 +725,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes" - } - async def _rollback_initial( self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -817,21 +742,20 @@ async def _rollback_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.AsyncOperationStatus]] = kwargs.pop("cls", None) - request = build_rollback_request( + _request = build_rollback_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rollback_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -846,13 +770,9 @@ async def _rollback_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _rollback_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" - } + return deserialized # type: ignore @distributed_trace_async async def begin_rollback( @@ -866,14 +786,6 @@ async def begin_rollback( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: 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 AsyncOperationStatus or the result of cls(response) :rtype: @@ -903,7 +815,7 @@ async def begin_rollback( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -915,22 +827,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.AsyncOperationStatus].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_rollback.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" - } + return AsyncLROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _reinstall_initial( self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -944,21 +854,20 @@ async def _reinstall_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.AsyncOperationStatus]] = kwargs.pop("cls", None) - request = build_reinstall_request( + _request = build_reinstall_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._reinstall_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -973,13 +882,9 @@ async def _reinstall_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _reinstall_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" - } + return deserialized # type: ignore @distributed_trace_async async def begin_reinstall( @@ -994,14 +899,6 @@ async def begin_reinstall( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: 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 AsyncOperationStatus or the result of cls(response) :rtype: @@ -1031,7 +928,7 @@ async def begin_reinstall( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1043,26 +940,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.AsyncOperationStatus].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_reinstall.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" - } + return AsyncLROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _collect_diagnostics_package_initial( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO], + parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO[bytes]], **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1085,7 +980,7 @@ async def _collect_diagnostics_package_initial( else: _json = self._serialize.body(parameters, "PacketCoreControlPlaneCollectDiagnosticsPackage") - request = build_collect_diagnostics_package_request( + _request = build_collect_diagnostics_package_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, @@ -1093,16 +988,15 @@ async def _collect_diagnostics_package_initial( content_type=content_type, json=_json, content=_content, - template_url=self._collect_diagnostics_package_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1117,13 +1011,9 @@ async def _collect_diagnostics_package_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _collect_diagnostics_package_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" - } + return deserialized # type: ignore @overload async def begin_collect_diagnostics_package( @@ -1150,14 +1040,6 @@ async def begin_collect_diagnostics_package( :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: @@ -1170,7 +1052,7 @@ async def begin_collect_diagnostics_package( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1185,18 +1067,10 @@ async def begin_collect_diagnostics_package( :type packet_core_control_plane_name: str :param parameters: Parameters supplied to the packet core control plane collect diagnostics package operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: @@ -1209,7 +1083,7 @@ async def begin_collect_diagnostics_package( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO], + parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.AsyncOperationStatus]: """Collect a diagnostics package for the specified packet core control plane. This action will @@ -1221,21 +1095,10 @@ async def begin_collect_diagnostics_package( :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str :param parameters: Parameters supplied to the packet core control plane collect diagnostics - package operation. Is either a PacketCoreControlPlaneCollectDiagnosticsPackage type or a IO - type. Required. + package operation. Is either a PacketCoreControlPlaneCollectDiagnosticsPackage type or a + IO[bytes] type. Required. :type parameters: - ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneCollectDiagnosticsPackage 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 - :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. + ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneCollectDiagnosticsPackage or IO[bytes] :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result of cls(response) :rtype: @@ -1268,7 +1131,7 @@ async def begin_collect_diagnostics_package( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1280,14 +1143,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.AsyncOperationStatus].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_collect_diagnostics_package.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" - } + return AsyncLROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_data_planes_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_data_planes_operations.py index a325736760fb..624cb11fe8e4 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_data_planes_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_data_planes_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ build_update_tags_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +74,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements packet_core_data_plane_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -83,22 +88,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -109,11 +113,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -132,14 +132,6 @@ async def begin_delete( :type packet_core_control_plane_name: str :param packet_core_data_plane_name: The name of the packet core data plane. Required. :type packet_core_data_plane_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -167,7 +159,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -178,17 +170,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -207,12 +195,11 @@ async def get( :type packet_core_control_plane_name: str :param packet_core_data_plane_name: The name of the packet core data plane. Required. :type packet_core_data_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PacketCoreDataPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -226,22 +213,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreDataPlane] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -254,23 +240,19 @@ async def get( deserialized = self._deserialize("PacketCoreDataPlane", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, packet_core_control_plane_name: str, packet_core_data_plane_name: str, - parameters: Union[_models.PacketCoreDataPlane, IO], + parameters: Union[_models.PacketCoreDataPlane, IO[bytes]], **kwargs: Any ) -> _models.PacketCoreDataPlane: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -293,7 +275,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "PacketCoreDataPlane") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, @@ -302,16 +284,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -332,10 +313,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}" - } - @overload async def begin_create_or_update( self, @@ -363,14 +340,6 @@ async def begin_create_or_update( :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 - :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 PacketCoreDataPlane or the result of cls(response) :rtype: @@ -384,7 +353,7 @@ async def begin_create_or_update( resource_group_name: str, packet_core_control_plane_name: str, packet_core_data_plane_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -401,18 +370,10 @@ async def begin_create_or_update( :type packet_core_data_plane_name: str :param parameters: Parameters supplied to the create or update packet core data plane operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 PacketCoreDataPlane or the result of cls(response) :rtype: @@ -426,7 +387,7 @@ async def begin_create_or_update( resource_group_name: str, packet_core_control_plane_name: str, packet_core_data_plane_name: str, - parameters: Union[_models.PacketCoreDataPlane, IO], + parameters: Union[_models.PacketCoreDataPlane, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PacketCoreDataPlane]: """Creates or updates a packet core data plane. Must be created in the same location as its parent @@ -440,19 +401,8 @@ async def begin_create_or_update( :param packet_core_data_plane_name: The name of the packet core data plane. Required. :type packet_core_data_plane_name: str :param parameters: Parameters supplied to the create or update packet core data plane - operation. Is either a PacketCoreDataPlane type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane 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 - :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. + operation. Is either a PacketCoreDataPlane type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane or IO[bytes] :return: An instance of AsyncLROPoller that returns either PacketCoreDataPlane or the result of cls(response) :rtype: @@ -486,7 +436,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PacketCoreDataPlane", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -499,17 +449,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PacketCoreDataPlane].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}" - } + return AsyncLROPoller[_models.PacketCoreDataPlane]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update_tags( @@ -536,7 +484,6 @@ async def update_tags( :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: PacketCoreDataPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane :raises ~azure.core.exceptions.HttpResponseError: @@ -548,7 +495,7 @@ async def update_tags( resource_group_name: str, packet_core_control_plane_name: str, packet_core_data_plane_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -563,11 +510,10 @@ async def update_tags( :param packet_core_data_plane_name: The name of the packet core data plane. Required. :type packet_core_data_plane_name: str :param parameters: Parameters supplied to update packet core data plane tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: PacketCoreDataPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane :raises ~azure.core.exceptions.HttpResponseError: @@ -579,7 +525,7 @@ async def update_tags( resource_group_name: str, packet_core_control_plane_name: str, packet_core_data_plane_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.PacketCoreDataPlane: """Updates packet core data planes tags. @@ -592,17 +538,13 @@ async def update_tags( :param packet_core_data_plane_name: The name of the packet core data plane. Required. :type packet_core_data_plane_name: str :param parameters: Parameters supplied to update packet core data plane tags. Is either a - TagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + TagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: PacketCoreDataPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -625,7 +567,7 @@ async def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, @@ -634,16 +576,15 @@ async def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -656,13 +597,9 @@ async def update_tags( deserialized = self._deserialize("PacketCoreDataPlane", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}" - } + return deserialized # type: ignore @distributed_trace def list_by_packet_core_control_plane( @@ -675,7 +612,6 @@ def list_by_packet_core_control_plane( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PacketCoreDataPlane or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane] @@ -687,7 +623,7 @@ def list_by_packet_core_control_plane( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreDataPlaneListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -698,17 +634,16 @@ def list_by_packet_core_control_plane( def prepare_request(next_link=None): if not next_link: - request = build_list_by_packet_core_control_plane_request( + _request = build_list_by_packet_core_control_plane_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_packet_core_control_plane.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -720,13 +655,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PacketCoreDataPlaneListResult", pipeline_response) @@ -736,11 +671,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -752,7 +687,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_packet_core_control_plane.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_routing_info_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_routing_info_operations.py new file mode 100644 index 000000000000..3a42e84a62ef --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_routing_info_operations.py @@ -0,0 +1,205 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, 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._routing_info_operations import build_get_request, build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RoutingInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.mobilenetwork.aio.MobileNetworkManagementClient`'s + :attr:`routing_info` 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") + + @distributed_trace + def list( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> AsyncIterable["_models.RoutingInfoModel"]: + """List all of the routing information for the packet core. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param packet_core_control_plane_name: The name of the packet core control plane. Required. + :type packet_core_control_plane_name: str + :return: An iterator like instance of either RoutingInfoModel or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.RoutingInfoModel] + :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._config.api_version)) + cls: ClsType[_models.RoutingInfoListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("RoutingInfoListResult", 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) + + @distributed_trace_async + async def get( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> _models.RoutingInfoModel: + """Get the routing information for the packet core. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param packet_core_control_plane_name: The name of the packet core control plane. Required. + :type packet_core_control_plane_name: str + :return: RoutingInfoModel or the result of cls(response) + :rtype: ~azure.mgmt.mobilenetwork.models.RoutingInfoModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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._config.api_version)) + cls: ClsType[_models.RoutingInfoModel] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("RoutingInfoModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_services_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_services_operations.py index cfedaeac69ce..7934adca9ed0 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_services_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_services_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ build_update_tags_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +70,7 @@ def __init__(self, *args, **kwargs) -> None: async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, service_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,22 +84,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -105,11 +109,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -123,16 +123,8 @@ async def begin_delete( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -160,7 +152,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -171,17 +163,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -195,14 +183,13 @@ async def get( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Service or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Service :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,22 +203,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Service] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, service_name=service_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -244,23 +230,19 @@ async def get( deserialized = self._deserialize("Service", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, mobile_network_name: str, service_name: str, - parameters: Union[_models.Service, IO], + parameters: Union[_models.Service, IO[bytes]], **kwargs: Any ) -> _models.Service: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -283,7 +265,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Service") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, service_name=service_name, @@ -292,16 +274,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -322,10 +303,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}" - } - @overload async def begin_create_or_update( self, @@ -346,21 +323,13 @@ async def begin_create_or_update( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to the create or update service operation. Required. :type parameters: ~azure.mgmt.mobilenetwork.models.Service :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 - :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 Service or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.Service] @@ -373,7 +342,7 @@ async def begin_create_or_update( resource_group_name: str, mobile_network_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -387,21 +356,13 @@ async def begin_create_or_update( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to the create or update service operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 Service or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.Service] @@ -414,7 +375,7 @@ async def begin_create_or_update( resource_group_name: str, mobile_network_name: str, service_name: str, - parameters: Union[_models.Service, IO], + parameters: Union[_models.Service, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Service]: """Creates or updates a service. Must be created in the same location as its parent mobile @@ -426,22 +387,11 @@ async def begin_create_or_update( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to the create or update service operation. Is either a - Service type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.Service 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 - :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. + Service type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.Service or IO[bytes] :return: An instance of AsyncLROPoller that returns either Service or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.Service] @@ -474,7 +424,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Service", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -487,17 +437,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Service].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}" - } + return AsyncLROPoller[_models.Service]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update_tags( @@ -518,14 +466,13 @@ async def update_tags( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to update service tags. Required. :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject :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: Service or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Service :raises ~azure.core.exceptions.HttpResponseError: @@ -537,7 +484,7 @@ async def update_tags( resource_group_name: str, mobile_network_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -550,14 +497,13 @@ async def update_tags( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to update service tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: Service or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Service :raises ~azure.core.exceptions.HttpResponseError: @@ -569,7 +515,7 @@ async def update_tags( resource_group_name: str, mobile_network_name: str, service_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.Service: """Updates service tags. @@ -580,20 +526,16 @@ async def update_tags( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to update service tags. Is either a TagsObject type or a - IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: Service or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Service :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -616,7 +558,7 @@ async def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, service_name=service_name, @@ -625,16 +567,15 @@ async def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -647,13 +588,9 @@ async def update_tags( deserialized = self._deserialize("Service", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}" - } + return deserialized # type: ignore @distributed_trace def list_by_mobile_network( @@ -666,7 +603,6 @@ def list_by_mobile_network( :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Service or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.Service] :raises ~azure.core.exceptions.HttpResponseError: @@ -677,7 +613,7 @@ def list_by_mobile_network( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServiceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -688,17 +624,16 @@ def list_by_mobile_network( def prepare_request(next_link=None): if not next_link: - request = build_list_by_mobile_network_request( + _request = build_list_by_mobile_network_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_mobile_network.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -710,13 +645,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("ServiceListResult", pipeline_response) @@ -726,11 +661,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -742,7 +677,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_mobile_network.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sim_groups_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sim_groups_operations.py index 55b4d2d08224..3afd17147744 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sim_groups_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sim_groups_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,6 +41,10 @@ build_update_tags_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +71,7 @@ def __init__(self, *args, **kwargs) -> None: async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, sim_group_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -80,21 +85,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -105,11 +109,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, sim_group_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -120,14 +120,6 @@ async def begin_delete(self, resource_group_name: str, sim_group_name: str, **kw :type resource_group_name: str :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -154,7 +146,7 @@ async def begin_delete(self, resource_group_name: str, sim_group_name: str, **kw def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -165,17 +157,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, sim_group_name: str, **kwargs: Any) -> _models.SimGroup: @@ -186,12 +174,11 @@ async def get(self, resource_group_name: str, sim_group_name: str, **kwargs: Any :type resource_group_name: str :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SimGroup or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,21 +192,20 @@ async def get(self, resource_group_name: str, sim_group_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SimGroup] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -232,18 +218,18 @@ async def get(self, resource_group_name: str, sim_group_name: str, **kwargs: Any deserialized = self._deserialize("SimGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}" - } + return deserialized # type: ignore async def _create_or_update_initial( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimGroup, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimGroup, IO[bytes]], + **kwargs: Any ) -> _models.SimGroup: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +252,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "SimGroup") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, @@ -274,16 +260,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -304,10 +289,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}" - } - @overload async def begin_create_or_update( self, @@ -330,14 +311,6 @@ async def begin_create_or_update( :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 - :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 SimGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.SimGroup] @@ -349,7 +322,7 @@ async def begin_create_or_update( self, resource_group_name: str, sim_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -362,18 +335,10 @@ async def begin_create_or_update( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the create or update SIM group operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 SimGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.SimGroup] @@ -382,7 +347,11 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimGroup, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimGroup, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.SimGroup]: """Creates or updates a SIM group. @@ -392,19 +361,8 @@ async def begin_create_or_update( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the create or update SIM group operation. Is either a - SimGroup type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimGroup 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 - :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. + SimGroup type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimGroup or IO[bytes] :return: An instance of AsyncLROPoller that returns either SimGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.SimGroup] @@ -436,7 +394,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("SimGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -449,17 +407,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.SimGroup].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}" - } + return AsyncLROPoller[_models.SimGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update_tags( @@ -483,7 +439,6 @@ async def update_tags( :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: SimGroup or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -494,7 +449,7 @@ async def update_tags( self, resource_group_name: str, sim_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -507,11 +462,10 @@ async def update_tags( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to patch SIM group resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: SimGroup or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -522,7 +476,7 @@ async def update_tags( self, resource_group_name: str, sim_group_name: str, - parameters: Union[_models.IdentityAndTagsObject, IO], + parameters: Union[_models.IdentityAndTagsObject, IO[bytes]], **kwargs: Any ) -> _models.SimGroup: """Patch SIM group resource. @@ -533,17 +487,13 @@ async def update_tags( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to patch SIM group resource. Is either a - IdentityAndTagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject 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 + IdentityAndTagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject or IO[bytes] :return: SimGroup or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +516,7 @@ async def update_tags( else: _json = self._serialize.body(parameters, "IdentityAndTagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, @@ -574,16 +524,15 @@ async def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -596,19 +545,14 @@ async def update_tags( deserialized = self._deserialize("SimGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}" - } + return deserialized # type: ignore @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SimGroup"]: """Gets all the SIM groups in a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SimGroup or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.SimGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -619,7 +563,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SimGroup api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SimGroupListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -630,15 +574,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SimGroup def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -650,13 +593,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("SimGroupListResult", pipeline_response) @@ -666,11 +609,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -683,10 +626,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/simGroups" - } - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.SimGroup"]: """Gets all the SIM groups in a resource group. @@ -694,7 +633,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy :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 SimGroup or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.SimGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -705,7 +643,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SimGroupListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -716,16 +654,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -737,13 +674,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("SimGroupListResult", pipeline_response) @@ -753,11 +690,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -769,7 +706,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sim_policies_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sim_policies_operations.py index cf6aac7ba160..92f444a2633c 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sim_policies_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sim_policies_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ build_update_tags_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +70,7 @@ def __init__(self, *args, **kwargs) -> None: async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, sim_policy_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,22 +84,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, sim_policy_name=sim_policy_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -105,11 +109,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -124,14 +124,6 @@ async def begin_delete( :type mobile_network_name: str :param sim_policy_name: The name of the SIM policy. Required. :type sim_policy_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -159,7 +151,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -170,17 +162,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -195,12 +183,11 @@ async def get( :type mobile_network_name: str :param sim_policy_name: The name of the SIM policy. Required. :type sim_policy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SimPolicy or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,22 +201,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SimPolicy] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, sim_policy_name=sim_policy_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,23 +228,19 @@ async def get( deserialized = self._deserialize("SimPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, mobile_network_name: str, sim_policy_name: str, - parameters: Union[_models.SimPolicy, IO], + parameters: Union[_models.SimPolicy, IO[bytes]], **kwargs: Any ) -> _models.SimPolicy: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -281,7 +263,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "SimPolicy") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, sim_policy_name=sim_policy_name, @@ -290,16 +272,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -320,10 +301,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}" - } - @overload async def begin_create_or_update( self, @@ -350,14 +327,6 @@ async def begin_create_or_update( :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 - :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 SimPolicy or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.SimPolicy] @@ -370,7 +339,7 @@ async def begin_create_or_update( resource_group_name: str, mobile_network_name: str, sim_policy_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -386,18 +355,10 @@ async def begin_create_or_update( :param sim_policy_name: The name of the SIM policy. Required. :type sim_policy_name: str :param parameters: Parameters supplied to the create or update SIM policy operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 SimPolicy or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.SimPolicy] @@ -410,7 +371,7 @@ async def begin_create_or_update( resource_group_name: str, mobile_network_name: str, sim_policy_name: str, - parameters: Union[_models.SimPolicy, IO], + parameters: Union[_models.SimPolicy, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.SimPolicy]: """Creates or updates a SIM policy. Must be created in the same location as its parent mobile @@ -424,19 +385,8 @@ async def begin_create_or_update( :param sim_policy_name: The name of the SIM policy. Required. :type sim_policy_name: str :param parameters: Parameters supplied to the create or update SIM policy operation. Is either - a SimPolicy type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimPolicy 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 - :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. + a SimPolicy type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimPolicy or IO[bytes] :return: An instance of AsyncLROPoller that returns either SimPolicy or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.SimPolicy] @@ -469,7 +419,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("SimPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -482,17 +432,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.SimPolicy].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}" - } + return AsyncLROPoller[_models.SimPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update_tags( @@ -519,7 +467,6 @@ async def update_tags( :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: SimPolicy or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimPolicy :raises ~azure.core.exceptions.HttpResponseError: @@ -531,7 +478,7 @@ async def update_tags( resource_group_name: str, mobile_network_name: str, sim_policy_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -546,11 +493,10 @@ async def update_tags( :param sim_policy_name: The name of the SIM policy. Required. :type sim_policy_name: str :param parameters: Parameters supplied to update SIM policy tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: SimPolicy or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimPolicy :raises ~azure.core.exceptions.HttpResponseError: @@ -562,7 +508,7 @@ async def update_tags( resource_group_name: str, mobile_network_name: str, sim_policy_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.SimPolicy: """Updates SIM policy tags. @@ -575,17 +521,13 @@ async def update_tags( :param sim_policy_name: The name of the SIM policy. Required. :type sim_policy_name: str :param parameters: Parameters supplied to update SIM policy tags. Is either a TagsObject type - or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: SimPolicy or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -608,7 +550,7 @@ async def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, sim_policy_name=sim_policy_name, @@ -617,16 +559,15 @@ async def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -639,13 +580,9 @@ async def update_tags( deserialized = self._deserialize("SimPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}" - } + return deserialized # type: ignore @distributed_trace def list_by_mobile_network( @@ -658,7 +595,6 @@ def list_by_mobile_network( :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SimPolicy or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.SimPolicy] :raises ~azure.core.exceptions.HttpResponseError: @@ -669,7 +605,7 @@ def list_by_mobile_network( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SimPolicyListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -680,17 +616,16 @@ def list_by_mobile_network( def prepare_request(next_link=None): if not next_link: - request = build_list_by_mobile_network_request( + _request = build_list_by_mobile_network_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_mobile_network.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -702,13 +637,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("SimPolicyListResult", pipeline_response) @@ -718,11 +653,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -734,7 +669,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_mobile_network.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sims_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sims_operations.py index 3e8d92ac9f70..884c893195fd 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sims_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sims_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,12 +36,18 @@ build_bulk_delete_request, build_bulk_upload_encrypted_request, build_bulk_upload_request, + build_clone_request, build_create_or_update_request, build_delete_request, build_get_request, build_list_by_group_request, + build_move_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +74,7 @@ def __init__(self, *args, **kwargs) -> None: async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, sim_group_name: str, sim_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -81,22 +88,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, sim_name=sim_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -107,11 +113,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -126,14 +128,6 @@ async def begin_delete( :type sim_group_name: str :param sim_name: The name of the SIM. Required. :type sim_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -161,7 +155,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -172,17 +166,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, sim_group_name: str, sim_name: str, **kwargs: Any) -> _models.Sim: @@ -195,12 +185,11 @@ async def get(self, resource_group_name: str, sim_group_name: str, sim_name: str :type sim_group_name: str :param sim_name: The name of the SIM. Required. :type sim_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Sim or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Sim :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,22 +203,21 @@ async def get(self, resource_group_name: str, sim_group_name: str, sim_name: str api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Sim] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, sim_name=sim_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,23 +230,19 @@ async def get(self, resource_group_name: str, sim_group_name: str, sim_name: str deserialized = self._deserialize("Sim", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, sim_group_name: str, sim_name: str, - parameters: Union[_models.Sim, IO], + parameters: Union[_models.Sim, IO[bytes]], **kwargs: Any ) -> _models.Sim: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -281,7 +265,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Sim") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, sim_name=sim_name, @@ -290,16 +274,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -320,10 +303,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}" - } - @overload async def begin_create_or_update( self, @@ -349,14 +328,6 @@ async def begin_create_or_update( :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 - :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 Sim or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.Sim] :raises ~azure.core.exceptions.HttpResponseError: @@ -368,7 +339,7 @@ async def begin_create_or_update( resource_group_name: str, sim_group_name: str, sim_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -383,18 +354,10 @@ async def begin_create_or_update( :param sim_name: The name of the SIM. Required. :type sim_name: str :param parameters: Parameters supplied to the create or update SIM operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 Sim or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.Sim] :raises ~azure.core.exceptions.HttpResponseError: @@ -406,7 +369,7 @@ async def begin_create_or_update( resource_group_name: str, sim_group_name: str, sim_name: str, - parameters: Union[_models.Sim, IO], + parameters: Union[_models.Sim, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Sim]: """Creates or updates a SIM. @@ -419,19 +382,8 @@ async def begin_create_or_update( :param sim_name: The name of the SIM. Required. :type sim_name: str :param parameters: Parameters supplied to the create or update SIM operation. Is either a Sim - type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.Sim 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 - :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. + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.Sim or IO[bytes] :return: An instance of AsyncLROPoller that returns either Sim or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.Sim] :raises ~azure.core.exceptions.HttpResponseError: @@ -463,7 +415,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Sim", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -476,17 +428,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Sim].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}" - } + return AsyncLROPoller[_models.Sim]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_group( @@ -499,7 +449,6 @@ def list_by_group( :type resource_group_name: str :param sim_group_name: The name of the SIM Group. Required. :type sim_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 Sim or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.Sim] :raises ~azure.core.exceptions.HttpResponseError: @@ -510,7 +459,7 @@ def list_by_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SimListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -521,17 +470,16 @@ def list_by_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_group_request( + _request = build_list_by_group_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -543,13 +491,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("SimListResult", pipeline_response) @@ -559,11 +507,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -576,14 +524,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims" - } - async def _bulk_upload_initial( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimUploadList, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimUploadList, IO[bytes]], + **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -606,7 +554,7 @@ async def _bulk_upload_initial( else: _json = self._serialize.body(parameters, "SimUploadList") - request = build_bulk_upload_request( + _request = build_bulk_upload_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, @@ -614,16 +562,15 @@ async def _bulk_upload_initial( content_type=content_type, json=_json, content=_content, - template_url=self._bulk_upload_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -638,13 +585,9 @@ async def _bulk_upload_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _bulk_upload_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" - } + return deserialized # type: ignore @overload async def begin_bulk_upload( @@ -668,14 +611,6 @@ async def begin_bulk_upload( :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: @@ -688,7 +623,7 @@ async def begin_bulk_upload( self, resource_group_name: str, sim_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -701,18 +636,10 @@ async def begin_bulk_upload( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the bulk SIM upload operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: @@ -722,7 +649,11 @@ async def begin_bulk_upload( @distributed_trace_async async def begin_bulk_upload( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimUploadList, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimUploadList, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.AsyncOperationStatus]: """Bulk upload SIMs to a SIM group. @@ -732,19 +663,8 @@ async def begin_bulk_upload( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the bulk SIM upload operation. Is either a - SimUploadList type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimUploadList 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 - :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. + SimUploadList type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimUploadList or IO[bytes] :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result of cls(response) :rtype: @@ -777,7 +697,7 @@ async def begin_bulk_upload( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -789,22 +709,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.AsyncOperationStatus].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_bulk_upload.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" - } + return AsyncLROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _bulk_delete_initial( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimDeleteList, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimDeleteList, IO[bytes]], + **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -827,7 +749,7 @@ async def _bulk_delete_initial( else: _json = self._serialize.body(parameters, "SimDeleteList") - request = build_bulk_delete_request( + _request = build_bulk_delete_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, @@ -835,16 +757,15 @@ async def _bulk_delete_initial( content_type=content_type, json=_json, content=_content, - template_url=self._bulk_delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -859,13 +780,9 @@ async def _bulk_delete_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _bulk_delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" - } + return deserialized # type: ignore @overload async def begin_bulk_delete( @@ -889,14 +806,6 @@ async def begin_bulk_delete( :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: @@ -909,7 +818,7 @@ async def begin_bulk_delete( self, resource_group_name: str, sim_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -922,18 +831,10 @@ async def begin_bulk_delete( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the bulk SIM delete operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: @@ -943,7 +844,11 @@ async def begin_bulk_delete( @distributed_trace_async async def begin_bulk_delete( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimDeleteList, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimDeleteList, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.AsyncOperationStatus]: """Bulk delete SIMs from a SIM group. @@ -953,19 +858,8 @@ async def begin_bulk_delete( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the bulk SIM delete operation. Is either a - SimDeleteList type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimDeleteList 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 - :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. + SimDeleteList type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimDeleteList or IO[bytes] :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result of cls(response) :rtype: @@ -998,7 +892,7 @@ async def begin_bulk_delete( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1010,26 +904,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.AsyncOperationStatus].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_bulk_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" - } + return AsyncLROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _bulk_upload_encrypted_initial( self, resource_group_name: str, sim_group_name: str, - parameters: Union[_models.EncryptedSimUploadList, IO], + parameters: Union[_models.EncryptedSimUploadList, IO[bytes]], **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1052,7 +944,7 @@ async def _bulk_upload_encrypted_initial( else: _json = self._serialize.body(parameters, "EncryptedSimUploadList") - request = build_bulk_upload_encrypted_request( + _request = build_bulk_upload_encrypted_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, @@ -1060,16 +952,15 @@ async def _bulk_upload_encrypted_initial( content_type=content_type, json=_json, content=_content, - template_url=self._bulk_upload_encrypted_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1084,13 +975,9 @@ async def _bulk_upload_encrypted_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _bulk_upload_encrypted_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" - } + return deserialized # type: ignore @overload async def begin_bulk_upload_encrypted( @@ -1114,14 +1001,6 @@ async def begin_bulk_upload_encrypted( :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: @@ -1134,7 +1013,7 @@ async def begin_bulk_upload_encrypted( self, resource_group_name: str, sim_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1147,18 +1026,10 @@ async def begin_bulk_upload_encrypted( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the encrypted SIMs upload operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: @@ -1171,7 +1042,7 @@ async def begin_bulk_upload_encrypted( self, resource_group_name: str, sim_group_name: str, - parameters: Union[_models.EncryptedSimUploadList, IO], + parameters: Union[_models.EncryptedSimUploadList, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.AsyncOperationStatus]: """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. @@ -1182,19 +1053,8 @@ async def begin_bulk_upload_encrypted( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the encrypted SIMs upload operation. Is either a - EncryptedSimUploadList type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.EncryptedSimUploadList 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 - :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. + EncryptedSimUploadList type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.EncryptedSimUploadList or IO[bytes] :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result of cls(response) :rtype: @@ -1227,7 +1087,206 @@ async def begin_bulk_upload_encrypted( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.AsyncOperationStatus].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _move_initial( + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimMove, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AsyncOperationStatus]] = 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, "SimMove") + + _request = build_move_request( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + 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, 202]: + 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 + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_move( + self, + resource_group_name: str, + sim_group_name: str, + parameters: _models.SimMove, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Move SIMs to another SIM Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to move the SIMs. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimMove + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_move( + self, + resource_group_name: str, + sim_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Move SIMs to another SIM Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to move the SIMs. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_move( + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimMove, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Move SIMs to another SIM Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to move the SIMs. Is either a SimMove type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimMove or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AsyncOperationStatus] = 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._move_initial( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1239,14 +1298,211 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.AsyncOperationStatus].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 + return AsyncLROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _clone_initial( + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimClone, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AsyncOperationStatus]] = 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, "SimClone") + + _request = build_clone_request( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) - begin_bulk_upload_encrypted.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" - } + _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, 202]: + 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 + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_clone( + self, + resource_group_name: str, + sim_group_name: str, + parameters: _models.SimClone, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Clone SIMs to another SIM Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to clone the SIMs. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimClone + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_clone( + self, + resource_group_name: str, + sim_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Clone SIMs to another SIM Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to clone the SIMs. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_clone( + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimClone, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Clone SIMs to another SIM Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to clone the SIMs. Is either a SimClone type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimClone or IO[bytes] + :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AsyncOperationStatus] = 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._clone_initial( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.AsyncOperationStatus].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sites_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sites_operations.py index 7e84c5aa117f..b78aa3ef6a8a 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sites_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sites_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,6 +41,10 @@ build_update_tags_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +71,7 @@ def __init__(self, *args, **kwargs) -> None: async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, site_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -80,22 +85,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, site_name=site_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -106,11 +110,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -126,14 +126,6 @@ async def begin_delete( :type mobile_network_name: str :param site_name: The name of the mobile network site. Required. :type site_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -161,7 +153,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -172,17 +164,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -197,12 +185,11 @@ async def get( :type mobile_network_name: str :param site_name: The name of the mobile network site. Required. :type site_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Site or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Site :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,22 +203,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Site] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, site_name=site_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -244,23 +230,19 @@ async def get( deserialized = self._deserialize("Site", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: Union[_models.Site, IO], + parameters: Union[_models.Site, IO[bytes]], **kwargs: Any ) -> _models.Site: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -283,7 +265,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Site") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, site_name=site_name, @@ -292,16 +274,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -322,10 +303,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}" - } - @overload async def begin_create_or_update( self, @@ -353,14 +330,6 @@ async def begin_create_or_update( :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 - :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 Site or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.Site] :raises ~azure.core.exceptions.HttpResponseError: @@ -372,7 +341,7 @@ async def begin_create_or_update( resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -389,18 +358,10 @@ async def begin_create_or_update( :type site_name: str :param parameters: Parameters supplied to the create or update mobile network site operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 Site or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.Site] :raises ~azure.core.exceptions.HttpResponseError: @@ -412,7 +373,7 @@ async def begin_create_or_update( resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: Union[_models.Site, IO], + parameters: Union[_models.Site, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Site]: """Creates or updates a mobile network site. Must be created in the same location as its parent @@ -426,19 +387,8 @@ async def begin_create_or_update( :param site_name: The name of the mobile network site. Required. :type site_name: str :param parameters: Parameters supplied to the create or update mobile network site operation. - Is either a Site type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.Site 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 - :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. + Is either a Site type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.Site or IO[bytes] :return: An instance of AsyncLROPoller that returns either Site or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.Site] :raises ~azure.core.exceptions.HttpResponseError: @@ -470,7 +420,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Site", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -483,17 +433,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Site].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}" - } + return AsyncLROPoller[_models.Site]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update_tags( @@ -520,7 +468,6 @@ async def update_tags( :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: Site or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Site :raises ~azure.core.exceptions.HttpResponseError: @@ -532,7 +479,7 @@ async def update_tags( resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -547,11 +494,10 @@ async def update_tags( :param site_name: The name of the mobile network site. Required. :type site_name: str :param parameters: Parameters supplied to update network site tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: Site or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Site :raises ~azure.core.exceptions.HttpResponseError: @@ -563,7 +509,7 @@ async def update_tags( resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.Site: """Updates site tags. @@ -576,17 +522,13 @@ async def update_tags( :param site_name: The name of the mobile network site. Required. :type site_name: str :param parameters: Parameters supplied to update network site tags. Is either a TagsObject type - or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: Site or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Site :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -609,7 +551,7 @@ async def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, site_name=site_name, @@ -618,16 +560,15 @@ async def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -640,13 +581,9 @@ async def update_tags( deserialized = self._deserialize("Site", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}" - } + return deserialized # type: ignore @distributed_trace def list_by_mobile_network( @@ -659,7 +596,6 @@ def list_by_mobile_network( :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Site or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.Site] :raises ~azure.core.exceptions.HttpResponseError: @@ -670,7 +606,7 @@ def list_by_mobile_network( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SiteListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -681,17 +617,16 @@ def list_by_mobile_network( def prepare_request(next_link=None): if not next_link: - request = build_list_by_mobile_network_request( + _request = build_list_by_mobile_network_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_mobile_network.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -703,13 +638,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("SiteListResult", pipeline_response) @@ -719,11 +654,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -736,19 +671,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_mobile_network.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites" - } - async def _delete_packet_core_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: Union[_models.SiteDeletePacketCore, IO], + parameters: Union[_models.SiteDeletePacketCore, IO[bytes]], **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -771,7 +702,7 @@ async def _delete_packet_core_initial( # pylint: disable=inconsistent-return-st else: _json = self._serialize.body(parameters, "SiteDeletePacketCore") - request = build_delete_packet_core_request( + _request = build_delete_packet_core_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, site_name=site_name, @@ -780,16 +711,15 @@ async def _delete_packet_core_initial( # pylint: disable=inconsistent-return-st content_type=content_type, json=_json, content=_content, - template_url=self._delete_packet_core_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -800,11 +730,7 @@ async def _delete_packet_core_initial( # pylint: disable=inconsistent-return-st raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_packet_core_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}/deletePacketCore" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def begin_delete_packet_core( @@ -831,14 +757,6 @@ async def begin_delete_packet_core( :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 - :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -850,7 +768,7 @@ async def begin_delete_packet_core( resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -865,18 +783,10 @@ async def begin_delete_packet_core( :param site_name: The name of the mobile network site. Required. :type site_name: str :param parameters: Parameters supplied to delete a packet core under a site. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -888,7 +798,7 @@ async def begin_delete_packet_core( resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: Union[_models.SiteDeletePacketCore, IO], + parameters: Union[_models.SiteDeletePacketCore, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a packet core under the specified mobile network site. @@ -901,19 +811,8 @@ async def begin_delete_packet_core( :param site_name: The name of the mobile network site. Required. :type site_name: str :param parameters: Parameters supplied to delete a packet core under a site. Is either a - SiteDeletePacketCore type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SiteDeletePacketCore 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 - :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. + SiteDeletePacketCore type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SiteDeletePacketCore or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -944,7 +843,7 @@ async def begin_delete_packet_core( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -955,14 +854,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete_packet_core.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}/deletePacketCore" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_slices_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_slices_operations.py index 017c3de2e5e6..2ceb58bba503 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_slices_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_slices_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ build_update_tags_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +70,7 @@ def __init__(self, *args, **kwargs) -> None: async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, slice_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,22 +84,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, slice_name=slice_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -105,11 +109,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -124,14 +124,6 @@ async def begin_delete( :type mobile_network_name: str :param slice_name: The name of the network slice. Required. :type slice_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -159,7 +151,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -170,17 +162,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -195,12 +183,11 @@ async def get( :type mobile_network_name: str :param slice_name: The name of the network slice. Required. :type slice_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Slice or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Slice :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,22 +201,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Slice] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, slice_name=slice_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,23 +228,19 @@ async def get( deserialized = self._deserialize("Slice", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, mobile_network_name: str, slice_name: str, - parameters: Union[_models.Slice, IO], + parameters: Union[_models.Slice, IO[bytes]], **kwargs: Any ) -> _models.Slice: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -281,7 +263,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Slice") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, slice_name=slice_name, @@ -290,16 +272,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -320,10 +301,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}" - } - @overload async def begin_create_or_update( self, @@ -351,14 +328,6 @@ async def begin_create_or_update( :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 - :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 Slice or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.Slice] :raises ~azure.core.exceptions.HttpResponseError: @@ -370,7 +339,7 @@ async def begin_create_or_update( resource_group_name: str, mobile_network_name: str, slice_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -387,18 +356,10 @@ async def begin_create_or_update( :type slice_name: str :param parameters: Parameters supplied to the create or update network slice operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 Slice or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.Slice] :raises ~azure.core.exceptions.HttpResponseError: @@ -410,7 +371,7 @@ async def begin_create_or_update( resource_group_name: str, mobile_network_name: str, slice_name: str, - parameters: Union[_models.Slice, IO], + parameters: Union[_models.Slice, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Slice]: """Creates or updates a network slice. Must be created in the same location as its parent mobile @@ -424,19 +385,8 @@ async def begin_create_or_update( :param slice_name: The name of the network slice. Required. :type slice_name: str :param parameters: Parameters supplied to the create or update network slice operation. Is - either a Slice type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.Slice 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 - :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. + either a Slice type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.Slice or IO[bytes] :return: An instance of AsyncLROPoller that returns either Slice or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.Slice] :raises ~azure.core.exceptions.HttpResponseError: @@ -468,7 +418,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Slice", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -481,17 +431,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Slice].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}" - } + return AsyncLROPoller[_models.Slice]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update_tags( @@ -518,7 +466,6 @@ async def update_tags( :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: Slice or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Slice :raises ~azure.core.exceptions.HttpResponseError: @@ -530,7 +477,7 @@ async def update_tags( resource_group_name: str, mobile_network_name: str, slice_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -545,11 +492,10 @@ async def update_tags( :param slice_name: The name of the network slice. Required. :type slice_name: str :param parameters: Parameters supplied to update network slice tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: Slice or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Slice :raises ~azure.core.exceptions.HttpResponseError: @@ -561,7 +507,7 @@ async def update_tags( resource_group_name: str, mobile_network_name: str, slice_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.Slice: """Updates slice tags. @@ -574,17 +520,13 @@ async def update_tags( :param slice_name: The name of the network slice. Required. :type slice_name: str :param parameters: Parameters supplied to update network slice tags. Is either a TagsObject - type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: Slice or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Slice :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -607,7 +549,7 @@ async def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, slice_name=slice_name, @@ -616,16 +558,15 @@ async def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -638,13 +579,9 @@ async def update_tags( deserialized = self._deserialize("Slice", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}" - } + return deserialized # type: ignore @distributed_trace def list_by_mobile_network( @@ -657,7 +594,6 @@ def list_by_mobile_network( :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Slice or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.Slice] :raises ~azure.core.exceptions.HttpResponseError: @@ -668,7 +604,7 @@ def list_by_mobile_network( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SliceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -679,17 +615,16 @@ def list_by_mobile_network( def prepare_request(next_link=None): if not next_link: - request = build_list_by_mobile_network_request( + _request = build_list_by_mobile_network_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_mobile_network.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -701,13 +636,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("SliceListResult", pipeline_response) @@ -717,11 +652,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -733,7 +668,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_mobile_network.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_ue_information_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_ue_information_operations.py index a2a6647561c3..daa66a79fc4b 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_ue_information_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_ue_information_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._ue_information_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,6 @@ def list( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UeInfo or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.UeInfo] :raises ~azure.core.exceptions.HttpResponseError: @@ -74,7 +78,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UeInfoList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -85,17 +89,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, 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) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -107,13 +110,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("UeInfoList", pipeline_response) @@ -123,11 +126,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -139,7 +142,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/ues" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/models/__init__.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/models/__init__.py index 02204c32ec23..93863bea2068 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/models/__init__.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/models/__init__.py @@ -41,6 +41,8 @@ from ._models_py3 import IdentityAndTagsObject from ._models_py3 import Installation from ._models_py3 import InterfaceProperties +from ._models_py3 import Ipv4Route +from ._models_py3 import Ipv4RouteNextHop from ._models_py3 import KeyVaultKey from ._models_py3 import LocalDiagnosticsAccessConfiguration from ._models_py3 import ManagedServiceIdentity @@ -75,17 +77,21 @@ from ._models_py3 import PublicLandMobileNetworkHomeNetworkPublicKeys from ._models_py3 import QosPolicy from ._models_py3 import Resource +from ._models_py3 import RoutingInfoListResult +from ._models_py3 import RoutingInfoModel from ._models_py3 import Service from ._models_py3 import ServiceDataFlowTemplate from ._models_py3 import ServiceListResult from ._models_py3 import ServiceResourceId from ._models_py3 import SignalingConfiguration from ._models_py3 import Sim +from ._models_py3 import SimClone from ._models_py3 import SimDeleteList from ._models_py3 import SimGroup from ._models_py3 import SimGroupListResult from ._models_py3 import SimGroupResourceId from ._models_py3 import SimListResult +from ._models_py3 import SimMove from ._models_py3 import SimNameAndEncryptedProperties from ._models_py3 import SimNameAndProperties from ._models_py3 import SimPolicy @@ -116,6 +122,8 @@ from ._models_py3 import UeSessionInfo4G from ._models_py3 import UeSessionInfo5G from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserConsentConfiguration +from ._models_py3 import UserPlaneDataRoutesItem from ._mobile_network_management_client_enums import AuthenticationType from ._mobile_network_management_client_enums import BillingSku @@ -129,6 +137,7 @@ from ._mobile_network_management_client_enums import InstallationState from ._mobile_network_management_client_enums import ManagedServiceIdentityType from ._mobile_network_management_client_enums import NaptEnabled +from ._mobile_network_management_client_enums import NasEncryptionType from ._mobile_network_management_client_enums import ObsoleteVersion from ._mobile_network_management_client_enums import PacketCaptureStatus from ._mobile_network_management_client_enums import PdnType @@ -188,6 +197,8 @@ "IdentityAndTagsObject", "Installation", "InterfaceProperties", + "Ipv4Route", + "Ipv4RouteNextHop", "KeyVaultKey", "LocalDiagnosticsAccessConfiguration", "ManagedServiceIdentity", @@ -222,17 +233,21 @@ "PublicLandMobileNetworkHomeNetworkPublicKeys", "QosPolicy", "Resource", + "RoutingInfoListResult", + "RoutingInfoModel", "Service", "ServiceDataFlowTemplate", "ServiceListResult", "ServiceResourceId", "SignalingConfiguration", "Sim", + "SimClone", "SimDeleteList", "SimGroup", "SimGroupListResult", "SimGroupResourceId", "SimListResult", + "SimMove", "SimNameAndEncryptedProperties", "SimNameAndProperties", "SimPolicy", @@ -263,6 +278,8 @@ "UeSessionInfo4G", "UeSessionInfo5G", "UserAssignedIdentity", + "UserConsentConfiguration", + "UserPlaneDataRoutesItem", "AuthenticationType", "BillingSku", "CertificateProvisioningState", @@ -275,6 +292,7 @@ "InstallationState", "ManagedServiceIdentityType", "NaptEnabled", + "NasEncryptionType", "ObsoleteVersion", "PacketCaptureStatus", "PdnType", diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/models/_mobile_network_management_client_enums.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/models/_mobile_network_management_client_enums.py index 7eaa4f744df0..89a95294d9b1 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/models/_mobile_network_management_client_enums.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/models/_mobile_network_management_client_enums.py @@ -101,29 +101,29 @@ class InstallationReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): NO_SLICES = "NoSlices" """The packet core has not been installed as the mobile network does not have any applicable - #: configured slices.""" + configured slices.""" NO_PACKET_CORE_DATA_PLANE = "NoPacketCoreDataPlane" """The packet core has not been installed as there is no configured data plane for this packet - #: core.""" + core.""" NO_ATTACHED_DATA_NETWORKS = "NoAttachedDataNetworks" """The packet core has not been installed as the packet core has no attached data networks.""" PUBLIC_LAND_MOBILE_NETWORK_IDENTIFIER_HAS_CHANGED = "PublicLandMobileNetworkIdentifierHasChanged" """A reinstall is required as the packet core is running with out-of-date PLMN ID.""" CONTROL_PLANE_ACCESS_INTERFACE_HAS_CHANGED = "ControlPlaneAccessInterfaceHasChanged" """A reinstall is required as the packet core is running with out-of-date control plane access - #: interface information.""" + interface information.""" USER_PLANE_ACCESS_INTERFACE_HAS_CHANGED = "UserPlaneAccessInterfaceHasChanged" """A reinstall is required as the packet core is running with out-of-date user plane core - #: interface.""" + interface.""" USER_PLANE_DATA_INTERFACE_HAS_CHANGED = "UserPlaneDataInterfaceHasChanged" """A reinstall is required as the packet core is running with out-of-date user plane access - #: interface.""" + interface.""" CONTROL_PLANE_ACCESS_VIRTUAL_IPV4_ADDRESSES_HAS_CHANGED = "ControlPlaneAccessVirtualIpv4AddressesHasChanged" """A reinstall is required as the packet core is running with out-of-date control plane access - #: network virtual IP address.""" + network virtual IP address.""" USER_PLANE_ACCESS_VIRTUAL_IPV4_ADDRESSES_HAS_CHANGED = "UserPlaneAccessVirtualIpv4AddressesHasChanged" """A reinstall is required as the packet core is running with out-of-date user plane access - #: network virtual IP address.""" + network virtual IP address.""" class InstallationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -165,6 +165,17 @@ class NaptEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): """NAPT is disabled""" +class NasEncryptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The supported NAS Encryption types.""" + + NEA0_EEA0 = "NEA0/EEA0" + """NAS signaling is not encrypted.""" + NEA1_EEA1 = "NEA1/EEA1" + """NAS signaling is encrypted with SNOW 3G cipher.""" + NEA2_EEA2 = "NEA2/EEA2" + """NAS signaling is encrypted with AES cipher.""" + + class ObsoleteVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether this version is obsolete.""" @@ -201,10 +212,10 @@ class PlatformType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AKS_HCI = "AKS-HCI" """If this option is chosen, you must set one of "azureStackEdgeDevice", "connectedCluster" or - #: "customLocation". If multiple are set, they must be consistent with each other.""" + "customLocation". If multiple are set, they must be consistent with each other.""" THREE_P_AZURE_STACK_HCI = "3P-AZURE-STACK-HCI" """If this option is chosen, you must set one of "azureStackHciCluster", "connectedCluster" or - #: "customLocation". If multiple are set, they must be consistent with each other.""" + "customLocation". If multiple are set, they must be consistent with each other.""" class PreemptionCapability(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/models/_models_py3.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/models/_models_py3.py index 4d1fca1d0f2a..51d60788a33a 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/models/_models_py3.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/models/_models_py3.py @@ -27,7 +27,7 @@ class Ambr(_serialization.Model): """Aggregate maximum bit rate. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar uplink: Uplink bit rate. Required. :vartype uplink: str @@ -60,7 +60,7 @@ def __init__(self, *, uplink: str, downlink: str, **kwargs: Any) -> None: class Arp(_serialization.Model): """Allocation and Retention Priority (ARP) parameters. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar priority_level: ARP priority level. Required. :vartype priority_level: int @@ -111,7 +111,7 @@ def __init__( class AsyncOperationId(_serialization.Model): """Reference to an Azure Async Operation ID. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Azure Async Operation ID. Required. :vartype id: str @@ -140,7 +140,7 @@ def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefi class AsyncOperationStatus(_serialization.Model): """The current status of an async operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified ID for the async operation. :vartype id: str @@ -233,7 +233,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -274,10 +274,10 @@ class TrackedResource(Resource): 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -328,10 +328,10 @@ class AttachedDataNetwork(TrackedResource): # pylint: disable=too-many-instance 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -496,7 +496,7 @@ def __init__(self, *, value: Optional[List["_models.AttachedDataNetwork"]] = Non class AttachedDataNetworkResourceId(_serialization.Model): """Reference to an attached data network resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Attached data network resource ID. Required. :vartype id: str @@ -525,7 +525,7 @@ def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefi class AzureStackEdgeDeviceResourceId(_serialization.Model): """Reference to an Azure Stack Edge device resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Azure Stack Edge device resource ID. Required. :vartype id: str @@ -554,7 +554,7 @@ def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefi class AzureStackHCIClusterResourceId(_serialization.Model): """Reference to an Azure Stack HCI cluster resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Azure Stack HCI cluster resource ID. Required. :vartype id: str @@ -614,7 +614,7 @@ class CommonSimPropertiesFormat(_serialization.Model): 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. + All required parameters must be populated in order to send to server. :ivar provisioning_state: The provisioning state of the SIM resource. Known values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and "Deleted". @@ -717,7 +717,7 @@ def __init__( class ConnectedClusterResourceId(_serialization.Model): """Reference to an Azure Arc custom location resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Azure Arc connected cluster resource ID. Required. :vartype id: str @@ -746,7 +746,7 @@ def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefi class CustomLocationResourceId(_serialization.Model): """Reference to an Azure Arc custom location resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Azure Arc custom location resource ID. Required. :vartype id: str @@ -777,10 +777,10 @@ class DataNetwork(TrackedResource): 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -840,7 +840,7 @@ def __init__( class DataNetworkConfiguration(_serialization.Model): """Settings controlling data network use. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar data_network: A reference to the data network that these settings apply to. The data network must be in the same location as the SIM policy. Required. @@ -1018,7 +1018,7 @@ def __init__(self, *, value: Optional[List["_models.DataNetwork"]] = None, **kwa class DataNetworkResourceId(_serialization.Model): """Reference to a data network resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Data network resource ID. Required. :vartype id: str @@ -1051,7 +1051,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1063,24 +1063,6 @@ class ProxyResource(Resource): :vartype system_data: ~azure.mgmt.mobilenetwork.models.SystemData """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class DiagnosticsPackage(ProxyResource): """Diagnostics package resource. @@ -1088,7 +1070,7 @@ class DiagnosticsPackage(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1170,7 +1152,7 @@ def __init__(self, *, value: Optional[List["_models.DiagnosticsPackage"]] = None class DiagnosticsUploadConfiguration(_serialization.Model): """Configuration for uploading packet core diagnostics. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar storage_account_container_url: The Storage Account Container URL to upload diagnostics to. Required. @@ -1232,7 +1214,7 @@ class EncryptedSimPropertiesFormat(CommonSimPropertiesFormat): # pylint: disabl 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. + All required parameters must be populated in order to send to server. :ivar provisioning_state: The provisioning state of the SIM resource. Known values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and "Deleted". @@ -1340,7 +1322,7 @@ def __init__( class EncryptedSimUploadList(_serialization.Model): """The SIMs to upload. The SIM credentials must be encrypted. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar version: The upload file format version. Required. :vartype version: int @@ -1511,7 +1493,7 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A class EventHubConfiguration(_serialization.Model): """Configuration for sending packet core events to Azure Event Hub. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Resource ID of Azure Event Hub to send packet core events to. Required. :vartype id: str @@ -1551,10 +1533,10 @@ class ExtendedUeInfo(ProxyResource): 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1599,7 +1581,7 @@ class ExtendedUeInfoProperties(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: UeInfo4G, UeInfo5G - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar rat_type: RAT Type. Required. Known values are: "4G" and "5G". :vartype rat_type: str or ~azure.mgmt.mobilenetwork.models.RatType @@ -1633,7 +1615,7 @@ class HomeNetworkPrivateKeysProvisioning(_serialization.Model): 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. + All required parameters must be populated in order to send to server. :ivar state: The provisioning state of the private keys for SUPI concealment. Required. Known values are: "NotProvisioned", "Provisioned", and "Failed". @@ -1657,7 +1639,7 @@ def __init__(self, **kwargs: Any) -> None: class HomeNetworkPublicKey(_serialization.Model): """A key used for SUPI concealment. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: The Home Network Public Key Identifier determines which public key was used to generate the SUCI sent to the AMF. See TS 23.003 Section 2.2B Section 5. Required. @@ -1699,7 +1681,7 @@ class HttpsServerCertificate(_serialization.Model): 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. + All required parameters must be populated in order to send to server. :ivar certificate_url: The certificate URL, unversioned. For example: https://contosovault.vault.azure.net/certificates/ingress. Required. @@ -1824,6 +1806,12 @@ class InterfaceProperties(_serialization.Model): :vartype ipv4_subnet: str :ivar ipv4_gateway: The default IPv4 gateway (router). :vartype ipv4_gateway: str + :ivar vlan_id: VLAN identifier of the network interface. Example: 501. + :vartype vlan_id: int + :ivar ipv4_address_list: The list of IPv4 addresses, for a multi-node system. + :vartype ipv4_address_list: list[str] + :ivar bfd_ipv4_endpoints: The IPv4 addresses of the endpoints to send BFD probes to. + :vartype bfd_ipv4_endpoints: list[str] """ _validation = { @@ -1836,6 +1824,7 @@ class InterfaceProperties(_serialization.Model): "ipv4_gateway": { "pattern": r"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$" }, + "vlan_id": {"maximum": 4094, "minimum": 1}, } _attribute_map = { @@ -1843,6 +1832,9 @@ class InterfaceProperties(_serialization.Model): "ipv4_address": {"key": "ipv4Address", "type": "str"}, "ipv4_subnet": {"key": "ipv4Subnet", "type": "str"}, "ipv4_gateway": {"key": "ipv4Gateway", "type": "str"}, + "vlan_id": {"key": "vlanId", "type": "int"}, + "ipv4_address_list": {"key": "ipv4AddressList", "type": "[str]"}, + "bfd_ipv4_endpoints": {"key": "bfdIpv4Endpoints", "type": "[str]"}, } def __init__( @@ -1852,6 +1844,9 @@ def __init__( ipv4_address: Optional[str] = None, ipv4_subnet: Optional[str] = None, ipv4_gateway: Optional[str] = None, + vlan_id: Optional[int] = None, + ipv4_address_list: Optional[List[str]] = None, + bfd_ipv4_endpoints: Optional[List[str]] = None, **kwargs: Any ) -> None: """ @@ -1864,12 +1859,93 @@ def __init__( :paramtype ipv4_subnet: str :keyword ipv4_gateway: The default IPv4 gateway (router). :paramtype ipv4_gateway: str + :keyword vlan_id: VLAN identifier of the network interface. Example: 501. + :paramtype vlan_id: int + :keyword ipv4_address_list: The list of IPv4 addresses, for a multi-node system. + :paramtype ipv4_address_list: list[str] + :keyword bfd_ipv4_endpoints: The IPv4 addresses of the endpoints to send BFD probes to. + :paramtype bfd_ipv4_endpoints: list[str] """ super().__init__(**kwargs) self.name = name self.ipv4_address = ipv4_address self.ipv4_subnet = ipv4_subnet self.ipv4_gateway = ipv4_gateway + self.vlan_id = vlan_id + self.ipv4_address_list = ipv4_address_list + self.bfd_ipv4_endpoints = bfd_ipv4_endpoints + + +class Ipv4Route(_serialization.Model): + """An IPv4 route. + + :ivar destination: The destination IPv4 prefix. + :vartype destination: str + :ivar next_hops: A list of next hops for the destination. + :vartype next_hops: list[~azure.mgmt.mobilenetwork.models.Ipv4RouteNextHop] + """ + + _validation = { + "destination": { + "pattern": r"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$" + }, + } + + _attribute_map = { + "destination": {"key": "destination", "type": "str"}, + "next_hops": {"key": "nextHops", "type": "[Ipv4RouteNextHop]"}, + } + + def __init__( + self, + *, + destination: Optional[str] = None, + next_hops: Optional[List["_models.Ipv4RouteNextHop"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword destination: The destination IPv4 prefix. + :paramtype destination: str + :keyword next_hops: A list of next hops for the destination. + :paramtype next_hops: list[~azure.mgmt.mobilenetwork.models.Ipv4RouteNextHop] + """ + super().__init__(**kwargs) + self.destination = destination + self.next_hops = next_hops + + +class Ipv4RouteNextHop(_serialization.Model): + """The next hop in an IPv4 route. + + :ivar address: The next hop address. + :vartype address: str + :ivar priority: The priority of this next hop. Next hops with lower preference values are + preferred. + :vartype priority: int + """ + + _validation = { + "address": { + "pattern": r"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$" + }, + } + + _attribute_map = { + "address": {"key": "address", "type": "str"}, + "priority": {"key": "priority", "type": "int"}, + } + + def __init__(self, *, address: Optional[str] = None, priority: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword address: The next hop address. + :paramtype address: str + :keyword priority: The priority of this next hop. Next hops with lower preference values are + preferred. + :paramtype priority: int + """ + super().__init__(**kwargs) + self.address = address + self.priority = priority class KeyVaultKey(_serialization.Model): @@ -1898,7 +1974,7 @@ class LocalDiagnosticsAccessConfiguration(_serialization.Model): """The kubernetes ingress configuration to control access to packet core diagnostics over local APIs. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar authentication_type: How to authenticate users who access local diagnostics APIs. Required. Known values are: "AAD" and "Password". @@ -1940,14 +2016,14 @@ def __init__( class ManagedServiceIdentity(_serialization.Model): """Managed service identity (User assigned identity). - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: Type of managed service identity (currently only UserAssigned allowed). Required. Known values are: "None" and "UserAssigned". :vartype type: str or ~azure.mgmt.mobilenetwork.models.ManagedServiceIdentityType :ivar user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. :vartype user_assigned_identities: dict[str, ~azure.mgmt.mobilenetwork.models.UserAssignedIdentity] @@ -1975,7 +2051,7 @@ def __init__( :paramtype type: str or ~azure.mgmt.mobilenetwork.models.ManagedServiceIdentityType :keyword user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.mobilenetwork.models.UserAssignedIdentity] @@ -1990,10 +2066,10 @@ class MobileNetwork(TrackedResource): # pylint: disable=too-many-instance-attri 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2128,7 +2204,7 @@ def __init__(self, *, value: Optional[List["_models.MobileNetwork"]] = None, **k class MobileNetworkResourceId(_serialization.Model): """Reference to a mobile network resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Mobile network resource ID. Required. :vartype id: str @@ -2233,7 +2309,7 @@ def __init__( class NASRerouteConfiguration(_serialization.Model): """Configuration enabling NAS reroute. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar macro_mme_group_id: The macro network's MME group ID. This is where unknown UEs are sent to via NAS reroute. Required. @@ -2375,7 +2451,7 @@ class PacketCapture(ProxyResource): # pylint: disable=too-many-instance-attribu Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2508,10 +2584,10 @@ class PacketCoreControlPlane(TrackedResource): # pylint: disable=too-many-insta 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2581,6 +2657,8 @@ class PacketCoreControlPlane(TrackedResource): # pylint: disable=too-many-insta private keys and keyIds for SUPI concealment. :vartype home_network_private_keys_provisioning: ~azure.mgmt.mobilenetwork.models.HomeNetworkPrivateKeysProvisioning + :ivar user_consent: The user consent configuration for the packet core. + :vartype user_consent: ~azure.mgmt.mobilenetwork.models.UserConsentConfiguration """ _validation = { @@ -2640,6 +2718,7 @@ class PacketCoreControlPlane(TrackedResource): # pylint: disable=too-many-insta "key": "properties.homeNetworkPrivateKeysProvisioning", "type": "HomeNetworkPrivateKeysProvisioning", }, + "user_consent": {"key": "properties.userConsent", "type": "UserConsentConfiguration"}, } def __init__( # pylint: disable=too-many-locals @@ -2662,6 +2741,7 @@ def __init__( # pylint: disable=too-many-locals event_hub: Optional["_models.EventHubConfiguration"] = None, signaling: Optional["_models.SignalingConfiguration"] = None, interop_settings: Optional[JSON] = None, + user_consent: Optional["_models.UserConsentConfiguration"] = None, **kwargs: Any ) -> None: """ @@ -2712,6 +2792,8 @@ def __init__( # pylint: disable=too-many-locals :keyword interop_settings: Settings to allow interoperability with third party components e.g. RANs and UEs. :paramtype interop_settings: JSON + :keyword user_consent: The user consent configuration for the packet core. + :paramtype user_consent: ~azure.mgmt.mobilenetwork.models.UserConsentConfiguration """ super().__init__(tags=tags, location=location, **kwargs) self.identity = identity @@ -2733,12 +2815,13 @@ def __init__( # pylint: disable=too-many-locals self.signaling = signaling self.interop_settings = interop_settings self.home_network_private_keys_provisioning = None + self.user_consent = user_consent -class PacketCoreControlPlaneCollectDiagnosticsPackage(_serialization.Model): +class PacketCoreControlPlaneCollectDiagnosticsPackage(_serialization.Model): # pylint: disable=name-too-long """Packet core control plane collect diagnostics package options. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar storage_account_blob_url: The Storage Account Blob URL to upload the diagnostics package to. Required. @@ -2796,7 +2879,7 @@ def __init__(self, *, value: Optional[List["_models.PacketCoreControlPlane"]] = class PacketCoreControlPlaneResourceId(_serialization.Model): """Reference to an packet core control plane resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Packet core control plane resource ID. Required. :vartype id: str @@ -2828,7 +2911,7 @@ class PacketCoreControlPlaneVersion(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2909,10 +2992,10 @@ class PacketCoreDataPlane(TrackedResource): 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3030,10 +3113,10 @@ def __init__(self, *, value: Optional[List["_models.PacketCoreDataPlane"]] = Non class PccRuleConfiguration(_serialization.Model): """Data flow policy rule configuration. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar rule_name: The name of the rule. This must be unique within the parent service. You must - not use any of the following reserved strings - ``default``\ , ``requested`` or ``service``. + not use any of the following reserved strings - ``default``\\ , ``requested`` or ``service``. Required. :vartype rule_name: str :ivar rule_precedence: A precedence value that is used to decide between data flow policy rules @@ -3083,7 +3166,7 @@ def __init__( ) -> None: """ :keyword rule_name: The name of the rule. This must be unique within the parent service. You - must not use any of the following reserved strings - ``default``\ , ``requested`` or + must not use any of the following reserved strings - ``default``\\ , ``requested`` or ``service``. Required. :paramtype rule_name: str :keyword rule_precedence: A precedence value that is used to decide between data flow policy @@ -3113,7 +3196,7 @@ def __init__( class QosPolicy(_serialization.Model): """QoS policy. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar five_qi: 5G QoS Flow Indicator value. The 5QI identifies a specific QoS forwarding treatment to be provided to a flow. See 3GPP TS23.501 section 5.7.2.1 for a full description of @@ -3202,7 +3285,7 @@ def __init__( class PccRuleQosPolicy(QosPolicy): """Data flow policy rule QoS policy. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar five_qi: 5G QoS Flow Indicator value. The 5QI identifies a specific QoS forwarding treatment to be provided to a flow. See 3GPP TS23.501 section 5.7.2.1 for a full description of @@ -3362,6 +3445,9 @@ class Platform(_serialization.Model): :ivar obsolete_version: Indicates whether this version is obsoleted for this platform. Known values are: "Obsolete" and "NotObsolete". :vartype obsolete_version: str or ~azure.mgmt.mobilenetwork.models.ObsoleteVersion + :ivar ha_upgrades_available: The list of versions to which a high availability upgrade from + this version is supported. + :vartype ha_upgrades_available: list[str] """ _attribute_map = { @@ -3371,6 +3457,7 @@ class Platform(_serialization.Model): "maximum_platform_software_version": {"key": "maximumPlatformSoftwareVersion", "type": "str"}, "recommended_version": {"key": "recommendedVersion", "type": "str"}, "obsolete_version": {"key": "obsoleteVersion", "type": "str"}, + "ha_upgrades_available": {"key": "haUpgradesAvailable", "type": "[str]"}, } def __init__( @@ -3382,6 +3469,7 @@ def __init__( maximum_platform_software_version: Optional[str] = None, recommended_version: Optional[Union[str, "_models.RecommendedVersion"]] = None, obsolete_version: Optional[Union[str, "_models.ObsoleteVersion"]] = None, + ha_upgrades_available: Optional[List[str]] = None, **kwargs: Any ) -> None: """ @@ -3404,6 +3492,9 @@ def __init__( :keyword obsolete_version: Indicates whether this version is obsoleted for this platform. Known values are: "Obsolete" and "NotObsolete". :paramtype obsolete_version: str or ~azure.mgmt.mobilenetwork.models.ObsoleteVersion + :keyword ha_upgrades_available: The list of versions to which a high availability upgrade from + this version is supported. + :paramtype ha_upgrades_available: list[str] """ super().__init__(**kwargs) self.platform_type = platform_type @@ -3412,6 +3503,7 @@ def __init__( self.maximum_platform_software_version = maximum_platform_software_version self.recommended_version = recommended_version self.obsolete_version = obsolete_version + self.ha_upgrades_available = ha_upgrades_available class PlatformConfiguration(_serialization.Model): @@ -3419,7 +3511,7 @@ class PlatformConfiguration(_serialization.Model): 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. + All required parameters must be populated in order to send to server. :ivar type: The platform type where packet core is deployed. Required. Known values are: "AKS-HCI" and "3P-AZURE-STACK-HCI". @@ -3498,7 +3590,7 @@ class PlmnId(_serialization.Model): can be used for testing and the values 999-99 and 999-999 can be used on internal private networks. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar mcc: Mobile country code (MCC). Required. :vartype mcc: str @@ -3601,7 +3693,7 @@ def __init__(self, *, tcp: int = 120, udp: int = 60, **kwargs: Any) -> None: class PublicLandMobileNetwork(PlmnId): """Configuration relating to a particular PLMN. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar mcc: Mobile country code (MCC). Required. :vartype mcc: str @@ -3647,7 +3739,7 @@ def __init__( self.home_network_public_keys = home_network_public_keys -class PublicLandMobileNetworkHomeNetworkPublicKeys(_serialization.Model): +class PublicLandMobileNetworkHomeNetworkPublicKeys(_serialization.Model): # pylint: disable=name-too-long """Configuration relating to SUPI concealment. :ivar profile_a: This provides a mapping to identify which public key has been used for SUPI @@ -3688,15 +3780,109 @@ def __init__( self.profile_b = profile_b +class RoutingInfoListResult(_serialization.Model): + """Response for the list routing information API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of the routing information for the packet core control plane. + :vartype value: list[~azure.mgmt.mobilenetwork.models.RoutingInfoModel] + :ivar next_link: The URL to get the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[RoutingInfoModel]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.RoutingInfoModel"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of the routing information for the packet core control plane. + :paramtype value: list[~azure.mgmt.mobilenetwork.models.RoutingInfoModel] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class RoutingInfoModel(ProxyResource): + """Routing information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.mobilenetwork.models.SystemData + :ivar control_plane_access_routes: A list of IPv4 routes. + :vartype control_plane_access_routes: list[~azure.mgmt.mobilenetwork.models.Ipv4Route] + :ivar user_plane_access_routes: A list of IPv4 routes. + :vartype user_plane_access_routes: list[~azure.mgmt.mobilenetwork.models.Ipv4Route] + :ivar user_plane_data_routes: A list of attached data networks and their IPv4 routes. + :vartype user_plane_data_routes: list[~azure.mgmt.mobilenetwork.models.UserPlaneDataRoutesItem] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "control_plane_access_routes": {"key": "properties.controlPlaneAccessRoutes", "type": "[Ipv4Route]"}, + "user_plane_access_routes": {"key": "properties.userPlaneAccessRoutes", "type": "[Ipv4Route]"}, + "user_plane_data_routes": {"key": "properties.userPlaneDataRoutes", "type": "[UserPlaneDataRoutesItem]"}, + } + + def __init__( + self, + *, + control_plane_access_routes: Optional[List["_models.Ipv4Route"]] = None, + user_plane_access_routes: Optional[List["_models.Ipv4Route"]] = None, + user_plane_data_routes: Optional[List["_models.UserPlaneDataRoutesItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword control_plane_access_routes: A list of IPv4 routes. + :paramtype control_plane_access_routes: list[~azure.mgmt.mobilenetwork.models.Ipv4Route] + :keyword user_plane_access_routes: A list of IPv4 routes. + :paramtype user_plane_access_routes: list[~azure.mgmt.mobilenetwork.models.Ipv4Route] + :keyword user_plane_data_routes: A list of attached data networks and their IPv4 routes. + :paramtype user_plane_data_routes: + list[~azure.mgmt.mobilenetwork.models.UserPlaneDataRoutesItem] + """ + super().__init__(**kwargs) + self.control_plane_access_routes = control_plane_access_routes + self.user_plane_access_routes = user_plane_access_routes + self.user_plane_data_routes = user_plane_data_routes + + class Service(TrackedResource): """Service resource. Must be created in the same location as its parent mobile network. 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3785,10 +3971,10 @@ def __init__( class ServiceDataFlowTemplate(_serialization.Model): """Data flow template. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar template_name: The name of the data flow template. This must be unique within the parent - data flow policy rule. You must not use any of the following reserved strings - ``default``\ , + data flow policy rule. You must not use any of the following reserved strings - ``default``\\ , ``requested`` or ``service``. Required. :vartype template_name: str :ivar direction: The direction of this flow. Required. Known values are: "Uplink", "Downlink", @@ -3812,7 +3998,7 @@ class ServiceDataFlowTemplate(_serialization.Model): ports or port ranges. If you specify one or more ports or port ranges then you must specify a value other than ``ip`` in the ``protocol`` field. This is an optional setting. If you do not specify it then connections will be allowed on all ports. Port ranges must be specified as - :code:``-:code:``. For example: [\ ``8080``\ , ``8082-8085``\ ]. + :code:``-:code:``. For example: [\\ ``8080``\\ , ``8082-8085``\\ ]. :vartype ports: list[str] """ @@ -3849,7 +4035,7 @@ def __init__( """ :keyword template_name: The name of the data flow template. This must be unique within the parent data flow policy rule. You must not use any of the following reserved strings - - ``default``\ , ``requested`` or ``service``. Required. + ``default``\\ , ``requested`` or ``service``. Required. :paramtype template_name: str :keyword direction: The direction of this flow. Required. Known values are: "Uplink", "Downlink", and "Bidirectional". @@ -3872,8 +4058,8 @@ def __init__( more ports or port ranges. If you specify one or more ports or port ranges then you must specify a value other than ``ip`` in the ``protocol`` field. This is an optional setting. If you do not specify it then connections will be allowed on all ports. Port ranges must be - specified as :code:``-:code:``. For example: [\ ``8080``\ , ``8082-8085``\ - ]. + specified as :code:``-:code:``. For example: [\\ ``8080``\\ , + ``8082-8085``\\ ]. :paramtype ports: list[str] """ super().__init__(**kwargs) @@ -3917,7 +4103,7 @@ def __init__(self, *, value: Optional[List["_models.Service"]] = None, **kwargs: class ServiceResourceId(_serialization.Model): """Reference to a service resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Service resource ID. Required. :vartype id: str @@ -3948,19 +4134,39 @@ class SignalingConfiguration(_serialization.Model): :ivar nas_reroute: Configuration enabling 4G NAS reroute. :vartype nas_reroute: ~azure.mgmt.mobilenetwork.models.NASRerouteConfiguration + :ivar nas_encryption: An ordered list of NAS encryption algorithms, used to encrypt control + plane traffic between the UE and packet core, in order from most to least preferred. If not + specified, the packet core will use a built-in default ordering. + :vartype nas_encryption: list[str or ~azure.mgmt.mobilenetwork.models.NasEncryptionType] """ + _validation = { + "nas_encryption": {"max_items": 3, "min_items": 1, "unique": True}, + } + _attribute_map = { "nas_reroute": {"key": "nasReroute", "type": "NASRerouteConfiguration"}, + "nas_encryption": {"key": "nasEncryption", "type": "[str]"}, } - def __init__(self, *, nas_reroute: Optional["_models.NASRerouteConfiguration"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + nas_reroute: Optional["_models.NASRerouteConfiguration"] = None, + nas_encryption: Optional[List[Union[str, "_models.NasEncryptionType"]]] = None, + **kwargs: Any + ) -> None: """ :keyword nas_reroute: Configuration enabling 4G NAS reroute. :paramtype nas_reroute: ~azure.mgmt.mobilenetwork.models.NASRerouteConfiguration + :keyword nas_encryption: An ordered list of NAS encryption algorithms, used to encrypt control + plane traffic between the UE and packet core, in order from most to least preferred. If not + specified, the packet core will use a built-in default ordering. + :paramtype nas_encryption: list[str or ~azure.mgmt.mobilenetwork.models.NasEncryptionType] """ super().__init__(**kwargs) self.nas_reroute = nas_reroute + self.nas_encryption = nas_encryption class Sim(ProxyResource): # pylint: disable=too-many-instance-attributes @@ -3968,10 +4174,10 @@ class Sim(ProxyResource): # pylint: disable=too-many-instance-attributes 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4106,10 +4312,46 @@ def __init__( self.operator_key_code = operator_key_code +class SimClone(_serialization.Model): + """The SIMs to clone. + + :ivar target_sim_group_id: The SIM Group where the SIMs should be cloned. + :vartype target_sim_group_id: ~azure.mgmt.mobilenetwork.models.SimGroupResourceId + :ivar sims: A list of SIM resource names to be cloned. + :vartype sims: list[str] + """ + + _validation = { + "sims": {"min_items": 1}, + } + + _attribute_map = { + "target_sim_group_id": {"key": "targetSimGroupId", "type": "SimGroupResourceId"}, + "sims": {"key": "sims", "type": "[str]"}, + } + + def __init__( + self, + *, + target_sim_group_id: Optional["_models.SimGroupResourceId"] = None, + sims: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword target_sim_group_id: The SIM Group where the SIMs should be cloned. + :paramtype target_sim_group_id: ~azure.mgmt.mobilenetwork.models.SimGroupResourceId + :keyword sims: A list of SIM resource names to be cloned. + :paramtype sims: list[str] + """ + super().__init__(**kwargs) + self.target_sim_group_id = target_sim_group_id + self.sims = sims + + class SimDeleteList(_serialization.Model): """The SIMs to delete. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar sims: A list of SIM resource names to delete. Required. :vartype sims: list[str] @@ -4137,10 +4379,10 @@ class SimGroup(TrackedResource): 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4251,7 +4493,7 @@ def __init__(self, *, value: Optional[List["_models.SimGroup"]] = None, **kwargs class SimGroupResourceId(_serialization.Model): """Reference to a SIM group resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: SIM group resource ID. Required. :vartype id: str @@ -4307,12 +4549,48 @@ def __init__(self, *, value: Optional[List["_models.Sim"]] = None, **kwargs: Any self.next_link = None +class SimMove(_serialization.Model): + """The SIMs to move. + + :ivar target_sim_group_id: The SIM Group where the SIMs should be moved. + :vartype target_sim_group_id: ~azure.mgmt.mobilenetwork.models.SimGroupResourceId + :ivar sims: A list of SIM resource names to be moved. + :vartype sims: list[str] + """ + + _validation = { + "sims": {"min_items": 1}, + } + + _attribute_map = { + "target_sim_group_id": {"key": "targetSimGroupId", "type": "SimGroupResourceId"}, + "sims": {"key": "sims", "type": "[str]"}, + } + + def __init__( + self, + *, + target_sim_group_id: Optional["_models.SimGroupResourceId"] = None, + sims: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword target_sim_group_id: The SIM Group where the SIMs should be moved. + :paramtype target_sim_group_id: ~azure.mgmt.mobilenetwork.models.SimGroupResourceId + :keyword sims: A list of SIM resource names to be moved. + :paramtype sims: list[str] + """ + super().__init__(**kwargs) + self.target_sim_group_id = target_sim_group_id + self.sims = sims + + class SimNameAndEncryptedProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes """SIM name and encrypted 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. + All required parameters must be populated in order to send to server. :ivar name: The name of the SIM. Required. :vartype name: str @@ -4436,7 +4714,7 @@ class SimNameAndProperties(_serialization.Model): # pylint: disable=too-many-in 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. + All required parameters must be populated in order to send to server. :ivar name: The name of the SIM. Required. :vartype name: str @@ -4568,10 +4846,10 @@ class SimPolicy(TrackedResource): # pylint: disable=too-many-instance-attribute 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4719,7 +4997,7 @@ def __init__(self, *, value: Optional[List["_models.SimPolicy"]] = None, **kwarg class SimPolicyResourceId(_serialization.Model): """Reference to a SIM policy resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: SIM policy resource ID. Required. :vartype id: str @@ -4750,7 +5028,7 @@ class SimPropertiesFormat(CommonSimPropertiesFormat): # pylint: disable=too-man 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. + All required parameters must be populated in order to send to server. :ivar provisioning_state: The provisioning state of the SIM resource. Known values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and "Deleted". @@ -4943,7 +5221,7 @@ def __init__(self, *, ipv4_address: Optional[str] = None, **kwargs: Any) -> None class SimUploadList(_serialization.Model): """The SIMs to upload. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar sims: A list of SIMs to upload. Required. :vartype sims: list[~azure.mgmt.mobilenetwork.models.SimNameAndProperties] @@ -4971,10 +5249,10 @@ class Site(TrackedResource): 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5084,7 +5362,7 @@ def __init__(self, *, value: Optional[List["_models.Site"]] = None, **kwargs: An class SiteResourceId(_serialization.Model): """Reference to a site resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Site resource ID. Required. :vartype id: str @@ -5115,10 +5393,10 @@ class Slice(TrackedResource): 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5193,7 +5471,7 @@ def __init__( class SliceConfiguration(_serialization.Model): """Per-slice settings. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar slice: A reference to the slice that these settings apply to. The slice must be in the same location as the SIM policy. Required. @@ -5280,7 +5558,7 @@ def __init__(self, *, value: Optional[List["_models.Slice"]] = None, **kwargs: A class SliceResourceId(_serialization.Model): """Reference to a slice resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Slice resource ID. Required. :vartype id: str @@ -5309,7 +5587,7 @@ def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefi class Snssai(_serialization.Model): """Single-network slice selection assistance information (S-NSSAI). - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar sst: Slice/service type (SST). Required. :vartype sst: int @@ -5342,7 +5620,7 @@ def __init__(self, *, sst: int, sd: Optional[str] = None, **kwargs: Any) -> None class SubResource(_serialization.Model): """Reference to another sub resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Resource ID. Required. :vartype id: str @@ -5454,10 +5732,10 @@ class UeInfo(ProxyResource): 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5529,7 +5807,7 @@ def __init__( class UeInfo4G(ExtendedUeInfoProperties): # pylint: disable=too-many-instance-attributes """UE Information for 4G. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar rat_type: RAT Type. Required. Known values are: "4G" and "5G". :vartype rat_type: str or ~azure.mgmt.mobilenetwork.models.RatType @@ -5833,7 +6111,7 @@ def __init__( # pylint: disable=too-many-locals class UeInfo5G(ExtendedUeInfoProperties): # pylint: disable=too-many-instance-attributes """UE Information for 5G. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar rat_type: RAT Type. Required. Known values are: "4G" and "5G". :vartype rat_type: str or ~azure.mgmt.mobilenetwork.models.RatType @@ -6175,7 +6453,7 @@ def __init__(self, *, value: Optional[List["_models.UeInfo"]] = None, **kwargs: class UeQOSFlow(_serialization.Model): """QoS Flow. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar qfi: Qos Flow Identifier. Required. :vartype qfi: int @@ -6246,7 +6524,7 @@ def __init__( class UeSessionInfo4G(_serialization.Model): """UE Session Info for 4G. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar ebi: EPS bearer identifier. Required. :vartype ebi: int @@ -6303,7 +6581,7 @@ def __init__( class UeSessionInfo5G(_serialization.Model): """UE Session Info for 5G. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar pdu_session_id: PDU session identifier. Required. :vartype pdu_session_id: int @@ -6423,3 +6701,58 @@ def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.principal_id = None self.client_id = None + + +class UserConsentConfiguration(_serialization.Model): + """UserConsentConfiguration. + + :ivar allow_support_telemetry_access: Allow Microsoft to access non-PII telemetry information + from the packet core. + :vartype allow_support_telemetry_access: bool + """ + + _attribute_map = { + "allow_support_telemetry_access": {"key": "allowSupportTelemetryAccess", "type": "bool"}, + } + + def __init__(self, *, allow_support_telemetry_access: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword allow_support_telemetry_access: Allow Microsoft to access non-PII telemetry + information from the packet core. + :paramtype allow_support_telemetry_access: bool + """ + super().__init__(**kwargs) + self.allow_support_telemetry_access = allow_support_telemetry_access + + +class UserPlaneDataRoutesItem(_serialization.Model): + """UserPlaneDataRoutesItem. + + :ivar attached_data_network: Reference to an attached data network resource. + :vartype attached_data_network: ~azure.mgmt.mobilenetwork.models.AttachedDataNetworkResourceId + :ivar routes: A list of IPv4 routes. + :vartype routes: list[~azure.mgmt.mobilenetwork.models.Ipv4Route] + """ + + _attribute_map = { + "attached_data_network": {"key": "attachedDataNetwork", "type": "AttachedDataNetworkResourceId"}, + "routes": {"key": "routes", "type": "[Ipv4Route]"}, + } + + def __init__( + self, + *, + attached_data_network: Optional["_models.AttachedDataNetworkResourceId"] = None, + routes: Optional[List["_models.Ipv4Route"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword attached_data_network: Reference to an attached data network resource. + :paramtype attached_data_network: + ~azure.mgmt.mobilenetwork.models.AttachedDataNetworkResourceId + :keyword routes: A list of IPv4 routes. + :paramtype routes: list[~azure.mgmt.mobilenetwork.models.Ipv4Route] + """ + super().__init__(**kwargs) + self.attached_data_network = attached_data_network + self.routes = routes diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/__init__.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/__init__.py index c6893634e771..c62772e8ee3b 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/__init__.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/__init__.py @@ -13,6 +13,7 @@ from ._operations import Operations from ._packet_captures_operations import PacketCapturesOperations from ._packet_core_control_planes_operations import PacketCoreControlPlanesOperations +from ._routing_info_operations import RoutingInfoOperations from ._packet_core_control_plane_versions_operations import PacketCoreControlPlaneVersionsOperations from ._packet_core_data_planes_operations import PacketCoreDataPlanesOperations from ._services_operations import ServicesOperations @@ -36,6 +37,7 @@ "Operations", "PacketCapturesOperations", "PacketCoreControlPlanesOperations", + "RoutingInfoOperations", "PacketCoreControlPlaneVersionsOperations", "PacketCoreDataPlanesOperations", "ServicesOperations", diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_attached_data_networks_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_attached_data_networks_operations.py index 94206d1e3967..c44ea8824f27 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_attached_data_networks_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_attached_data_networks_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,7 @@ def build_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +113,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +171,7 @@ def build_create_or_update_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -227,7 +232,7 @@ def build_update_tags_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -277,7 +282,7 @@ def build_update_tags_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_packet_core_data_plane_request( +def build_list_by_packet_core_data_plane_request( # pylint: disable=name-too-long resource_group_name: str, packet_core_control_plane_name: str, packet_core_data_plane_name: str, @@ -287,7 +292,7 @@ def build_list_by_packet_core_data_plane_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -354,7 +359,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements attached_data_network_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -368,23 +373,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, attached_data_network_name=attached_data_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -395,11 +399,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -421,14 +421,6 @@ def begin_delete( :type packet_core_data_plane_name: str :param attached_data_network_name: The name of the attached data network. Required. :type attached_data_network_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -457,7 +449,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -468,17 +460,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -500,12 +488,11 @@ def get( :type packet_core_data_plane_name: str :param attached_data_network_name: The name of the attached data network. Required. :type attached_data_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AttachedDataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.AttachedDataNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -519,23 +506,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AttachedDataNetwork] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, attached_data_network_name=attached_data_network_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,13 +534,9 @@ def get( deserialized = self._deserialize("AttachedDataNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -562,10 +544,10 @@ def _create_or_update_initial( packet_core_control_plane_name: str, packet_core_data_plane_name: str, attached_data_network_name: str, - parameters: Union[_models.AttachedDataNetwork, IO], + parameters: Union[_models.AttachedDataNetwork, IO[bytes]], **kwargs: Any ) -> _models.AttachedDataNetwork: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -588,7 +570,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "AttachedDataNetwork") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, @@ -598,16 +580,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -628,10 +609,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}" - } - @overload def begin_create_or_update( self, @@ -662,14 +639,6 @@ def begin_create_or_update( :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 - :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 AttachedDataNetwork or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AttachedDataNetwork] @@ -683,7 +652,7 @@ def begin_create_or_update( packet_core_control_plane_name: str, packet_core_data_plane_name: str, attached_data_network_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -702,18 +671,10 @@ def begin_create_or_update( :type attached_data_network_name: str :param parameters: Parameters supplied to the create or update attached data network operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 AttachedDataNetwork or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AttachedDataNetwork] @@ -727,7 +688,7 @@ def begin_create_or_update( packet_core_control_plane_name: str, packet_core_data_plane_name: str, attached_data_network_name: str, - parameters: Union[_models.AttachedDataNetwork, IO], + parameters: Union[_models.AttachedDataNetwork, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.AttachedDataNetwork]: """Creates or updates an attached data network. Must be created in the same location as its parent @@ -743,19 +704,8 @@ def begin_create_or_update( :param attached_data_network_name: The name of the attached data network. Required. :type attached_data_network_name: str :param parameters: Parameters supplied to the create or update attached data network operation. - Is either a AttachedDataNetwork type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.AttachedDataNetwork 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 - :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. + Is either a AttachedDataNetwork type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.AttachedDataNetwork or IO[bytes] :return: An instance of LROPoller that returns either AttachedDataNetwork or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AttachedDataNetwork] @@ -789,7 +739,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AttachedDataNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -801,17 +751,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.AttachedDataNetwork].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}" - } + return LROPoller[_models.AttachedDataNetwork]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update_tags( @@ -841,7 +789,6 @@ def update_tags( :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: AttachedDataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.AttachedDataNetwork :raises ~azure.core.exceptions.HttpResponseError: @@ -854,7 +801,7 @@ def update_tags( packet_core_control_plane_name: str, packet_core_data_plane_name: str, attached_data_network_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -871,11 +818,10 @@ def update_tags( :param attached_data_network_name: The name of the attached data network. Required. :type attached_data_network_name: str :param parameters: Parameters supplied to update attached data network tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: AttachedDataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.AttachedDataNetwork :raises ~azure.core.exceptions.HttpResponseError: @@ -888,7 +834,7 @@ def update_tags( packet_core_control_plane_name: str, packet_core_data_plane_name: str, attached_data_network_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.AttachedDataNetwork: """Updates an attached data network tags. @@ -903,17 +849,13 @@ def update_tags( :param attached_data_network_name: The name of the attached data network. Required. :type attached_data_network_name: str :param parameters: Parameters supplied to update attached data network tags. Is either a - TagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + TagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: AttachedDataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.AttachedDataNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -936,7 +878,7 @@ def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, @@ -946,16 +888,15 @@ def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -968,13 +909,9 @@ def update_tags( deserialized = self._deserialize("AttachedDataNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}" - } + return deserialized # type: ignore @distributed_trace def list_by_packet_core_data_plane( @@ -993,7 +930,6 @@ def list_by_packet_core_data_plane( :type packet_core_control_plane_name: str :param packet_core_data_plane_name: The name of the packet core data plane. Required. :type packet_core_data_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AttachedDataNetwork or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.AttachedDataNetwork] :raises ~azure.core.exceptions.HttpResponseError: @@ -1004,7 +940,7 @@ def list_by_packet_core_data_plane( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AttachedDataNetworkListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1015,18 +951,17 @@ def list_by_packet_core_data_plane( def prepare_request(next_link=None): if not next_link: - request = build_list_by_packet_core_data_plane_request( + _request = build_list_by_packet_core_data_plane_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_packet_core_data_plane.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1038,13 +973,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("AttachedDataNetworkListResult", pipeline_response) @@ -1054,11 +989,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1070,7 +1005,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_packet_core_data_plane.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_data_networks_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_data_networks_operations.py index 61506acd5c14..8de97e51129a 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_data_networks_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_data_networks_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +92,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +134,7 @@ def build_create_or_update_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -174,7 +179,7 @@ def build_update_tags_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -219,7 +224,7 @@ def build_list_by_mobile_network_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +275,7 @@ def __init__(self, *args, **kwargs): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, data_network_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -284,22 +289,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, data_network_name=data_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -310,11 +314,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -329,14 +329,6 @@ def begin_delete( :type mobile_network_name: str :param data_network_name: The name of the data network. Required. :type data_network_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -364,7 +356,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -375,17 +367,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -400,12 +388,11 @@ def get( :type mobile_network_name: str :param data_network_name: The name of the data network. Required. :type data_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.DataNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,22 +406,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataNetwork] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, data_network_name=data_network_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -447,23 +433,19 @@ def get( deserialized = self._deserialize("DataNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, mobile_network_name: str, data_network_name: str, - parameters: Union[_models.DataNetwork, IO], + parameters: Union[_models.DataNetwork, IO[bytes]], **kwargs: Any ) -> _models.DataNetwork: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -486,7 +468,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "DataNetwork") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, data_network_name=data_network_name, @@ -495,16 +477,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -525,10 +506,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}" - } - @overload def begin_create_or_update( self, @@ -556,14 +533,6 @@ def begin_create_or_update( :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 - :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 DataNetwork or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.DataNetwork] @@ -576,7 +545,7 @@ def begin_create_or_update( resource_group_name: str, mobile_network_name: str, data_network_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -593,18 +562,10 @@ def begin_create_or_update( :type data_network_name: str :param parameters: Parameters supplied to the create or update data network operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 DataNetwork or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.DataNetwork] @@ -617,7 +578,7 @@ def begin_create_or_update( resource_group_name: str, mobile_network_name: str, data_network_name: str, - parameters: Union[_models.DataNetwork, IO], + parameters: Union[_models.DataNetwork, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DataNetwork]: """Creates or updates a data network. Must be created in the same location as its parent mobile @@ -631,19 +592,8 @@ def begin_create_or_update( :param data_network_name: The name of the data network. Required. :type data_network_name: str :param parameters: Parameters supplied to the create or update data network operation. Is - either a DataNetwork type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.DataNetwork 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 - :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. + either a DataNetwork type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.DataNetwork or IO[bytes] :return: An instance of LROPoller that returns either DataNetwork or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.DataNetwork] @@ -676,7 +626,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DataNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -688,17 +638,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DataNetwork].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}" - } + return LROPoller[_models.DataNetwork]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update_tags( @@ -725,7 +673,6 @@ def update_tags( :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: DataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.DataNetwork :raises ~azure.core.exceptions.HttpResponseError: @@ -737,7 +684,7 @@ def update_tags( resource_group_name: str, mobile_network_name: str, data_network_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -752,11 +699,10 @@ def update_tags( :param data_network_name: The name of the data network. Required. :type data_network_name: str :param parameters: Parameters supplied to update data network tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: DataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.DataNetwork :raises ~azure.core.exceptions.HttpResponseError: @@ -768,7 +714,7 @@ def update_tags( resource_group_name: str, mobile_network_name: str, data_network_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.DataNetwork: """Updates data network tags. @@ -781,17 +727,13 @@ def update_tags( :param data_network_name: The name of the data network. Required. :type data_network_name: str :param parameters: Parameters supplied to update data network tags. Is either a TagsObject type - or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: DataNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.DataNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -814,7 +756,7 @@ def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, data_network_name=data_network_name, @@ -823,16 +765,15 @@ def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -845,13 +786,9 @@ def update_tags( deserialized = self._deserialize("DataNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}" - } + return deserialized # type: ignore @distributed_trace def list_by_mobile_network( @@ -864,7 +801,6 @@ def list_by_mobile_network( :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataNetwork or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.DataNetwork] :raises ~azure.core.exceptions.HttpResponseError: @@ -875,7 +811,7 @@ def list_by_mobile_network( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataNetworkListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -886,17 +822,16 @@ def list_by_mobile_network( def prepare_request(next_link=None): if not next_link: - request = build_list_by_mobile_network_request( + _request = build_list_by_mobile_network_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_mobile_network.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -908,13 +843,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("DataNetworkListResult", pipeline_response) @@ -924,11 +859,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -940,7 +875,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_mobile_network.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_diagnostics_packages_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_diagnostics_packages_operations.py index 00e1e03c19da..7a6b5fa930e6 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_diagnostics_packages_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_diagnostics_packages_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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, Union, cast +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -31,6 +32,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,7 @@ def build_create_or_update_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +103,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +153,7 @@ def build_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,13 +193,13 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_packet_core_control_plane_request( +def build_list_by_packet_core_control_plane_request( # pylint: disable=name-too-long resource_group_name: str, packet_core_control_plane_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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,7 +258,7 @@ def _create_or_update_initial( diagnostics_package_name: str, **kwargs: Any ) -> _models.DiagnosticsPackage: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,22 +272,21 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticsPackage] = kwargs.pop("cls", None) - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, diagnostics_package_name=diagnostics_package_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -303,10 +307,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" - } - @distributed_trace def begin_create_or_update( self, @@ -324,14 +324,6 @@ def begin_create_or_update( :type packet_core_control_plane_name: str :param diagnostics_package_name: The name of the diagnostics package. Required. :type diagnostics_package_name: 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 DiagnosticsPackage or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.DiagnosticsPackage] @@ -361,7 +353,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("DiagnosticsPackage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -373,17 +365,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DiagnosticsPackage].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" - } + return LROPoller[_models.DiagnosticsPackage]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def get( @@ -402,12 +392,11 @@ def get( :type packet_core_control_plane_name: str :param diagnostics_package_name: The name of the diagnostics package. Required. :type diagnostics_package_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticsPackage or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.DiagnosticsPackage :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -421,22 +410,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticsPackage] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, diagnostics_package_name=diagnostics_package_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,13 +437,9 @@ def get( deserialized = self._deserialize("DiagnosticsPackage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" - } + return deserialized # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -464,7 +448,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements diagnostics_package_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -478,22 +462,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, diagnostics_package_name=diagnostics_package_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -504,11 +487,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -527,14 +506,6 @@ def begin_delete( :type packet_core_control_plane_name: str :param diagnostics_package_name: The name of the diagnostics package. Required. :type diagnostics_package_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -562,7 +533,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -573,17 +544,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_by_packet_core_control_plane( @@ -596,7 +563,6 @@ def list_by_packet_core_control_plane( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DiagnosticsPackage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.DiagnosticsPackage] :raises ~azure.core.exceptions.HttpResponseError: @@ -607,7 +573,7 @@ def list_by_packet_core_control_plane( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticsPackageListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -618,17 +584,16 @@ def list_by_packet_core_control_plane( def prepare_request(next_link=None): if not next_link: - request = build_list_by_packet_core_control_plane_request( + _request = build_list_by_packet_core_control_plane_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_packet_core_control_plane.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -640,13 +605,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("DiagnosticsPackageListResult", pipeline_response) @@ -656,11 +621,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -672,7 +637,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_packet_core_control_plane.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_extended_ue_information_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_extended_ue_information_operations.py index 3b6d7b718580..b6beee4ca4e8 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_extended_ue_information_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_extended_ue_information_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,12 +111,11 @@ def get( :type packet_core_control_plane_name: str :param ue_id: IMSI of a UE. Required. :type ue_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ExtendedUeInfo or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.ExtendedUeInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -125,22 +129,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ExtendedUeInfo] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, ue_id=ue_id, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,10 +156,6 @@ def get( deserialized = self._deserialize("ExtendedUeInfo", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/ues/{ueId}/extendedInformation/default" - } + return deserialized # type: ignore diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_mobile_networks_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_mobile_networks_operations.py index d3adad20abc2..bc0816bf24eb 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_mobile_networks_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_mobile_networks_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +85,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +120,7 @@ def build_create_or_update_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -153,7 +158,7 @@ def build_update_tags_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -189,7 +194,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -215,7 +220,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -241,6 +246,41 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_list_sim_groups_request( + resource_group_name: str, mobile_network_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", "2024-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/listSimGroups", + ) # 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"), + "mobileNetworkName": _SERIALIZER.url( + "mobile_network_name", mobile_network_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _url.format(**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 MobileNetworksOperations: """ .. warning:: @@ -263,7 +303,7 @@ def __init__(self, *args, **kwargs): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,21 +317,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,11 +341,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, mobile_network_name: str, **kwargs: Any) -> LROPoller[None]: @@ -317,14 +352,6 @@ def begin_delete(self, resource_group_name: str, mobile_network_name: str, **kwa :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -351,7 +378,7 @@ def begin_delete(self, resource_group_name: str, mobile_network_name: str, **kwa def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -362,17 +389,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, mobile_network_name: str, **kwargs: Any) -> _models.MobileNetwork: @@ -383,12 +406,11 @@ def get(self, resource_group_name: str, mobile_network_name: str, **kwargs: Any) :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: MobileNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.MobileNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -402,21 +424,20 @@ def get(self, resource_group_name: str, mobile_network_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MobileNetwork] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -429,22 +450,18 @@ def get(self, resource_group_name: str, mobile_network_name: str, **kwargs: Any) deserialized = self._deserialize("MobileNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, mobile_network_name: str, - parameters: Union[_models.MobileNetwork, IO], + parameters: Union[_models.MobileNetwork, IO[bytes]], **kwargs: Any ) -> _models.MobileNetwork: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -467,7 +484,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "MobileNetwork") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, @@ -475,16 +492,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,10 +521,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}" - } - @overload def begin_create_or_update( self, @@ -532,14 +544,6 @@ def begin_create_or_update( :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 - :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 MobileNetwork or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.MobileNetwork] @@ -551,7 +555,7 @@ def begin_create_or_update( self, resource_group_name: str, mobile_network_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -565,18 +569,10 @@ def begin_create_or_update( :type mobile_network_name: str :param parameters: Parameters supplied to the create or update mobile network operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 MobileNetwork or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.MobileNetwork] @@ -588,7 +584,7 @@ def begin_create_or_update( self, resource_group_name: str, mobile_network_name: str, - parameters: Union[_models.MobileNetwork, IO], + parameters: Union[_models.MobileNetwork, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.MobileNetwork]: """Creates or updates a mobile network. @@ -599,19 +595,8 @@ def begin_create_or_update( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param parameters: Parameters supplied to the create or update mobile network operation. Is - either a MobileNetwork type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.MobileNetwork 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 - :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. + either a MobileNetwork type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.MobileNetwork or IO[bytes] :return: An instance of LROPoller that returns either MobileNetwork or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.MobileNetwork] @@ -643,7 +628,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("MobileNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -655,17 +640,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.MobileNetwork].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}" - } + return LROPoller[_models.MobileNetwork]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update_tags( @@ -689,7 +672,6 @@ def update_tags( :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: MobileNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.MobileNetwork :raises ~azure.core.exceptions.HttpResponseError: @@ -700,7 +682,7 @@ def update_tags( self, resource_group_name: str, mobile_network_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -713,11 +695,10 @@ def update_tags( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param parameters: Parameters supplied to update mobile network tags and/or identity. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: MobileNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.MobileNetwork :raises ~azure.core.exceptions.HttpResponseError: @@ -728,7 +709,7 @@ def update_tags( self, resource_group_name: str, mobile_network_name: str, - parameters: Union[_models.IdentityAndTagsObject, IO], + parameters: Union[_models.IdentityAndTagsObject, IO[bytes]], **kwargs: Any ) -> _models.MobileNetwork: """Updates mobile network tags and managed identity. @@ -739,17 +720,13 @@ def update_tags( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param parameters: Parameters supplied to update mobile network tags and/or identity. Is either - a IdentityAndTagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject 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 + a IdentityAndTagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject or IO[bytes] :return: MobileNetwork or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.MobileNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -772,7 +749,7 @@ def update_tags( else: _json = self._serialize.body(parameters, "IdentityAndTagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, @@ -780,16 +757,15 @@ def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -802,19 +778,14 @@ def update_tags( deserialized = self._deserialize("MobileNetwork", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}" - } + return deserialized # type: ignore @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.MobileNetwork"]: """Lists all the mobile networks in a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MobileNetwork or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.MobileNetwork] :raises ~azure.core.exceptions.HttpResponseError: @@ -825,7 +796,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.MobileNetwork api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MobileNetworkListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -836,15 +807,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.MobileNetwork def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -856,13 +826,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("MobileNetworkListResult", pipeline_response) @@ -872,11 +842,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -889,10 +859,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/mobileNetworks" - } - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.MobileNetwork"]: """Lists all the mobile networks in a resource group. @@ -900,7 +866,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :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 MobileNetwork or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.MobileNetwork] :raises ~azure.core.exceptions.HttpResponseError: @@ -911,7 +876,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MobileNetworkListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -922,16 +887,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -943,13 +907,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("MobileNetworkListResult", pipeline_response) @@ -959,11 +923,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -976,6 +940,88 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks" - } + @distributed_trace + def list_sim_groups( + self, resource_group_name: str, mobile_network_name: str, **kwargs: Any + ) -> Iterable["_models.SimGroup"]: + """Gets all the SIM groups assigned to a mobile network. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param mobile_network_name: The name of the mobile network. Required. + :type mobile_network_name: str + :return: An iterator like instance of either SimGroup or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.SimGroup] + :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._config.api_version)) + cls: ClsType[_models.SimGroupListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_sim_groups_request( + resource_group_name=resource_group_name, + mobile_network_name=mobile_network_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("SimGroupListResult", 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) diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_operations.py index ffe11523c864..865ec5baea4d 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(**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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +83,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Gets a list of the operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -89,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,14 +104,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( 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) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +122,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("OperationList", pipeline_response) @@ -135,11 +138,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +154,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.MobileNetwork/operations"} diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_captures_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_captures_operations.py index a32cd50921f0..86842a9ba995 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_captures_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_captures_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +54,7 @@ def build_create_or_update_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -98,7 +103,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +149,7 @@ def build_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +195,7 @@ def build_stop_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -226,13 +231,13 @@ def build_stop_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_packet_core_control_plane_request( +def build_list_by_packet_core_control_plane_request( # pylint: disable=name-too-long resource_group_name: str, packet_core_control_plane_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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -289,10 +294,10 @@ def _create_or_update_initial( resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, - parameters: Union[_models.PacketCapture, IO], + parameters: Union[_models.PacketCapture, IO[bytes]], **kwargs: Any ) -> _models.PacketCapture: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -315,7 +320,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "PacketCapture") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_capture_name=packet_capture_name, @@ -324,16 +329,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -354,10 +358,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" - } - @overload def begin_create_or_update( self, @@ -384,14 +384,6 @@ def begin_create_or_update( :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 - :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 PacketCapture or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.PacketCapture] @@ -404,7 +396,7 @@ def begin_create_or_update( resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -420,18 +412,10 @@ def begin_create_or_update( :type packet_capture_name: str :param parameters: Parameters supplied to the create or update packet capture operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 PacketCapture or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.PacketCapture] @@ -444,7 +428,7 @@ def begin_create_or_update( resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, - parameters: Union[_models.PacketCapture, IO], + parameters: Union[_models.PacketCapture, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PacketCapture]: """Creates or updates a packet capture. @@ -457,19 +441,8 @@ def begin_create_or_update( :param packet_capture_name: The name of the packet capture session. Required. :type packet_capture_name: str :param parameters: Parameters supplied to the create or update packet capture operation. Is - either a PacketCapture type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCapture 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 - :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. + either a PacketCapture type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCapture or IO[bytes] :return: An instance of LROPoller that returns either PacketCapture or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.PacketCapture] @@ -502,7 +475,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PacketCapture", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -514,17 +487,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PacketCapture].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" - } + return LROPoller[_models.PacketCapture]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def get( @@ -539,12 +510,11 @@ def get( :type packet_core_control_plane_name: str :param packet_capture_name: The name of the packet capture session. Required. :type packet_capture_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PacketCapture or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCapture :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -558,22 +528,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCapture] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_capture_name=packet_capture_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -586,18 +555,14 @@ def get( deserialized = self._deserialize("PacketCapture", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" - } + return deserialized # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -611,22 +576,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_capture_name=packet_capture_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -637,11 +601,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -656,14 +616,6 @@ def begin_delete( :type packet_core_control_plane_name: str :param packet_capture_name: The name of the packet capture session. Required. :type packet_capture_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -691,7 +643,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -702,22 +654,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _stop_initial( self, resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -731,22 +679,21 @@ def _stop_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.AsyncOperationStatus]] = kwargs.pop("cls", None) - request = build_stop_request( + _request = build_stop_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_capture_name=packet_capture_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -761,13 +708,9 @@ def _stop_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}/stop" - } + return deserialized # type: ignore @distributed_trace def begin_stop( @@ -782,14 +725,6 @@ def begin_stop( :type packet_core_control_plane_name: str :param packet_capture_name: The name of the packet capture session. Required. :type packet_capture_name: 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 AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -819,7 +754,7 @@ def begin_stop( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -831,17 +766,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.AsyncOperationStatus].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_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}/stop" - } + return LROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_packet_core_control_plane( @@ -854,7 +787,6 @@ def list_by_packet_core_control_plane( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PacketCapture or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.PacketCapture] :raises ~azure.core.exceptions.HttpResponseError: @@ -865,7 +797,7 @@ def list_by_packet_core_control_plane( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCaptureListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -876,17 +808,16 @@ def list_by_packet_core_control_plane( def prepare_request(next_link=None): if not next_link: - request = build_list_by_packet_core_control_plane_request( + _request = build_list_by_packet_core_control_plane_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_packet_core_control_plane.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -898,13 +829,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PacketCaptureListResult", pipeline_response) @@ -914,11 +845,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -930,7 +861,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_packet_core_control_plane.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_control_plane_versions_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_control_plane_versions_operations.py index d629fb1c1e25..b2e3edacd50a 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_control_plane_versions_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_control_plane_versions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_get_request(version_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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +69,7 @@ def build_list_request(**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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +88,7 @@ def build_get_by_subscription_request(version_name: str, subscription_id: str, * _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +116,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,12 +164,11 @@ def get(self, version_name: str, **kwargs: Any) -> _models.PacketCoreControlPlan :param version_name: The name of the packet core control plane version. Required. :type version_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PacketCoreControlPlaneVersion or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -178,19 +182,18 @@ def get(self, version_name: str, **kwargs: Any) -> _models.PacketCoreControlPlan api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlaneVersion] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( version_name=version_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -203,17 +206,14 @@ def get(self, version_name: str, **kwargs: Any) -> _models.PacketCoreControlPlan deserialized = self._deserialize("PacketCoreControlPlaneVersion", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = {"url": "/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName}"} + return deserialized # type: ignore @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.PacketCoreControlPlaneVersion"]: """Lists all supported packet core control planes versions. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PacketCoreControlPlaneVersion or the result of cls(response) :rtype: @@ -226,7 +226,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.PacketCoreControlPlaneVersion api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlaneVersionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -237,14 +237,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.PacketCoreControlPlaneVersion def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( 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) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -256,13 +255,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PacketCoreControlPlaneVersionListResult", pipeline_response) @@ -272,11 +271,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -289,20 +288,17 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions"} - @distributed_trace def get_by_subscription(self, version_name: str, **kwargs: Any) -> _models.PacketCoreControlPlaneVersion: """Gets information about the specified packet core control plane version. :param version_name: The name of the packet core control plane version. Required. :type version_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PacketCoreControlPlaneVersion or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -316,20 +312,19 @@ def get_by_subscription(self, version_name: str, **kwargs: Any) -> _models.Packe api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlaneVersion] = kwargs.pop("cls", None) - request = build_get_by_subscription_request( + _request = build_get_by_subscription_request( version_name=version_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -342,19 +337,14 @@ def get_by_subscription(self, version_name: str, **kwargs: Any) -> _models.Packe deserialized = self._deserialize("PacketCoreControlPlaneVersion", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName}" - } + return deserialized # type: ignore @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PacketCoreControlPlaneVersion"]: """Lists all supported packet core control planes versions. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PacketCoreControlPlaneVersion or the result of cls(response) :rtype: @@ -367,7 +357,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PacketCoreCon api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlaneVersionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,15 +368,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PacketCoreCon def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -398,13 +387,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PacketCoreControlPlaneVersionListResult", pipeline_response) @@ -414,11 +403,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,7 +419,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_control_planes_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_control_planes_operations.py index 26bc958bf1f7..11bd6cb94d4f 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_control_planes_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_control_planes_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +89,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +128,7 @@ def build_create_or_update_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -165,7 +170,7 @@ def build_update_tags_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -205,7 +210,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +236,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -263,7 +268,7 @@ def build_rollback_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +307,7 @@ def build_reinstall_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -335,13 +340,13 @@ def build_reinstall_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_collect_diagnostics_package_request( +def build_collect_diagnostics_package_request( # pylint: disable=name-too-long resource_group_name: str, packet_core_control_plane_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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -399,7 +404,7 @@ def __init__(self, *args, **kwargs): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,21 +418,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -438,11 +442,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -455,14 +455,6 @@ def begin_delete( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -489,7 +481,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -500,17 +492,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -523,12 +511,11 @@ def get( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PacketCoreControlPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,21 +529,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlane] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -569,22 +555,18 @@ def get( deserialized = self._deserialize("PacketCoreControlPlane", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: Union[_models.PacketCoreControlPlane, IO], + parameters: Union[_models.PacketCoreControlPlane, IO[bytes]], **kwargs: Any ) -> _models.PacketCoreControlPlane: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -607,7 +589,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "PacketCoreControlPlane") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, @@ -615,16 +597,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -645,10 +626,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}" - } - @overload def begin_create_or_update( self, @@ -672,14 +649,6 @@ def begin_create_or_update( :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 - :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 PacketCoreControlPlane or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane] @@ -691,7 +660,7 @@ def begin_create_or_update( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -705,18 +674,10 @@ def begin_create_or_update( :type packet_core_control_plane_name: str :param parameters: Parameters supplied to the create or update packet core control plane operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 PacketCoreControlPlane or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane] @@ -728,7 +689,7 @@ def begin_create_or_update( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: Union[_models.PacketCoreControlPlane, IO], + parameters: Union[_models.PacketCoreControlPlane, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PacketCoreControlPlane]: """Creates or updates a packet core control plane. @@ -739,19 +700,8 @@ def begin_create_or_update( :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str :param parameters: Parameters supplied to the create or update packet core control plane - operation. Is either a PacketCoreControlPlane type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane 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 - :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. + operation. Is either a PacketCoreControlPlane type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane or IO[bytes] :return: An instance of LROPoller that returns either PacketCoreControlPlane or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane] @@ -783,7 +733,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PacketCoreControlPlane", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -795,17 +745,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PacketCoreControlPlane].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}" - } + return LROPoller[_models.PacketCoreControlPlane]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update_tags( @@ -829,7 +777,6 @@ def update_tags( :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: PacketCoreControlPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane :raises ~azure.core.exceptions.HttpResponseError: @@ -840,7 +787,7 @@ def update_tags( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -853,11 +800,10 @@ def update_tags( :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str :param parameters: Parameters supplied to patch packet core control plane resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: PacketCoreControlPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane :raises ~azure.core.exceptions.HttpResponseError: @@ -868,7 +814,7 @@ def update_tags( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: Union[_models.IdentityAndTagsObject, IO], + parameters: Union[_models.IdentityAndTagsObject, IO[bytes]], **kwargs: Any ) -> _models.PacketCoreControlPlane: """Patch packet core control plane resource. @@ -879,17 +825,13 @@ def update_tags( :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str :param parameters: Parameters supplied to patch packet core control plane resource. Is either a - IdentityAndTagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject 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 + IdentityAndTagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject or IO[bytes] :return: PacketCoreControlPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -912,7 +854,7 @@ def update_tags( else: _json = self._serialize.body(parameters, "IdentityAndTagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, @@ -920,16 +862,15 @@ def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -942,19 +883,14 @@ def update_tags( deserialized = self._deserialize("PacketCoreControlPlane", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}" - } + return deserialized # type: ignore @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PacketCoreControlPlane"]: """Lists all the packet core control planes in a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PacketCoreControlPlane or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane] @@ -966,7 +902,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PacketCoreCon api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlaneListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -977,15 +913,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PacketCoreCon def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -997,13 +932,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PacketCoreControlPlaneListResult", pipeline_response) @@ -1013,11 +948,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1030,10 +965,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes" - } - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any @@ -1043,7 +974,6 @@ def list_by_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 PacketCoreControlPlane or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane] @@ -1055,7 +985,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreControlPlaneListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1066,16 +996,15 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1087,13 +1016,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PacketCoreControlPlaneListResult", pipeline_response) @@ -1103,11 +1032,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1120,14 +1049,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes" - } - def _rollback_initial( self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1141,21 +1066,20 @@ def _rollback_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.AsyncOperationStatus]] = kwargs.pop("cls", None) - request = build_rollback_request( + _request = build_rollback_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._rollback_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1170,13 +1094,9 @@ def _rollback_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _rollback_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" - } + return deserialized # type: ignore @distributed_trace def begin_rollback( @@ -1190,14 +1110,6 @@ def begin_rollback( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: 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 AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -1226,7 +1138,7 @@ def begin_rollback( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1238,22 +1150,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.AsyncOperationStatus].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_rollback.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" - } + return LROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _reinstall_initial( self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1267,21 +1177,20 @@ def _reinstall_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.AsyncOperationStatus]] = kwargs.pop("cls", None) - request = build_reinstall_request( + _request = build_reinstall_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._reinstall_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1296,13 +1205,9 @@ def _reinstall_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _reinstall_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" - } + return deserialized # type: ignore @distributed_trace def begin_reinstall( @@ -1317,14 +1222,6 @@ def begin_reinstall( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: 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 AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -1353,7 +1250,7 @@ def begin_reinstall( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1365,26 +1262,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.AsyncOperationStatus].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_reinstall.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" - } + return LROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _collect_diagnostics_package_initial( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO], + parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO[bytes]], **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1407,7 +1302,7 @@ def _collect_diagnostics_package_initial( else: _json = self._serialize.body(parameters, "PacketCoreControlPlaneCollectDiagnosticsPackage") - request = build_collect_diagnostics_package_request( + _request = build_collect_diagnostics_package_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, @@ -1415,16 +1310,15 @@ def _collect_diagnostics_package_initial( content_type=content_type, json=_json, content=_content, - template_url=self._collect_diagnostics_package_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1439,13 +1333,9 @@ def _collect_diagnostics_package_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _collect_diagnostics_package_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" - } + return deserialized # type: ignore @overload def begin_collect_diagnostics_package( @@ -1472,14 +1362,6 @@ def begin_collect_diagnostics_package( :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -1491,7 +1373,7 @@ def begin_collect_diagnostics_package( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1506,18 +1388,10 @@ def begin_collect_diagnostics_package( :type packet_core_control_plane_name: str :param parameters: Parameters supplied to the packet core control plane collect diagnostics package operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -1529,7 +1403,7 @@ def begin_collect_diagnostics_package( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO], + parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.AsyncOperationStatus]: """Collect a diagnostics package for the specified packet core control plane. This action will @@ -1541,21 +1415,10 @@ def begin_collect_diagnostics_package( :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str :param parameters: Parameters supplied to the packet core control plane collect diagnostics - package operation. Is either a PacketCoreControlPlaneCollectDiagnosticsPackage type or a IO - type. Required. + package operation. Is either a PacketCoreControlPlaneCollectDiagnosticsPackage type or a + IO[bytes] type. Required. :type parameters: - ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneCollectDiagnosticsPackage 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 - :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. + ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneCollectDiagnosticsPackage or IO[bytes] :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -1587,7 +1450,7 @@ def begin_collect_diagnostics_package( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1599,14 +1462,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.AsyncOperationStatus].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_collect_diagnostics_package.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" - } + return LROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_data_planes_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_data_planes_operations.py index 95639b21e6b7..4fd09b78d50d 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_data_planes_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_data_planes_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +54,7 @@ def build_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +104,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +154,7 @@ def build_create_or_update_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -202,7 +207,7 @@ def build_update_tags_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -245,13 +250,13 @@ def build_update_tags_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_packet_core_control_plane_request( +def build_list_by_packet_core_control_plane_request( # pylint: disable=name-too-long resource_group_name: str, packet_core_control_plane_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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +315,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements packet_core_data_plane_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -324,22 +329,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -350,11 +354,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -373,14 +373,6 @@ def begin_delete( :type packet_core_control_plane_name: str :param packet_core_data_plane_name: The name of the packet core data plane. Required. :type packet_core_data_plane_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -408,7 +400,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -419,17 +411,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -448,12 +436,11 @@ def get( :type packet_core_control_plane_name: str :param packet_core_data_plane_name: The name of the packet core data plane. Required. :type packet_core_data_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PacketCoreDataPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -467,22 +454,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreDataPlane] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -495,23 +481,19 @@ def get( deserialized = self._deserialize("PacketCoreDataPlane", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, packet_core_control_plane_name: str, packet_core_data_plane_name: str, - parameters: Union[_models.PacketCoreDataPlane, IO], + parameters: Union[_models.PacketCoreDataPlane, IO[bytes]], **kwargs: Any ) -> _models.PacketCoreDataPlane: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -534,7 +516,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "PacketCoreDataPlane") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, @@ -543,16 +525,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,10 +554,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}" - } - @overload def begin_create_or_update( self, @@ -604,14 +581,6 @@ def begin_create_or_update( :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 - :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 PacketCoreDataPlane or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane] @@ -624,7 +593,7 @@ def begin_create_or_update( resource_group_name: str, packet_core_control_plane_name: str, packet_core_data_plane_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -641,18 +610,10 @@ def begin_create_or_update( :type packet_core_data_plane_name: str :param parameters: Parameters supplied to the create or update packet core data plane operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 PacketCoreDataPlane or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane] @@ -665,7 +626,7 @@ def begin_create_or_update( resource_group_name: str, packet_core_control_plane_name: str, packet_core_data_plane_name: str, - parameters: Union[_models.PacketCoreDataPlane, IO], + parameters: Union[_models.PacketCoreDataPlane, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PacketCoreDataPlane]: """Creates or updates a packet core data plane. Must be created in the same location as its parent @@ -679,19 +640,8 @@ def begin_create_or_update( :param packet_core_data_plane_name: The name of the packet core data plane. Required. :type packet_core_data_plane_name: str :param parameters: Parameters supplied to the create or update packet core data plane - operation. Is either a PacketCoreDataPlane type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane 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 - :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. + operation. Is either a PacketCoreDataPlane type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane or IO[bytes] :return: An instance of LROPoller that returns either PacketCoreDataPlane or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane] @@ -724,7 +674,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PacketCoreDataPlane", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -736,17 +686,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PacketCoreDataPlane].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}" - } + return LROPoller[_models.PacketCoreDataPlane]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update_tags( @@ -773,7 +721,6 @@ def update_tags( :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: PacketCoreDataPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane :raises ~azure.core.exceptions.HttpResponseError: @@ -785,7 +732,7 @@ def update_tags( resource_group_name: str, packet_core_control_plane_name: str, packet_core_data_plane_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -800,11 +747,10 @@ def update_tags( :param packet_core_data_plane_name: The name of the packet core data plane. Required. :type packet_core_data_plane_name: str :param parameters: Parameters supplied to update packet core data plane tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: PacketCoreDataPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane :raises ~azure.core.exceptions.HttpResponseError: @@ -816,7 +762,7 @@ def update_tags( resource_group_name: str, packet_core_control_plane_name: str, packet_core_data_plane_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.PacketCoreDataPlane: """Updates packet core data planes tags. @@ -829,17 +775,13 @@ def update_tags( :param packet_core_data_plane_name: The name of the packet core data plane. Required. :type packet_core_data_plane_name: str :param parameters: Parameters supplied to update packet core data plane tags. Is either a - TagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + TagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: PacketCoreDataPlane or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -862,7 +804,7 @@ def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, packet_core_data_plane_name=packet_core_data_plane_name, @@ -871,16 +813,15 @@ def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -893,13 +834,9 @@ def update_tags( deserialized = self._deserialize("PacketCoreDataPlane", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}" - } + return deserialized # type: ignore @distributed_trace def list_by_packet_core_control_plane( @@ -912,7 +849,6 @@ def list_by_packet_core_control_plane( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PacketCoreDataPlane or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane] :raises ~azure.core.exceptions.HttpResponseError: @@ -923,7 +859,7 @@ def list_by_packet_core_control_plane( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PacketCoreDataPlaneListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -934,17 +870,16 @@ def list_by_packet_core_control_plane( def prepare_request(next_link=None): if not next_link: - request = build_list_by_packet_core_control_plane_request( + _request = build_list_by_packet_core_control_plane_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_packet_core_control_plane.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -956,13 +891,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("PacketCoreDataPlaneListResult", pipeline_response) @@ -972,11 +907,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -988,7 +923,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_packet_core_control_plane.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_routing_info_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_routing_info_operations.py new file mode 100644 index 000000000000..3a541e430d7c --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_routing_info_operations.py @@ -0,0 +1,284 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, 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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, packet_core_control_plane_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", "2024-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/routingInfo", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "packetCoreControlPlaneName": _SERIALIZER.url( + "packet_core_control_plane_name", + packet_core_control_plane_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**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_request( + resource_group_name: str, packet_core_control_plane_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", "2024-04-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/routingInfo/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "packetCoreControlPlaneName": _SERIALIZER.url( + "packet_core_control_plane_name", + packet_core_control_plane_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**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 RoutingInfoOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.mobilenetwork.MobileNetworkManagementClient`'s + :attr:`routing_info` 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") + + @distributed_trace + def list( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> Iterable["_models.RoutingInfoModel"]: + """List all of the routing information for the packet core. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param packet_core_control_plane_name: The name of the packet core control plane. Required. + :type packet_core_control_plane_name: str + :return: An iterator like instance of either RoutingInfoModel or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.RoutingInfoModel] + :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._config.api_version)) + cls: ClsType[_models.RoutingInfoListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("RoutingInfoListResult", 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) + + @distributed_trace + def get( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> _models.RoutingInfoModel: + """Get the routing information for the packet core. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param packet_core_control_plane_name: The name of the packet core control plane. Required. + :type packet_core_control_plane_name: str + :return: RoutingInfoModel or the result of cls(response) + :rtype: ~azure.mgmt.mobilenetwork.models.RoutingInfoModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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._config.api_version)) + cls: ClsType[_models.RoutingInfoModel] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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("RoutingInfoModel", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_services_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_services_operations.py index cd021ea0c084..3a58c76ff520 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_services_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_services_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +92,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +134,7 @@ def build_create_or_update_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -174,7 +179,7 @@ def build_update_tags_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -219,7 +224,7 @@ def build_list_by_mobile_network_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +275,7 @@ def __init__(self, *args, **kwargs): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, service_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -284,22 +289,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, service_name=service_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -310,11 +314,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -328,16 +328,8 @@ def begin_delete( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -365,7 +357,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -376,17 +368,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -400,14 +388,13 @@ def get( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Service or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Service :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -421,22 +408,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Service] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, service_name=service_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,23 +435,19 @@ def get( deserialized = self._deserialize("Service", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, mobile_network_name: str, service_name: str, - parameters: Union[_models.Service, IO], + parameters: Union[_models.Service, IO[bytes]], **kwargs: Any ) -> _models.Service: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +470,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Service") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, service_name=service_name, @@ -497,16 +479,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -527,10 +508,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}" - } - @overload def begin_create_or_update( self, @@ -551,21 +528,13 @@ def begin_create_or_update( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to the create or update service operation. Required. :type parameters: ~azure.mgmt.mobilenetwork.models.Service :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 - :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 Service or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.Service] :raises ~azure.core.exceptions.HttpResponseError: @@ -577,7 +546,7 @@ def begin_create_or_update( resource_group_name: str, mobile_network_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -591,21 +560,13 @@ def begin_create_or_update( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to the create or update service operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 Service or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.Service] :raises ~azure.core.exceptions.HttpResponseError: @@ -617,7 +578,7 @@ def begin_create_or_update( resource_group_name: str, mobile_network_name: str, service_name: str, - parameters: Union[_models.Service, IO], + parameters: Union[_models.Service, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Service]: """Creates or updates a service. Must be created in the same location as its parent mobile @@ -629,22 +590,11 @@ def begin_create_or_update( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to the create or update service operation. Is either a - Service type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.Service 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 - :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. + Service type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.Service or IO[bytes] :return: An instance of LROPoller that returns either Service or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.Service] :raises ~azure.core.exceptions.HttpResponseError: @@ -676,7 +626,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Service", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -688,17 +638,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Service].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}" - } + return LROPoller[_models.Service]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update_tags( @@ -719,14 +667,13 @@ def update_tags( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to update service tags. Required. :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject :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: Service or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Service :raises ~azure.core.exceptions.HttpResponseError: @@ -738,7 +685,7 @@ def update_tags( resource_group_name: str, mobile_network_name: str, service_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -751,14 +698,13 @@ def update_tags( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to update service tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: Service or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Service :raises ~azure.core.exceptions.HttpResponseError: @@ -770,7 +716,7 @@ def update_tags( resource_group_name: str, mobile_network_name: str, service_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.Service: """Updates service tags. @@ -781,20 +727,16 @@ def update_tags( :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str :param service_name: The name of the service. You must not use any of the following reserved - strings - ``default``\ , ``requested`` or ``service``. Required. + strings - ``default``\\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to update service tags. Is either a TagsObject type or a - IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: Service or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Service :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -817,7 +759,7 @@ def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, service_name=service_name, @@ -826,16 +768,15 @@ def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -848,13 +789,9 @@ def update_tags( deserialized = self._deserialize("Service", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}" - } + return deserialized # type: ignore @distributed_trace def list_by_mobile_network( @@ -867,7 +804,6 @@ def list_by_mobile_network( :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Service or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.Service] :raises ~azure.core.exceptions.HttpResponseError: @@ -878,7 +814,7 @@ def list_by_mobile_network( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServiceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -889,17 +825,16 @@ def list_by_mobile_network( def prepare_request(next_link=None): if not next_link: - request = build_list_by_mobile_network_request( + _request = build_list_by_mobile_network_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_mobile_network.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -911,13 +846,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("ServiceListResult", pipeline_response) @@ -927,11 +862,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -943,7 +878,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_mobile_network.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sim_groups_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sim_groups_operations.py index 30137a4064fe..7d37359ef0a9 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sim_groups_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sim_groups_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +85,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +120,7 @@ def build_create_or_update_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -153,7 +158,7 @@ def build_update_tags_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -189,7 +194,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +218,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -261,7 +266,7 @@ def __init__(self, *args, **kwargs): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, sim_group_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,21 +280,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -300,11 +304,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, sim_group_name: str, **kwargs: Any) -> LROPoller[None]: @@ -315,14 +315,6 @@ def begin_delete(self, resource_group_name: str, sim_group_name: str, **kwargs: :type resource_group_name: str :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -349,7 +341,7 @@ def begin_delete(self, resource_group_name: str, sim_group_name: str, **kwargs: def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -360,17 +352,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, sim_group_name: str, **kwargs: Any) -> _models.SimGroup: @@ -381,12 +369,11 @@ def get(self, resource_group_name: str, sim_group_name: str, **kwargs: Any) -> _ :type resource_group_name: str :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SimGroup or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -400,21 +387,20 @@ def get(self, resource_group_name: str, sim_group_name: str, **kwargs: Any) -> _ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SimGroup] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -427,18 +413,18 @@ def get(self, resource_group_name: str, sim_group_name: str, **kwargs: Any) -> _ deserialized = self._deserialize("SimGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}" - } + return deserialized # type: ignore def _create_or_update_initial( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimGroup, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimGroup, IO[bytes]], + **kwargs: Any ) -> _models.SimGroup: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -461,7 +447,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "SimGroup") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, @@ -469,16 +455,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -499,10 +484,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}" - } - @overload def begin_create_or_update( self, @@ -525,14 +506,6 @@ def begin_create_or_update( :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 - :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 SimGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.SimGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -543,7 +516,7 @@ def begin_create_or_update( self, resource_group_name: str, sim_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -556,18 +529,10 @@ def begin_create_or_update( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the create or update SIM group operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 SimGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.SimGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -575,7 +540,11 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimGroup, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimGroup, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.SimGroup]: """Creates or updates a SIM group. @@ -585,19 +554,8 @@ def begin_create_or_update( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the create or update SIM group operation. Is either a - SimGroup type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimGroup 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 - :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. + SimGroup type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimGroup or IO[bytes] :return: An instance of LROPoller that returns either SimGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.SimGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -628,7 +586,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("SimGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -640,17 +598,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.SimGroup].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}" - } + return LROPoller[_models.SimGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update_tags( @@ -674,7 +630,6 @@ def update_tags( :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: SimGroup or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -685,7 +640,7 @@ def update_tags( self, resource_group_name: str, sim_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -698,11 +653,10 @@ def update_tags( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to patch SIM group resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: SimGroup or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimGroup :raises ~azure.core.exceptions.HttpResponseError: @@ -713,7 +667,7 @@ def update_tags( self, resource_group_name: str, sim_group_name: str, - parameters: Union[_models.IdentityAndTagsObject, IO], + parameters: Union[_models.IdentityAndTagsObject, IO[bytes]], **kwargs: Any ) -> _models.SimGroup: """Patch SIM group resource. @@ -724,17 +678,13 @@ def update_tags( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to patch SIM group resource. Is either a - IdentityAndTagsObject type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject 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 + IdentityAndTagsObject type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject or IO[bytes] :return: SimGroup or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -757,7 +707,7 @@ def update_tags( else: _json = self._serialize.body(parameters, "IdentityAndTagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, @@ -765,16 +715,15 @@ def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -787,19 +736,14 @@ def update_tags( deserialized = self._deserialize("SimGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}" - } + return deserialized # type: ignore @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SimGroup"]: """Gets all the SIM groups in a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SimGroup or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.SimGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -810,7 +754,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SimGroup"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SimGroupListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -821,15 +765,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SimGroup"]: def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -841,13 +784,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("SimGroupListResult", pipeline_response) @@ -857,11 +800,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -874,10 +817,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/simGroups" - } - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SimGroup"]: """Gets all the SIM groups in a resource group. @@ -885,7 +824,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :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 SimGroup or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.SimGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -896,7 +834,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SimGroupListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -907,16 +845,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -928,13 +865,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("SimGroupListResult", pipeline_response) @@ -944,11 +881,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -960,7 +897,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sim_policies_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sim_policies_operations.py index 322d98c3f910..ebe6a8f185f3 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sim_policies_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sim_policies_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +88,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +126,7 @@ def build_create_or_update_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -162,7 +167,7 @@ def build_update_tags_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -203,7 +208,7 @@ def build_list_by_mobile_network_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -254,7 +259,7 @@ def __init__(self, *args, **kwargs): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, sim_policy_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,22 +273,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, sim_policy_name=sim_policy_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -294,11 +298,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -313,14 +313,6 @@ def begin_delete( :type mobile_network_name: str :param sim_policy_name: The name of the SIM policy. Required. :type sim_policy_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -348,7 +340,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -359,17 +351,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -384,12 +372,11 @@ def get( :type mobile_network_name: str :param sim_policy_name: The name of the SIM policy. Required. :type sim_policy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SimPolicy or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -403,22 +390,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SimPolicy] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, sim_policy_name=sim_policy_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -431,23 +417,19 @@ def get( deserialized = self._deserialize("SimPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, mobile_network_name: str, sim_policy_name: str, - parameters: Union[_models.SimPolicy, IO], + parameters: Union[_models.SimPolicy, IO[bytes]], **kwargs: Any ) -> _models.SimPolicy: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +452,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "SimPolicy") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, sim_policy_name=sim_policy_name, @@ -479,16 +461,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,10 +490,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}" - } - @overload def begin_create_or_update( self, @@ -539,14 +516,6 @@ def begin_create_or_update( :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 - :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 SimPolicy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.SimPolicy] :raises ~azure.core.exceptions.HttpResponseError: @@ -558,7 +527,7 @@ def begin_create_or_update( resource_group_name: str, mobile_network_name: str, sim_policy_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -574,18 +543,10 @@ def begin_create_or_update( :param sim_policy_name: The name of the SIM policy. Required. :type sim_policy_name: str :param parameters: Parameters supplied to the create or update SIM policy operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 SimPolicy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.SimPolicy] :raises ~azure.core.exceptions.HttpResponseError: @@ -597,7 +558,7 @@ def begin_create_or_update( resource_group_name: str, mobile_network_name: str, sim_policy_name: str, - parameters: Union[_models.SimPolicy, IO], + parameters: Union[_models.SimPolicy, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.SimPolicy]: """Creates or updates a SIM policy. Must be created in the same location as its parent mobile @@ -611,19 +572,8 @@ def begin_create_or_update( :param sim_policy_name: The name of the SIM policy. Required. :type sim_policy_name: str :param parameters: Parameters supplied to the create or update SIM policy operation. Is either - a SimPolicy type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimPolicy 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 - :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. + a SimPolicy type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimPolicy or IO[bytes] :return: An instance of LROPoller that returns either SimPolicy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.SimPolicy] :raises ~azure.core.exceptions.HttpResponseError: @@ -655,7 +605,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("SimPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -667,17 +617,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.SimPolicy].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}" - } + return LROPoller[_models.SimPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update_tags( @@ -704,7 +652,6 @@ def update_tags( :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: SimPolicy or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimPolicy :raises ~azure.core.exceptions.HttpResponseError: @@ -716,7 +663,7 @@ def update_tags( resource_group_name: str, mobile_network_name: str, sim_policy_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -731,11 +678,10 @@ def update_tags( :param sim_policy_name: The name of the SIM policy. Required. :type sim_policy_name: str :param parameters: Parameters supplied to update SIM policy tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: SimPolicy or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimPolicy :raises ~azure.core.exceptions.HttpResponseError: @@ -747,7 +693,7 @@ def update_tags( resource_group_name: str, mobile_network_name: str, sim_policy_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.SimPolicy: """Updates SIM policy tags. @@ -760,17 +706,13 @@ def update_tags( :param sim_policy_name: The name of the SIM policy. Required. :type sim_policy_name: str :param parameters: Parameters supplied to update SIM policy tags. Is either a TagsObject type - or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: SimPolicy or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.SimPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -793,7 +735,7 @@ def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, sim_policy_name=sim_policy_name, @@ -802,16 +744,15 @@ def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -824,13 +765,9 @@ def update_tags( deserialized = self._deserialize("SimPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}" - } + return deserialized # type: ignore @distributed_trace def list_by_mobile_network( @@ -843,7 +780,6 @@ def list_by_mobile_network( :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SimPolicy or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.SimPolicy] :raises ~azure.core.exceptions.HttpResponseError: @@ -854,7 +790,7 @@ def list_by_mobile_network( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SimPolicyListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -865,17 +801,16 @@ def list_by_mobile_network( def prepare_request(next_link=None): if not next_link: - request = build_list_by_mobile_network_request( + _request = build_list_by_mobile_network_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_mobile_network.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -887,13 +822,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("SimPolicyListResult", pipeline_response) @@ -903,11 +838,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -919,7 +854,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_mobile_network.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sims_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sims_operations.py index 04d7897a55be..5fec858e31c5 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sims_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sims_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +86,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +122,7 @@ def build_create_or_update_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -156,7 +161,7 @@ def build_list_by_group_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -191,7 +196,7 @@ def build_bulk_upload_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -229,7 +234,7 @@ def build_bulk_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -267,7 +272,7 @@ def build_bulk_upload_encrypted_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -299,6 +304,82 @@ def build_bulk_upload_encrypted_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_move_request( + resource_group_name: str, sim_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", "2024-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", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/moveSims", + ) # 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"), + "simGroupName": _SERIALIZER.url( + "sim_group_name", sim_group_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _url.format(**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) + + +def build_clone_request( + resource_group_name: str, sim_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", "2024-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", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/cloneSims", + ) # 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"), + "simGroupName": _SERIALIZER.url( + "sim_group_name", sim_group_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _url.format(**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 SimsOperations: """ .. warning:: @@ -321,7 +402,7 @@ def __init__(self, *args, **kwargs): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, sim_group_name: str, sim_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,22 +416,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, sim_name=sim_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -361,11 +441,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -380,14 +456,6 @@ def begin_delete( :type sim_group_name: str :param sim_name: The name of the SIM. Required. :type sim_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -415,7 +483,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -426,17 +494,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, sim_group_name: str, sim_name: str, **kwargs: Any) -> _models.Sim: @@ -449,12 +513,11 @@ def get(self, resource_group_name: str, sim_group_name: str, sim_name: str, **kw :type sim_group_name: str :param sim_name: The name of the SIM. Required. :type sim_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Sim or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Sim :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -468,22 +531,21 @@ def get(self, resource_group_name: str, sim_group_name: str, sim_name: str, **kw api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Sim] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, sim_name=sim_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -496,23 +558,19 @@ def get(self, resource_group_name: str, sim_group_name: str, sim_name: str, **kw deserialized = self._deserialize("Sim", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, sim_group_name: str, sim_name: str, - parameters: Union[_models.Sim, IO], + parameters: Union[_models.Sim, IO[bytes]], **kwargs: Any ) -> _models.Sim: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -535,7 +593,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Sim") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, sim_name=sim_name, @@ -544,16 +602,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,10 +631,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}" - } - @overload def begin_create_or_update( self, @@ -603,14 +656,6 @@ def begin_create_or_update( :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 - :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 Sim or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.Sim] :raises ~azure.core.exceptions.HttpResponseError: @@ -622,7 +667,7 @@ def begin_create_or_update( resource_group_name: str, sim_group_name: str, sim_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -637,18 +682,10 @@ def begin_create_or_update( :param sim_name: The name of the SIM. Required. :type sim_name: str :param parameters: Parameters supplied to the create or update SIM operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 Sim or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.Sim] :raises ~azure.core.exceptions.HttpResponseError: @@ -660,7 +697,7 @@ def begin_create_or_update( resource_group_name: str, sim_group_name: str, sim_name: str, - parameters: Union[_models.Sim, IO], + parameters: Union[_models.Sim, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Sim]: """Creates or updates a SIM. @@ -673,19 +710,8 @@ def begin_create_or_update( :param sim_name: The name of the SIM. Required. :type sim_name: str :param parameters: Parameters supplied to the create or update SIM operation. Is either a Sim - type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.Sim 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 - :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. + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.Sim or IO[bytes] :return: An instance of LROPoller that returns either Sim or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.Sim] :raises ~azure.core.exceptions.HttpResponseError: @@ -717,7 +743,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Sim", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -729,17 +755,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Sim].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}" - } + return LROPoller[_models.Sim](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_by_group(self, resource_group_name: str, sim_group_name: str, **kwargs: Any) -> Iterable["_models.Sim"]: @@ -750,7 +772,6 @@ def list_by_group(self, resource_group_name: str, sim_group_name: str, **kwargs: :type resource_group_name: str :param sim_group_name: The name of the SIM Group. Required. :type sim_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 Sim or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.Sim] :raises ~azure.core.exceptions.HttpResponseError: @@ -761,7 +782,7 @@ def list_by_group(self, resource_group_name: str, sim_group_name: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SimListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -772,17 +793,16 @@ def list_by_group(self, resource_group_name: str, sim_group_name: str, **kwargs: def prepare_request(next_link=None): if not next_link: - request = build_list_by_group_request( + _request = build_list_by_group_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -794,13 +814,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("SimListResult", pipeline_response) @@ -810,11 +830,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -827,14 +847,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims" - } - def _bulk_upload_initial( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimUploadList, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimUploadList, IO[bytes]], + **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +877,7 @@ def _bulk_upload_initial( else: _json = self._serialize.body(parameters, "SimUploadList") - request = build_bulk_upload_request( + _request = build_bulk_upload_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, @@ -865,16 +885,15 @@ def _bulk_upload_initial( content_type=content_type, json=_json, content=_content, - template_url=self._bulk_upload_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -889,13 +908,9 @@ def _bulk_upload_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _bulk_upload_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" - } + return deserialized # type: ignore @overload def begin_bulk_upload( @@ -919,14 +934,6 @@ def begin_bulk_upload( :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -938,7 +945,7 @@ def begin_bulk_upload( self, resource_group_name: str, sim_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -951,18 +958,10 @@ def begin_bulk_upload( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the bulk SIM upload operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -971,7 +970,11 @@ def begin_bulk_upload( @distributed_trace def begin_bulk_upload( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimUploadList, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimUploadList, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.AsyncOperationStatus]: """Bulk upload SIMs to a SIM group. @@ -981,19 +984,8 @@ def begin_bulk_upload( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the bulk SIM upload operation. Is either a - SimUploadList type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimUploadList 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 - :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. + SimUploadList type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimUploadList or IO[bytes] :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -1025,7 +1017,7 @@ def begin_bulk_upload( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1037,22 +1029,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.AsyncOperationStatus].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_bulk_upload.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" - } + return LROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _bulk_delete_initial( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimDeleteList, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimDeleteList, IO[bytes]], + **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1075,7 +1069,7 @@ def _bulk_delete_initial( else: _json = self._serialize.body(parameters, "SimDeleteList") - request = build_bulk_delete_request( + _request = build_bulk_delete_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, @@ -1083,16 +1077,15 @@ def _bulk_delete_initial( content_type=content_type, json=_json, content=_content, - template_url=self._bulk_delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1107,13 +1100,9 @@ def _bulk_delete_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _bulk_delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" - } + return deserialized # type: ignore @overload def begin_bulk_delete( @@ -1137,14 +1126,6 @@ def begin_bulk_delete( :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -1156,7 +1137,7 @@ def begin_bulk_delete( self, resource_group_name: str, sim_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1169,18 +1150,10 @@ def begin_bulk_delete( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the bulk SIM delete operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -1189,7 +1162,11 @@ def begin_bulk_delete( @distributed_trace def begin_bulk_delete( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimDeleteList, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimDeleteList, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.AsyncOperationStatus]: """Bulk delete SIMs from a SIM group. @@ -1199,19 +1176,8 @@ def begin_bulk_delete( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the bulk SIM delete operation. Is either a - SimDeleteList type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimDeleteList 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 - :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. + SimDeleteList type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimDeleteList or IO[bytes] :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -1243,7 +1209,7 @@ def begin_bulk_delete( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1255,26 +1221,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.AsyncOperationStatus].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_bulk_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" - } + return LROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _bulk_upload_encrypted_initial( self, resource_group_name: str, sim_group_name: str, - parameters: Union[_models.EncryptedSimUploadList, IO], + parameters: Union[_models.EncryptedSimUploadList, IO[bytes]], **kwargs: Any ) -> Optional[_models.AsyncOperationStatus]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1297,7 +1261,7 @@ def _bulk_upload_encrypted_initial( else: _json = self._serialize.body(parameters, "EncryptedSimUploadList") - request = build_bulk_upload_encrypted_request( + _request = build_bulk_upload_encrypted_request( resource_group_name=resource_group_name, sim_group_name=sim_group_name, subscription_id=self._config.subscription_id, @@ -1305,16 +1269,15 @@ def _bulk_upload_encrypted_initial( content_type=content_type, json=_json, content=_content, - template_url=self._bulk_upload_encrypted_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1329,13 +1292,9 @@ def _bulk_upload_encrypted_initial( deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _bulk_upload_encrypted_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" - } + return deserialized # type: ignore @overload def begin_bulk_upload_encrypted( @@ -1359,14 +1318,6 @@ def begin_bulk_upload_encrypted( :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -1378,7 +1329,7 @@ def begin_bulk_upload_encrypted( self, resource_group_name: str, sim_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1391,18 +1342,10 @@ def begin_bulk_upload_encrypted( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the encrypted SIMs upload operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -1414,7 +1357,7 @@ def begin_bulk_upload_encrypted( self, resource_group_name: str, sim_group_name: str, - parameters: Union[_models.EncryptedSimUploadList, IO], + parameters: Union[_models.EncryptedSimUploadList, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.AsyncOperationStatus]: """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. @@ -1425,19 +1368,8 @@ def begin_bulk_upload_encrypted( :param sim_group_name: The name of the SIM Group. Required. :type sim_group_name: str :param parameters: Parameters supplied to the encrypted SIMs upload operation. Is either a - EncryptedSimUploadList type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.EncryptedSimUploadList 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 - :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. + EncryptedSimUploadList type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.EncryptedSimUploadList or IO[bytes] :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] @@ -1469,7 +1401,7 @@ def begin_bulk_upload_encrypted( def get_long_running_output(pipeline_response): deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1481,14 +1413,404 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.AsyncOperationStatus].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 + return LROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - begin_bulk_upload_encrypted.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" - } + def _move_initial( + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimMove, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AsyncOperationStatus]] = 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, "SimMove") + + _request = build_move_request( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + 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, 202]: + 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 + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_move( + self, + resource_group_name: str, + sim_group_name: str, + parameters: _models.SimMove, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Move SIMs to another SIM Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to move the SIMs. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimMove + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_move( + self, + resource_group_name: str, + sim_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Move SIMs to another SIM Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to move the SIMs. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_move( + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimMove, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Move SIMs to another SIM Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to move the SIMs. Is either a SimMove type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimMove or IO[bytes] + :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AsyncOperationStatus] = 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._move_initial( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.AsyncOperationStatus].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _clone_initial( + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimClone, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.AsyncOperationStatus]] = 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, "SimClone") + + _request = build_clone_request( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + 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, 202]: + 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 + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_clone( + self, + resource_group_name: str, + sim_group_name: str, + parameters: _models.SimClone, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Clone SIMs to another SIM Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to clone the SIMs. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimClone + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_clone( + self, + resource_group_name: str, + sim_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Clone SIMs to another SIM Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to clone the SIMs. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_clone( + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.SimClone, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Clone SIMs to another SIM Group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to clone the SIMs. Is either a SimClone type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimClone or IO[bytes] + :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AsyncOperationStatus] = 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._clone_initial( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.AsyncOperationStatus].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AsyncOperationStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sites_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sites_operations.py index cbd5f6d50503..37e34fa30213 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sites_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sites_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +88,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +126,7 @@ def build_create_or_update_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -162,7 +167,7 @@ def build_update_tags_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -203,7 +208,7 @@ def build_list_by_mobile_network_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,7 +243,7 @@ def build_delete_packet_core_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -295,7 +300,7 @@ def __init__(self, *args, **kwargs): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, site_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -309,22 +314,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, site_name=site_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,11 +339,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -355,14 +355,6 @@ def begin_delete( :type mobile_network_name: str :param site_name: The name of the mobile network site. Required. :type site_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -390,7 +382,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -401,17 +393,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, mobile_network_name: str, site_name: str, **kwargs: Any) -> _models.Site: @@ -424,12 +412,11 @@ def get(self, resource_group_name: str, mobile_network_name: str, site_name: str :type mobile_network_name: str :param site_name: The name of the mobile network site. Required. :type site_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Site or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Site :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -443,22 +430,21 @@ def get(self, resource_group_name: str, mobile_network_name: str, site_name: str api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Site] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, site_name=site_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -471,23 +457,19 @@ def get(self, resource_group_name: str, mobile_network_name: str, site_name: str deserialized = self._deserialize("Site", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: Union[_models.Site, IO], + parameters: Union[_models.Site, IO[bytes]], **kwargs: Any ) -> _models.Site: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +492,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Site") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, site_name=site_name, @@ -519,16 +501,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -549,10 +530,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}" - } - @overload def begin_create_or_update( self, @@ -580,14 +557,6 @@ def begin_create_or_update( :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 - :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 Site or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.Site] :raises ~azure.core.exceptions.HttpResponseError: @@ -599,7 +568,7 @@ def begin_create_or_update( resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -616,18 +585,10 @@ def begin_create_or_update( :type site_name: str :param parameters: Parameters supplied to the create or update mobile network site operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 Site or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.Site] :raises ~azure.core.exceptions.HttpResponseError: @@ -639,7 +600,7 @@ def begin_create_or_update( resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: Union[_models.Site, IO], + parameters: Union[_models.Site, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Site]: """Creates or updates a mobile network site. Must be created in the same location as its parent @@ -653,19 +614,8 @@ def begin_create_or_update( :param site_name: The name of the mobile network site. Required. :type site_name: str :param parameters: Parameters supplied to the create or update mobile network site operation. - Is either a Site type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.Site 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 - :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. + Is either a Site type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.Site or IO[bytes] :return: An instance of LROPoller that returns either Site or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.Site] :raises ~azure.core.exceptions.HttpResponseError: @@ -697,7 +647,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Site", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -709,17 +659,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Site].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}" - } + return LROPoller[_models.Site]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update_tags( @@ -746,7 +694,6 @@ def update_tags( :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: Site or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Site :raises ~azure.core.exceptions.HttpResponseError: @@ -758,7 +705,7 @@ def update_tags( resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -773,11 +720,10 @@ def update_tags( :param site_name: The name of the mobile network site. Required. :type site_name: str :param parameters: Parameters supplied to update network site tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: Site or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Site :raises ~azure.core.exceptions.HttpResponseError: @@ -789,7 +735,7 @@ def update_tags( resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.Site: """Updates site tags. @@ -802,17 +748,13 @@ def update_tags( :param site_name: The name of the mobile network site. Required. :type site_name: str :param parameters: Parameters supplied to update network site tags. Is either a TagsObject type - or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: Site or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Site :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -835,7 +777,7 @@ def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, site_name=site_name, @@ -844,16 +786,15 @@ def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -866,13 +807,9 @@ def update_tags( deserialized = self._deserialize("Site", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}" - } + return deserialized # type: ignore @distributed_trace def list_by_mobile_network( @@ -885,7 +822,6 @@ def list_by_mobile_network( :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Site or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.Site] :raises ~azure.core.exceptions.HttpResponseError: @@ -896,7 +832,7 @@ def list_by_mobile_network( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SiteListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -907,17 +843,16 @@ def list_by_mobile_network( def prepare_request(next_link=None): if not next_link: - request = build_list_by_mobile_network_request( + _request = build_list_by_mobile_network_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_mobile_network.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -929,13 +864,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("SiteListResult", pipeline_response) @@ -945,11 +880,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -962,19 +897,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_mobile_network.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites" - } - def _delete_packet_core_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: Union[_models.SiteDeletePacketCore, IO], + parameters: Union[_models.SiteDeletePacketCore, IO[bytes]], **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -997,7 +928,7 @@ def _delete_packet_core_initial( # pylint: disable=inconsistent-return-statemen else: _json = self._serialize.body(parameters, "SiteDeletePacketCore") - request = build_delete_packet_core_request( + _request = build_delete_packet_core_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, site_name=site_name, @@ -1006,16 +937,15 @@ def _delete_packet_core_initial( # pylint: disable=inconsistent-return-statemen content_type=content_type, json=_json, content=_content, - template_url=self._delete_packet_core_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1026,11 +956,7 @@ def _delete_packet_core_initial( # pylint: disable=inconsistent-return-statemen raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_packet_core_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}/deletePacketCore" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def begin_delete_packet_core( @@ -1057,14 +983,6 @@ def begin_delete_packet_core( :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 - :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1076,7 +994,7 @@ def begin_delete_packet_core( resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1091,18 +1009,10 @@ def begin_delete_packet_core( :param site_name: The name of the mobile network site. Required. :type site_name: str :param parameters: Parameters supplied to delete a packet core under a site. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1114,7 +1024,7 @@ def begin_delete_packet_core( resource_group_name: str, mobile_network_name: str, site_name: str, - parameters: Union[_models.SiteDeletePacketCore, IO], + parameters: Union[_models.SiteDeletePacketCore, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Deletes a packet core under the specified mobile network site. @@ -1127,19 +1037,8 @@ def begin_delete_packet_core( :param site_name: The name of the mobile network site. Required. :type site_name: str :param parameters: Parameters supplied to delete a packet core under a site. Is either a - SiteDeletePacketCore type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SiteDeletePacketCore 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 - :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. + SiteDeletePacketCore type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SiteDeletePacketCore or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1170,7 +1069,7 @@ def begin_delete_packet_core( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1181,14 +1080,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete_packet_core.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}/deletePacketCore" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_slices_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_slices_operations.py index e63eb38b97fd..e14beee2c3d5 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_slices_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_slices_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # 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 sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_delete_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +88,7 @@ def build_get_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +126,7 @@ def build_create_or_update_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -162,7 +167,7 @@ def build_update_tags_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -203,7 +208,7 @@ def build_list_by_mobile_network_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -254,7 +259,7 @@ def __init__(self, *args, **kwargs): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, mobile_network_name: str, slice_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,22 +273,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, slice_name=slice_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -294,11 +298,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -313,14 +313,6 @@ def begin_delete( :type mobile_network_name: str :param slice_name: The name of the network slice. Required. :type slice_name: 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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -348,7 +340,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -359,17 +351,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, mobile_network_name: str, slice_name: str, **kwargs: Any) -> _models.Slice: @@ -382,12 +370,11 @@ def get(self, resource_group_name: str, mobile_network_name: str, slice_name: st :type mobile_network_name: str :param slice_name: The name of the network slice. Required. :type slice_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Slice or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Slice :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -401,22 +388,21 @@ def get(self, resource_group_name: str, mobile_network_name: str, slice_name: st api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Slice] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, slice_name=slice_name, subscription_id=self._config.subscription_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) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -429,23 +415,19 @@ def get(self, resource_group_name: str, mobile_network_name: str, slice_name: st deserialized = self._deserialize("Slice", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, mobile_network_name: str, slice_name: str, - parameters: Union[_models.Slice, IO], + parameters: Union[_models.Slice, IO[bytes]], **kwargs: Any ) -> _models.Slice: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -468,7 +450,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "Slice") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, slice_name=slice_name, @@ -477,16 +459,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -507,10 +488,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}" - } - @overload def begin_create_or_update( self, @@ -538,14 +515,6 @@ def begin_create_or_update( :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 - :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 Slice or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.Slice] :raises ~azure.core.exceptions.HttpResponseError: @@ -557,7 +526,7 @@ def begin_create_or_update( resource_group_name: str, mobile_network_name: str, slice_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -574,18 +543,10 @@ def begin_create_or_update( :type slice_name: str :param parameters: Parameters supplied to the create or update network slice operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 - :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 Slice or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.Slice] :raises ~azure.core.exceptions.HttpResponseError: @@ -597,7 +558,7 @@ def begin_create_or_update( resource_group_name: str, mobile_network_name: str, slice_name: str, - parameters: Union[_models.Slice, IO], + parameters: Union[_models.Slice, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Slice]: """Creates or updates a network slice. Must be created in the same location as its parent mobile @@ -611,19 +572,8 @@ def begin_create_or_update( :param slice_name: The name of the network slice. Required. :type slice_name: str :param parameters: Parameters supplied to the create or update network slice operation. Is - either a Slice type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.Slice 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 - :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. + either a Slice type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.Slice or IO[bytes] :return: An instance of LROPoller that returns either Slice or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.Slice] :raises ~azure.core.exceptions.HttpResponseError: @@ -655,7 +605,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Slice", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -667,17 +617,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Slice].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_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}" - } + return LROPoller[_models.Slice]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update_tags( @@ -704,7 +652,6 @@ def update_tags( :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: Slice or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Slice :raises ~azure.core.exceptions.HttpResponseError: @@ -716,7 +663,7 @@ def update_tags( resource_group_name: str, mobile_network_name: str, slice_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -731,11 +678,10 @@ def update_tags( :param slice_name: The name of the network slice. Required. :type slice_name: str :param parameters: Parameters supplied to update network slice tags. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: Slice or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Slice :raises ~azure.core.exceptions.HttpResponseError: @@ -747,7 +693,7 @@ def update_tags( resource_group_name: str, mobile_network_name: str, slice_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.TagsObject, IO[bytes]], **kwargs: Any ) -> _models.Slice: """Updates slice tags. @@ -760,17 +706,13 @@ def update_tags( :param slice_name: The name of the network slice. Required. :type slice_name: str :param parameters: Parameters supplied to update network slice tags. Is either a TagsObject - type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject 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 + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO[bytes] :return: Slice or the result of cls(response) :rtype: ~azure.mgmt.mobilenetwork.models.Slice :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -793,7 +735,7 @@ def update_tags( else: _json = self._serialize.body(parameters, "TagsObject") - request = build_update_tags_request( + _request = build_update_tags_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, slice_name=slice_name, @@ -802,16 +744,15 @@ def update_tags( content_type=content_type, json=_json, content=_content, - template_url=self.update_tags.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -824,13 +765,9 @@ def update_tags( deserialized = self._deserialize("Slice", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update_tags.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}" - } + return deserialized # type: ignore @distributed_trace def list_by_mobile_network( @@ -843,7 +780,6 @@ def list_by_mobile_network( :type resource_group_name: str :param mobile_network_name: The name of the mobile network. Required. :type mobile_network_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Slice or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.Slice] :raises ~azure.core.exceptions.HttpResponseError: @@ -854,7 +790,7 @@ def list_by_mobile_network( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SliceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -865,17 +801,16 @@ def list_by_mobile_network( def prepare_request(next_link=None): if not next_link: - request = build_list_by_mobile_network_request( + _request = build_list_by_mobile_network_request( resource_group_name=resource_group_name, mobile_network_name=mobile_network_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_mobile_network.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -887,13 +822,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("SliceListResult", pipeline_response) @@ -903,11 +838,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -919,7 +854,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_mobile_network.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_ue_information_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_ue_information_operations.py index d5e09a1af272..1e772a336e80 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_ue_information_operations.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_ue_information_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # 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 sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_list_request( _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", "2024-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +110,6 @@ def list( :type resource_group_name: str :param packet_core_control_plane_name: The name of the packet core control plane. Required. :type packet_core_control_plane_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UeInfo or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.UeInfo] :raises ~azure.core.exceptions.HttpResponseError: @@ -116,7 +120,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UeInfoList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -127,17 +131,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, packet_core_control_plane_name=packet_core_control_plane_name, subscription_id=self._config.subscription_id, 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) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -149,13 +152,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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("UeInfoList", pipeline_response) @@ -165,11 +168,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,7 +184,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/ues" - } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_create.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_create.py index 1ca5acdf4412..087c534ab456 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -54,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/AttachedDataNetworkCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/AttachedDataNetworkCreate.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_delete.py index 7587020c6174..394b79ed569b 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/AttachedDataNetworkDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/AttachedDataNetworkDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_get.py index 2b5ff5bdfa15..3e5256c03bd7 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/AttachedDataNetworkGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/AttachedDataNetworkGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_list_by_packet_core_data_plane.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_list_by_packet_core_data_plane.py index 19b2e7e8be9a..ade3932a241a 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_list_by_packet_core_data_plane.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_list_by_packet_core_data_plane.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/AttachedDataNetworkListByPacketCoreDataPlane.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/AttachedDataNetworkListByPacketCoreDataPlane.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_update_tags.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_update_tags.py index 4fb76819ec0f..1090f8423ab1 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_update_tags.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/attached_data_network_update_tags.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -39,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/AttachedDataNetworkUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/AttachedDataNetworkUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_create.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_create.py index 555998fb0d44..08a9ea8b4bf6 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/DataNetworkCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/DataNetworkCreate.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_delete.py index fe20aa8ba605..b35f90c79d5f 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/DataNetworkDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/DataNetworkDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_get.py index 8b9e01d993a5..0259a9d6ecce 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/DataNetworkGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/DataNetworkGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_list_by_mobile_network.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_list_by_mobile_network.py index 3d743322fad6..d7ccab6b72f1 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_list_by_mobile_network.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_list_by_mobile_network.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/DataNetworkListByMobileNetwork.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/DataNetworkListByMobileNetwork.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_update_tags.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_update_tags.py index 4584044d1650..10954fefb6e9 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_update_tags.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/data_network_update_tags.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/DataNetworkUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/DataNetworkUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_create.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_create.py index 42531a02e6ab..838ad82b9df7 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_create.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/DiagnosticsPackageCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/DiagnosticsPackageCreate.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_delete.py index 5645fff0a12a..4354e4ae254a 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/DiagnosticsPackageDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/DiagnosticsPackageDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_get.py index bb8bc8a8f197..e5f8e68581f3 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/DiagnosticsPackageGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/DiagnosticsPackageGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_list_by_packet_core_control_plane.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_list_by_packet_core_control_plane.py index 58179e95b83d..c57f7e57befa 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_list_by_packet_core_control_plane.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_list_by_packet_core_control_plane.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/DiagnosticsPackageListByPacketCoreControlPlane.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/DiagnosticsPackageListByPacketCoreControlPlane.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/extended_ue_info4_gget.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/extended_ue_info4_gget.py index a4c8608901e5..59e4f683150e 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/extended_ue_info4_gget.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/extended_ue_info4_gget.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/ExtendedUeInfo4GGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/ExtendedUeInfo4GGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/extended_ue_info5_gget.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/extended_ue_info5_gget.py index a269b3b60cbe..4986a9bf5986 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/extended_ue_info5_gget.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/extended_ue_info5_gget.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/ExtendedUeInfo5GGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/ExtendedUeInfo5GGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_create.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_create.py index 0442bf7a29de..f4f3a142be18 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -60,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/MobileNetworkCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/MobileNetworkCreate.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_delete.py index e495215f4006..ecd4d886cef0 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/MobileNetworkDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/MobileNetworkDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_get.py index c0666cd7c661..17e8b69f52a5 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/MobileNetworkGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/MobileNetworkGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_list_by_resource_group.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_list_by_resource_group.py index a52cbfcfd2dc..21039c021eee 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_list_by_resource_group.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/MobileNetworkListByResourceGroup.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/MobileNetworkListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_list_by_subscription.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_list_by_subscription.py index fc0838121f17..61da57ee4791 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_list_by_subscription.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/MobileNetworkListBySubscription.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/MobileNetworkListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_update_tags.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_update_tags.py index 83ac1d6c7d6a..a3a8cadb3595 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_update_tags.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/mobile_network_update_tags.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/MobileNetworkUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/MobileNetworkUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/operation_list.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/operation_list.py index bb78683ef028..50bd1bbc6fed 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/operation_list.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/operation_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/OperationList.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/OperationList.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_create.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_create.py index 4c9188ff435e..eaf13e05b5ca 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -49,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCaptureCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCaptureCreate.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_delete.py index 743bcbfb9532..4ca1f589c69f 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCaptureDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCaptureDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_get.py index c8b9ff03cb57..da2d004a91c2 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCaptureGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCaptureGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_list_by_packet_core_control_plane.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_list_by_packet_core_control_plane.py index e5f7abae2420..53cdd54711d6 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_list_by_packet_core_control_plane.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_list_by_packet_core_control_plane.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCaptureListByPacketCoreControlPlane.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCaptureListByPacketCoreControlPlane.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_stop.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_stop.py index bbb0d68c73f9..fbc63106434a 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_stop.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_stop.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCaptureStop.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCaptureStop.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_collect_diagnostics_package.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_collect_diagnostics_package.py index 5b7d216d96b4..46d4bc1fe304 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_collect_diagnostics_package.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_collect_diagnostics_package.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -39,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreControlPlaneCollectDiagnosticsPackage.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreControlPlaneCollectDiagnosticsPackage.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_create.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_create.py index 4acb13eb7c26..e1f890dbea03 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -60,7 +63,10 @@ def main(): }, "type": "AKS-HCI", }, - "signaling": {"nasReroute": {"macroMmeGroupId": 1024}}, + "signaling": { + "nasEncryption": ["NEA2/EEA2", "NEA1/EEA1", "NEA0/EEA0"], + "nasReroute": {"macroMmeGroupId": 1024}, + }, "sites": [ { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/sites/testSite" @@ -75,6 +81,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreControlPlaneCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreControlPlaneCreate.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_delete.py index 868bb0317b2e..38768da7a6bb 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreControlPlaneDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreControlPlaneDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_get.py index 08d5ca43cbfd..8e421898c0cb 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreControlPlaneGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreControlPlaneGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_list_by_resource_group.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_list_by_resource_group.py index ba6733f61313..c34a37230b4b 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_list_by_resource_group.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreControlPlaneListByResourceGroup.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreControlPlaneListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_list_by_subscription.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_list_by_subscription.py index 8c90963ff4fe..f3b1bd9d22ea 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_list_by_subscription.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreControlPlaneListBySubscription.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreControlPlaneListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_patch.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_patch.py index 3de4a7eee2c4..8d68a27ea3a9 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_patch.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_patch.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -45,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreControlPlanePatch.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreControlPlanePatch.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_reinstall.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_reinstall.py index 110a4a90c67b..b28f9b4592d1 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_reinstall.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_reinstall.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreControlPlaneReinstall.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreControlPlaneReinstall.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_rollback.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_rollback.py index faa10eab1139..15fa86b6e0b4 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_rollback.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_rollback.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreControlPlaneRollback.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreControlPlaneRollback.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_get.py index 4f6be3b9ddbb..d759be1b6292 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -30,11 +31,11 @@ def main(): ) response = client.packet_core_control_plane_versions.get( - version_name="PMN-4-11-1", + version_name="2404.0-1", ) print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreControlPlaneVersionGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreControlPlaneVersionGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_get_by_subscription.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_get_by_subscription.py index ddcf07c5e174..a94485903734 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_get_by_subscription.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_get_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -30,11 +31,11 @@ def main(): ) response = client.packet_core_control_plane_versions.get_by_subscription( - version_name="PMN-4-11-1", + version_name="2404.0-1", ) print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreControlPlaneVersionGetBySubscription.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreControlPlaneVersionGetBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_list.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_list.py index 536bbb9ff59f..6516aa83a393 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_list.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreControlPlaneVersionList.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreControlPlaneVersionList.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_list_by_subscription.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_list_by_subscription.py index 1a3b55041a2a..163ab9601f5f 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_list_by_subscription.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreControlPlaneVersionListBySubscription.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreControlPlaneVersionListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_create.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_create.py index c28321eeefbb..03d60d8ea067 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreDataPlaneCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreDataPlaneCreate.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_delete.py index f9ecddf8bed7..108424355e34 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreDataPlaneDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreDataPlaneDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_get.py index 9f92a3e08663..6957689da560 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreDataPlaneGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreDataPlaneGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_list_by_packet_core_control_plane.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_list_by_packet_core_control_plane.py index 90e12fe1bebd..47d877650e46 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_list_by_packet_core_control_plane.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_list_by_packet_core_control_plane.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreDataPlaneListByPacketCoreControlPlane.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreDataPlaneListByPacketCoreControlPlane.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_update_tags.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_update_tags.py index 5a24505c370b..1f427efbd60c 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_update_tags.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_data_plane_update_tags.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/PacketCoreDataPlaneUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/PacketCoreDataPlaneUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/routing_info_list_packet_core_control_plane.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/routing_info_list_packet_core_control_plane.py new file mode 100644 index 000000000000..dbd7cf18aaba --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/routing_info_list_packet_core_control_plane.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.mobilenetwork import MobileNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-mobilenetwork +# USAGE + python routing_info_list_packet_core_control_plane.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MobileNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.routing_info.list( + resource_group_name="rg1", + packet_core_control_plane_name="TestPacketCoreCP", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/RoutingInfoListPacketCoreControlPlane.json +if __name__ == "__main__": + main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/routing_info_packet_core_control_plane.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/routing_info_packet_core_control_plane.py new file mode 100644 index 000000000000..e4c3190ee107 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/routing_info_packet_core_control_plane.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.mobilenetwork import MobileNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-mobilenetwork +# USAGE + python routing_info_packet_core_control_plane.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MobileNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.routing_info.get( + resource_group_name="rg1", + packet_core_control_plane_name="TestPacketCoreCP", + ) + print(response) + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/RoutingInfoPacketCoreControlPlane.json +if __name__ == "__main__": + main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_create.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_create.py index eb6e03b270f2..3fe3db490194 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -73,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/ServiceCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/ServiceCreate.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_delete.py index 817ea6ac88c7..910eb87ef495 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/ServiceDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/ServiceDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_get.py index be9b2dd7dddf..d4608d288d67 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/ServiceGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/ServiceGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_list_by_mobile_network.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_list_by_mobile_network.py index 8011f21e2d53..f1baafa4e2fe 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_list_by_mobile_network.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_list_by_mobile_network.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/ServiceListByMobileNetwork.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/ServiceListByMobileNetwork.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_update_tags.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_update_tags.py index 99cdcd1b15f5..2f36b5e538f1 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_update_tags.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_update_tags.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/ServiceUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/ServiceUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_bulk_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_bulk_delete.py index 8a222c897a3a..12985fd5e34b 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_bulk_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_bulk_delete.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimBulkDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimBulkDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_bulk_upload.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_bulk_upload.py index 009fca5784e1..27995c326159 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_bulk_upload.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_bulk_upload.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -88,6 +91,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimBulkUpload.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimBulkUpload.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_bulk_upload_encrypted.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_bulk_upload_encrypted.py index 7bae315f5d54..c7928d29ad9c 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_bulk_upload_encrypted.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_bulk_upload_encrypted.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -91,6 +94,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimBulkUploadEncrypted.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimBulkUploadEncrypted.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_clone.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_clone.py new file mode 100644 index 000000000000..5b1a3c655bb8 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_clone.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.mobilenetwork import MobileNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-mobilenetwork +# USAGE + python sim_clone.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MobileNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.sims.begin_clone( + resource_group_name="testResourceGroupName", + sim_group_name="testSimGroup", + parameters={ + "sims": ["testSim", "testSim2"], + "targetSimGroupId": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg2/providers/Microsoft.MobileNetwork/simGroups/testSimGroup1" + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimClone.json +if __name__ == "__main__": + main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_create.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_create.py index e3c4d6e1830b..b19e2d39a3b2 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -60,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimCreate.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_delete.py index 1d9a55d19335..6308f9785a21 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_get.py index ff3b4b265312..87f4dd8fb44c 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_create.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_create.py index 9dede0c22e2e..e9148cf89655 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -51,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimGroupCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimGroupCreate.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_delete.py index 3d8207f78120..a1d1d247f037 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimGroupDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimGroupDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_get.py index e7a972b5e2b8..361c86629fe7 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimGroupGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimGroupGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_list_by_mobile_network.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_list_by_mobile_network.py new file mode 100644 index 000000000000..67de1dd23c35 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_list_by_mobile_network.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.mobilenetwork import MobileNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-mobilenetwork +# USAGE + python sim_group_list_by_mobile_network.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MobileNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.mobile_networks.list_sim_groups( + resource_group_name="rg1", + mobile_network_name="testMobileNetwork", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimGroupListByMobileNetwork.json +if __name__ == "__main__": + main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_list_by_resource_group.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_list_by_resource_group.py index 89b255deb5a3..329882c0c65a 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_list_by_resource_group.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimGroupListByResourceGroup.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimGroupListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_list_by_subscription.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_list_by_subscription.py index fbd9e690acc9..51ee42515332 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_list_by_subscription.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimGroupListBySubscription.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimGroupListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_patch.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_patch.py index 37388d8ec1a7..b33eab8beb20 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_patch.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_patch.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -45,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimGroupPatch.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimGroupPatch.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_list_by_sim_group.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_list_by_sim_group.py index 57d22e16ba3b..abb3d0e33749 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_list_by_sim_group.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_list_by_sim_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimListBySimGroup.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimListBySimGroup.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_move.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_move.py new file mode 100644 index 000000000000..8345f2db8f64 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_move.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.mobilenetwork import MobileNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-mobilenetwork +# USAGE + python sim_move.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MobileNetworkManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.sims.begin_move( + resource_group_name="testResourceGroupName", + sim_group_name="testSimGroup", + parameters={ + "sims": ["testSim", "testSim2"], + "targetSimGroupId": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg2/providers/Microsoft.MobileNetwork/simGroups/testSimGroup1" + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimMove.json +if __name__ == "__main__": + main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_create.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_create.py index a38049a21c96..a78c37fd4312 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -77,6 +80,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimPolicyCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimPolicyCreate.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_delete.py index 6c4bf0592979..48d6fec38c72 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimPolicyDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimPolicyDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_get.py index c7480976c4f7..e7eb693af824 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimPolicyGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimPolicyGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_list_by_mobile_network.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_list_by_mobile_network.py index 58852317aa44..507136f7bcd8 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_list_by_mobile_network.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_list_by_mobile_network.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimPolicyListByMobileNetwork.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimPolicyListByMobileNetwork.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_update_tags.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_update_tags.py index 37eebbc24cea..6dd7ba735e70 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_update_tags.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_policy_update_tags.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SimPolicyUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SimPolicyUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_create.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_create.py index 3bc010ea7eac..e20cf5f81f97 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SiteCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SiteCreate.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_delete.py index d065977abac0..c8553dc4ebb1 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SiteDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SiteDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_delete_packet_core.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_delete_packet_core.py index 6c817b115c36..39d7ecf26f3c 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_delete_packet_core.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_delete_packet_core.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -41,6 +44,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SiteDeletePacketCore.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SiteDeletePacketCore.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_get.py index 5b206119d077..912e131b00c7 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SiteGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SiteGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_list_by_mobile_network.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_list_by_mobile_network.py index f75090f5d740..546081738680 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_list_by_mobile_network.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_list_by_mobile_network.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SiteListByMobileNetwork.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SiteListByMobileNetwork.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_update_tags.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_update_tags.py index 21429496e320..befe25c46273 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_update_tags.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_update_tags.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SiteUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SiteUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_create.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_create.py index 6284326a6f7f..53c422452099 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -41,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SliceCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SliceCreate.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_delete.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_delete.py index 74f7937fd4be..b1109ffe2f3f 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SliceDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SliceDelete.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_get.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_get.py index 38adc5ed95e4..b2c79dc6ba98 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SliceGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SliceGet.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_list_by_mobile_network.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_list_by_mobile_network.py index 53bc4c37488b..7e7f5859b01c 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_list_by_mobile_network.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_list_by_mobile_network.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SliceListByMobileNetwork.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SliceListByMobileNetwork.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_update_tags.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_update_tags.py index 1e570193528f..5b9324961647 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_update_tags.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_update_tags.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/SliceUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/SliceUpdateTags.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/ue_info_list.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/ue_info_list.py index a3343a2636ca..379fa44b7e07 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/ue_info_list.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/ue_info_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.mobilenetwork import MobileNetworkManagementClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-02-01/examples/UeInfoList.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2024-04-01/examples/UeInfoList.json if __name__ == "__main__": main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/setup.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/setup.py index 22967ee7abb4..12ca9368c53d 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/setup.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/setup.py @@ -74,9 +74,9 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], python_requires=">=3.8", )