From 362a738f417d5226ec4baf029a3cd299c9a2a803 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 26 Jun 2023 08:46:32 +0000 Subject: [PATCH] CodeGen from PR 24528 in Azure/azure-rest-api-specs [Hub Generated] Publish private branch 'ssivathas/2023-06-01' (#24528) * add or modify files * Removed 2022-12-01-preview and 2021-04-01 APIs --- .../azure-mgmt-mobilenetwork/_meta.json | 6 +- .../mgmt/mobilenetwork/_configuration.py | 12 +- .../_mobile_network_management_client.py | 19 +- .../mgmt/mobilenetwork/_serialization.py | 93 +- .../azure/mgmt/mobilenetwork/_vendor.py | 5 +- .../azure/mgmt/mobilenetwork/_version.py | 2 +- .../mgmt/mobilenetwork/aio/_configuration.py | 12 +- .../aio/_mobile_network_management_client.py | 19 +- .../mobilenetwork/aio/operations/__init__.py | 4 + .../_attached_data_networks_operations.py | 59 +- .../operations/_data_networks_operations.py | 59 +- .../_diagnostics_packages_operations.py | 494 +++++++++ .../operations/_mobile_networks_operations.py | 66 +- .../aio/operations/_operations.py | 12 +- .../operations/_packet_captures_operations.py | 716 ++++++++++++++ ..._core_control_plane_versions_operations.py | 170 +++- .../_packet_core_control_planes_operations.py | 124 +-- .../_packet_core_data_planes_operations.py | 59 +- .../aio/operations/_services_operations.py | 59 +- .../aio/operations/_sim_groups_operations.py | 90 +- .../operations/_sim_policies_operations.py | 59 +- .../aio/operations/_sims_operations.py | 95 +- .../aio/operations/_sites_operations.py | 287 +++++- .../aio/operations/_slices_operations.py | 59 +- .../mgmt/mobilenetwork/models/__init__.py | 26 + ..._mobile_network_management_client_enums.py | 171 ++-- .../mgmt/mobilenetwork/models/_models_py3.py | 854 +++++++++++----- .../mgmt/mobilenetwork/operations/__init__.py | 4 + .../_attached_data_networks_operations.py | 79 +- .../operations/_data_networks_operations.py | 79 +- .../_diagnostics_packages_operations.py | 678 +++++++++++++ .../operations/_mobile_networks_operations.py | 90 +- .../mobilenetwork/operations/_operations.py | 14 +- .../operations/_packet_captures_operations.py | 936 ++++++++++++++++++ ..._core_control_plane_versions_operations.py | 222 ++++- .../_packet_core_control_planes_operations.py | 160 ++- .../_packet_core_data_planes_operations.py | 79 +- .../operations/_services_operations.py | 79 +- .../operations/_sim_groups_operations.py | 114 +-- .../operations/_sim_policies_operations.py | 79 +- .../operations/_sims_operations.py | 123 +-- .../operations/_sites_operations.py | 347 ++++++- .../operations/_slices_operations.py | 79 +- .../attached_data_network_create.py | 4 +- .../attached_data_network_delete.py | 7 +- .../attached_data_network_get.py | 4 +- ..._network_list_by_packet_core_data_plane.py | 4 +- .../attached_data_network_update_tags.py | 4 +- .../generated_samples/data_network_create.py | 4 +- .../generated_samples/data_network_delete.py | 7 +- .../generated_samples/data_network_get.py | 4 +- .../data_network_list_by_mobile_network.py | 4 +- .../data_network_update_tags.py | 4 +- .../diagnostics_package_create.py | 42 + .../diagnostics_package_delete.py | 41 + ...ate_tags.py => diagnostics_package_get.py} | 10 +- ...ckage_list_by_packet_core_control_plane.py | 42 + .../mobile_network_create.py | 4 +- .../mobile_network_delete.py | 7 +- .../generated_samples/mobile_network_get.py | 4 +- .../mobile_network_list_by_resource_group.py | 4 +- .../mobile_network_list_by_subscription.py | 4 +- .../mobile_network_update_tags.py | 4 +- .../generated_samples/operation_list.py | 4 +- .../packet_capture_create.py | 54 + .../packet_capture_delete.py | 41 + ...p_update_tags.py => packet_capture_get.py} | 12 +- ...pture_list_by_packet_core_control_plane.py | 42 + .../generated_samples/packet_capture_stop.py | 42 + ...ntrol_plane_collect_diagnostics_package.py | 4 +- .../packet_core_control_plane_create.py | 13 +- .../packet_core_control_plane_delete.py | 7 +- .../packet_core_control_plane_get.py | 4 +- ...re_control_plane_list_by_resource_group.py | 4 +- ...core_control_plane_list_by_subscription.py | 4 +- .../packet_core_control_plane_patch.py | 50 + .../packet_core_control_plane_reinstall.py | 4 +- .../packet_core_control_plane_rollback.py | 4 +- .../packet_core_control_plane_version_get.py | 2 +- ...ntrol_plane_version_get_by_subscription.py | 40 + .../packet_core_control_plane_version_list.py | 2 +- ...trol_plane_version_list_by_subscription.py | 39 + .../packet_core_data_plane_create.py | 4 +- .../packet_core_data_plane_delete.py | 7 +- .../packet_core_data_plane_get.py | 4 +- ...plane_list_by_packet_core_control_plane.py | 4 +- .../packet_core_data_plane_update_tags.py | 4 +- .../generated_samples/service_create.py | 4 +- .../generated_samples/service_delete.py | 7 +- .../generated_samples/service_get.py | 4 +- .../service_list_by_mobile_network.py | 4 +- .../generated_samples/service_update_tags.py | 4 +- .../generated_samples/sim_bulk_delete.py | 4 +- .../generated_samples/sim_bulk_upload.py | 16 +- .../sim_bulk_upload_encrypted.py | 16 +- .../generated_samples/sim_create.py | 10 +- .../generated_samples/sim_delete.py | 7 +- .../generated_samples/sim_get.py | 4 +- .../generated_samples/sim_group_create.py | 8 +- .../generated_samples/sim_group_delete.py | 7 +- .../generated_samples/sim_group_get.py | 4 +- .../sim_group_list_by_resource_group.py | 4 +- .../sim_group_list_by_subscription.py | 4 +- .../generated_samples/sim_group_patch.py | 50 + .../sim_list_by_sim_group.py | 4 +- .../generated_samples/sim_policy_create.py | 14 +- .../generated_samples/sim_policy_delete.py | 7 +- .../generated_samples/sim_policy_get.py | 4 +- .../sim_policy_list_by_mobile_network.py | 4 +- .../sim_policy_update_tags.py | 4 +- .../generated_samples/site_create.py | 4 +- .../generated_samples/site_delete.py | 7 +- .../site_delete_packet_core.py | 46 + .../generated_samples/site_get.py | 4 +- .../site_list_by_mobile_network.py | 4 +- .../generated_samples/site_update_tags.py | 4 +- .../generated_samples/slice_create.py | 4 +- .../generated_samples/slice_delete.py | 7 +- .../generated_samples/slice_get.py | 4 +- .../slice_list_by_mobile_network.py | 4 +- .../generated_samples/slice_update_tags.py | 4 +- 121 files changed, 5987 insertions(+), 1695 deletions(-) create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_diagnostics_packages_operations.py create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_captures_operations.py create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_diagnostics_packages_operations.py create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_captures_operations.py create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_create.py create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_delete.py rename sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/{packet_core_control_plane_update_tags.py => diagnostics_package_get.py} (81%) create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_list_by_packet_core_control_plane.py create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_create.py create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_delete.py rename sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/{sim_group_update_tags.py => packet_capture_get.py} (81%) create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_list_by_packet_core_control_plane.py create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_stop.py create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_patch.py create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_get_by_subscription.py create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_list_by_subscription.py create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_patch.py create mode 100644 sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_delete_packet_core.py diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/_meta.json b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/_meta.json index 33d70e474a581..6c57c4ec94899 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/_meta.json +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/_meta.json @@ -1,11 +1,11 @@ { - "commit": "340d577969b7bff5ad0488d79543314bc17daa50", + "commit": "a8cb7f03bd77ce9162e96592bfbeb1e0b2060262", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.6.0", "@autorest/modelerfour@4.24.3" ], - "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.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --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=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.6.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/mobilenetwork/resource-manager/readme.md" } \ No newline at end of file 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 66e0957c8d7a1..ad45c009eff7a 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_configuration.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -33,16 +27,16 @@ class MobileNetworkManagementClientConfiguration(Configuration): # pylint: disa :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :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 "2022-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-06-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: Literal["2022-11-01"] = kwargs.pop("api_version", "2022-11-01") + api_version: str = kwargs.pop("api_version", "2023-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") 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 f1b81f422b372..570298ae78c05 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 @@ -18,8 +18,10 @@ from .operations import ( AttachedDataNetworksOperations, DataNetworksOperations, + DiagnosticsPackagesOperations, MobileNetworksOperations, Operations, + PacketCapturesOperations, PacketCoreControlPlaneVersionsOperations, PacketCoreControlPlanesOperations, PacketCoreDataPlanesOperations, @@ -45,10 +47,15 @@ class MobileNetworkManagementClient: # pylint: disable=client-accepts-api-versi azure.mgmt.mobilenetwork.operations.AttachedDataNetworksOperations :ivar data_networks: DataNetworksOperations operations :vartype data_networks: azure.mgmt.mobilenetwork.operations.DataNetworksOperations + :ivar diagnostics_packages: DiagnosticsPackagesOperations operations + :vartype diagnostics_packages: + azure.mgmt.mobilenetwork.operations.DiagnosticsPackagesOperations :ivar mobile_networks: MobileNetworksOperations operations :vartype mobile_networks: azure.mgmt.mobilenetwork.operations.MobileNetworksOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.mobilenetwork.operations.Operations + :ivar packet_captures: PacketCapturesOperations operations + :vartype packet_captures: azure.mgmt.mobilenetwork.operations.PacketCapturesOperations :ivar packet_core_control_planes: PacketCoreControlPlanesOperations operations :vartype packet_core_control_planes: azure.mgmt.mobilenetwork.operations.PacketCoreControlPlanesOperations @@ -72,11 +79,11 @@ class MobileNetworkManagementClient: # pylint: disable=client-accepts-api-versi :vartype slices: azure.mgmt.mobilenetwork.operations.SlicesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-06-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 @@ -93,7 +100,7 @@ def __init__( self._config = MobileNetworkManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -103,8 +110,12 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.data_networks = DataNetworksOperations(self._client, self._config, self._serialize, self._deserialize) + self.diagnostics_packages = DiagnosticsPackagesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.mobile_networks = MobileNetworksOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.packet_captures = PacketCapturesOperations(self._client, self._config, self._serialize, self._deserialize) self.packet_core_control_planes = PacketCoreControlPlanesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -150,5 +161,5 @@ def __enter__(self) -> "MobileNetworkManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) 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 2c170e28dbca2..842ae727fbbce 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_serialization.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: 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__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,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=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1242,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1361,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=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = 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 @@ -1471,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_vendor.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_vendor.py index 9aad73fc743e7..bd0df84f5319f 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_vendor.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_version.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_version.py index 48944bf3938a2..e5754a47ce68f 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 = "2.0.0" +VERSION = "1.0.0b1" 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 bfc721b8d2655..98a1c7a966ddd 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 @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -33,16 +27,16 @@ class MobileNetworkManagementClientConfiguration(Configuration): # pylint: disa :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :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 "2022-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-06-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: Literal["2022-11-01"] = kwargs.pop("api_version", "2022-11-01") + api_version: str = kwargs.pop("api_version", "2023-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") 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 82a13f3f66d6b..f1127711635fa 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 @@ -18,8 +18,10 @@ from .operations import ( AttachedDataNetworksOperations, DataNetworksOperations, + DiagnosticsPackagesOperations, MobileNetworksOperations, Operations, + PacketCapturesOperations, PacketCoreControlPlaneVersionsOperations, PacketCoreControlPlanesOperations, PacketCoreDataPlanesOperations, @@ -45,10 +47,15 @@ class MobileNetworkManagementClient: # pylint: disable=client-accepts-api-versi azure.mgmt.mobilenetwork.aio.operations.AttachedDataNetworksOperations :ivar data_networks: DataNetworksOperations operations :vartype data_networks: azure.mgmt.mobilenetwork.aio.operations.DataNetworksOperations + :ivar diagnostics_packages: DiagnosticsPackagesOperations operations + :vartype diagnostics_packages: + azure.mgmt.mobilenetwork.aio.operations.DiagnosticsPackagesOperations :ivar mobile_networks: MobileNetworksOperations operations :vartype mobile_networks: azure.mgmt.mobilenetwork.aio.operations.MobileNetworksOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.mobilenetwork.aio.operations.Operations + :ivar packet_captures: PacketCapturesOperations operations + :vartype packet_captures: azure.mgmt.mobilenetwork.aio.operations.PacketCapturesOperations :ivar packet_core_control_planes: PacketCoreControlPlanesOperations operations :vartype packet_core_control_planes: azure.mgmt.mobilenetwork.aio.operations.PacketCoreControlPlanesOperations @@ -72,11 +79,11 @@ class MobileNetworkManagementClient: # pylint: disable=client-accepts-api-versi :vartype slices: azure.mgmt.mobilenetwork.aio.operations.SlicesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-11-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-06-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 @@ -93,7 +100,7 @@ def __init__( self._config = MobileNetworkManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -103,8 +110,12 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.data_networks = DataNetworksOperations(self._client, self._config, self._serialize, self._deserialize) + self.diagnostics_packages = DiagnosticsPackagesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.mobile_networks = MobileNetworksOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.packet_captures = PacketCapturesOperations(self._client, self._config, self._serialize, self._deserialize) self.packet_core_control_planes = PacketCoreControlPlanesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -150,5 +161,5 @@ async def __aenter__(self) -> "MobileNetworkManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) 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 072372a6f784e..2f03dce83d9ed 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 @@ -8,8 +8,10 @@ from ._attached_data_networks_operations import AttachedDataNetworksOperations from ._data_networks_operations import DataNetworksOperations +from ._diagnostics_packages_operations import DiagnosticsPackagesOperations from ._mobile_networks_operations import MobileNetworksOperations from ._operations import Operations +from ._packet_captures_operations import PacketCapturesOperations from ._packet_core_control_planes_operations import PacketCoreControlPlanesOperations from ._packet_core_control_plane_versions_operations import PacketCoreControlPlaneVersionsOperations from ._packet_core_data_planes_operations import PacketCoreDataPlanesOperations @@ -27,8 +29,10 @@ __all__ = [ "AttachedDataNetworksOperations", "DataNetworksOperations", + "DiagnosticsPackagesOperations", "MobileNetworksOperations", "Operations", + "PacketCapturesOperations", "PacketCoreControlPlanesOperations", "PacketCoreControlPlaneVersionsOperations", "PacketCoreDataPlanesOperations", 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 a5e5f3ba2672d..bddaa8fc042e4 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,9 +81,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -104,8 +98,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,9 +152,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -239,9 +232,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -258,8 +249,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -300,16 +292,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AttachedDataNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AttachedDataNetwork") @@ -331,8 +321,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,7 +461,7 @@ 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 model type or a IO type. Required. + 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. @@ -492,9 +483,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AttachedDataNetwork] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -633,8 +622,8 @@ async def update_tags( :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 - :param parameters: Parameters supplied to update attached data network tags. Is either a model - type or a IO type. Required. + :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. @@ -655,16 +644,14 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AttachedDataNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -686,8 +673,9 @@ async def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -734,9 +722,7 @@ def list_by_packet_core_data_plane( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -791,8 +777,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 54792d7b9f6c3..cd82754607132 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,9 +76,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -98,8 +92,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -144,9 +139,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -218,9 +211,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -236,8 +227,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -277,16 +269,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.DataNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataNetwork") @@ -307,8 +297,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -435,7 +426,7 @@ 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 model type or a IO type. Required. + 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. @@ -456,9 +447,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.DataNetwork] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -587,8 +576,8 @@ async def update_tags( :type mobile_network_name: str :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 model type or a - IO type. Required. + :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. @@ -609,16 +598,14 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.DataNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -639,8 +626,9 @@ async def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -680,9 +668,7 @@ def list_by_mobile_network( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -736,8 +722,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 new file mode 100644 index 0000000000000..c1d51938a8cf2 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_diagnostics_packages_operations.py @@ -0,0 +1,494 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._diagnostics_packages_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_packet_core_control_plane_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DiagnosticsPackagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.mobilenetwork.aio.MobileNetworkManagementClient`'s + :attr:`diagnostics_packages` 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") + + async def _create_or_update_initial( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + diagnostics_package_name: str, + **kwargs: Any + ) -> _models.DiagnosticsPackage: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiagnosticsPackage] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DiagnosticsPackage", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DiagnosticsPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + 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, + resource_group_name: str, + packet_core_control_plane_name: str, + diagnostics_package_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.DiagnosticsPackage]: + """Creates or updates a diagnostics package. + + :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 + :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] + :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.DiagnosticsPackage] = 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._create_or_update_initial( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + diagnostics_package_name=diagnostics_package_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DiagnosticsPackage", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + diagnostics_package_name: str, + **kwargs: Any + ) -> _models.DiagnosticsPackage: + """Gets information about the specified diagnostics package. + + :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 + :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 = { + 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.DiagnosticsPackage] = kwargs.pop("cls", None) + + 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) + + _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("DiagnosticsPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + packet_core_control_plane_name: str, + diagnostics_package_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + 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) + + _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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + diagnostics_package_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified diagnostics package. + + :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 + :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: + """ + _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[None] = 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._delete_initial( # type: ignore + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + diagnostics_package_name=diagnostics_package_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" + } + + @distributed_trace + def list_by_packet_core_control_plane( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DiagnosticsPackage"]: + """Lists all the diagnostics packages under a packet core control plane. + + :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 + :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] + :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.DiagnosticsPackageListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_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) + + 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("DiagnosticsPackageListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_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/_mobile_networks_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_mobile_networks_operations.py index 9425391844473..f781959fab849 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,9 +77,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -98,8 +92,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -142,9 +137,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -211,9 +204,7 @@ async def get(self, resource_group_name: str, mobile_network_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -228,8 +219,9 @@ async def get(self, resource_group_name: str, mobile_network_name: str, **kwargs 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -268,16 +260,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.MobileNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "MobileNetwork") @@ -297,8 +287,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,7 +404,7 @@ 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 model type or a IO type. Required. + 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. @@ -434,9 +425,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.MobileNetwork] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -555,8 +544,8 @@ async def update_tags( :type resource_group_name: str :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. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to update mobile 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. @@ -577,16 +566,14 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.MobileNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -606,8 +593,9 @@ async def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -640,9 +628,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.MobileNe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -694,8 +680,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -727,9 +714,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -782,8 +767,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 852ac5d58bb87..5f86ca18898f1 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 @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,9 +64,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -122,8 +115,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 new file mode 100644 index 0000000000000..c1badbfab9c65 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_captures_operations.py @@ -0,0 +1,716 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._packet_captures_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_packet_core_control_plane_request, + build_stop_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PacketCapturesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.mobilenetwork.aio.MobileNetworkManagementClient`'s + :attr:`packet_captures` 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") + + async def _create_or_update_initial( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + packet_capture_name: str, + parameters: Union[_models.PacketCapture, IO], + **kwargs: Any + ) -> _models.PacketCapture: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PacketCapture] = 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, "PacketCapture") + + 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, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PacketCapture", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PacketCapture", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + 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, + resource_group_name: str, + packet_core_control_plane_name: str, + packet_capture_name: str, + parameters: _models.PacketCapture, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PacketCapture]: + """Creates or updates a packet capture. + + :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 + :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. + Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCapture + :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] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + packet_capture_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PacketCapture]: + """Creates or updates a packet capture. + + :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 + :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. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + packet_capture_name: str, + parameters: Union[_models.PacketCapture, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.PacketCapture]: + """Creates or updates a packet capture. + + :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 + :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. + :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] + :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.PacketCapture] = 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._create_or_update_initial( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + packet_capture_name=packet_capture_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("PacketCapture", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, **kwargs: Any + ) -> _models.PacketCapture: + """Gets information about the specified packet capture session. + + :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 + :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 = { + 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.PacketCapture] = kwargs.pop("cls", None) + + 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) + + _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("PacketCapture", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" + } + + 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 = { + 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[None] = kwargs.pop("cls", None) + + 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) + + _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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified packet capture. + + :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 + :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: + """ + _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[None] = 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._delete_initial( # type: ignore + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + packet_capture_name=packet_capture_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" + } + + 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 = { + 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[Optional[_models.AsyncOperationStatus]] = kwargs.pop("cls", None) + + 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) + + _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 + if response.status_code == 200: + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}/stop" + } + + @distributed_trace_async + async def begin_stop( + self, resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Stop a packet capture session. + + :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 + :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: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :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.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._stop_initial( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + packet_capture_name=packet_capture_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}/stop" + } + + @distributed_trace + def list_by_packet_core_control_plane( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PacketCapture"]: + """Lists all the packet capture sessions under a packet core control plane. + + :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 + :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: + """ + _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.PacketCaptureListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_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) + + 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("PacketCaptureListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_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 ad35134e9b7fe..c7c34634c8989 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 @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -29,12 +28,13 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._packet_core_control_plane_versions_operations import build_get_request, build_list_request +from ...operations._packet_core_control_plane_versions_operations import ( + build_get_by_subscription_request, + build_get_request, + build_list_by_subscription_request, + build_list_request, +) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,9 +80,7 @@ async def get(self, version_name: str, **kwargs: Any) -> _models.PacketCoreContr _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -95,8 +93,9 @@ async def get(self, version_name: str, **kwargs: Any) -> _models.PacketCoreContr 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,9 +128,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.PacketCoreControlPlaneVe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -182,8 +179,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -197,3 +195,147 @@ 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 = { + 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.PacketCoreControlPlaneVersion] = kwargs.pop("cls", None) + + 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) + + _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("PacketCoreControlPlaneVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName}" + } + + @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: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneVersion] + :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.PacketCoreControlPlaneVersionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_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) + + 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("PacketCoreControlPlaneVersionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_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 409b951b3074c..b8856c2eded4d 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -43,10 +43,6 @@ build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,9 +80,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -101,8 +95,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -145,9 +140,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -216,9 +209,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -233,8 +224,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -273,16 +265,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PacketCoreControlPlane] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PacketCoreControlPlane") @@ -302,8 +292,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -420,7 +411,7 @@ 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 model type or a IO type. Required. + 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. @@ -442,9 +433,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PacketCoreControlPlane] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -497,20 +486,20 @@ async def update_tags( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: _models.TagsObject, + parameters: _models.IdentityAndTagsObject, *, content_type: str = "application/json", **kwargs: Any ) -> _models.PacketCoreControlPlane: - """Updates packet core control planes tags. + """Patch packet core control plane resource. :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 - :param parameters: Parameters supplied to update packet core control plane tags. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject + :param parameters: Parameters supplied to patch packet core control plane resource. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -530,14 +519,14 @@ async def update_tags( content_type: str = "application/json", **kwargs: Any ) -> _models.PacketCoreControlPlane: - """Updates packet core control planes tags. + """Patch packet core control plane resource. :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 - :param parameters: Parameters supplied to update packet core control plane tags. Required. + :param parameters: Parameters supplied to patch packet core control plane resource. Required. :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -553,19 +542,19 @@ async def update_tags( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.IdentityAndTagsObject, IO], **kwargs: Any ) -> _models.PacketCoreControlPlane: - """Updates packet core control planes tags. + """Patch packet core control plane resource. :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 - :param parameters: Parameters supplied to update packet core control plane tags. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO + :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 @@ -585,19 +574,17 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PacketCoreControlPlane] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "TagsObject") + _json = self._serialize.body(parameters, "IdentityAndTagsObject") request = build_update_tags_request( resource_group_name=resource_group_name, @@ -614,8 +601,9 @@ async def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -650,9 +638,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PacketCo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -704,8 +690,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -741,9 +728,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -796,8 +781,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -828,9 +814,7 @@ async def _rollback_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -845,8 +829,9 @@ async def _rollback_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -898,9 +883,7 @@ async def begin_rollback( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -958,9 +941,7 @@ async def _reinstall_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -975,8 +956,9 @@ async def _reinstall_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1029,9 +1011,7 @@ async def begin_reinstall( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -1093,16 +1073,14 @@ async def _collect_diagnostics_package_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PacketCoreControlPlaneCollectDiagnosticsPackage") @@ -1122,8 +1100,9 @@ async def _collect_diagnostics_package_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1242,7 +1221,8 @@ 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 model type or a IO type. Required. + package operation. Is either a PacketCoreControlPlaneCollectDiagnosticsPackage type or a IO + type. Required. :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneCollectDiagnosticsPackage or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1265,9 +1245,7 @@ async def begin_collect_diagnostics_package( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) 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 4821bd13e7687..a325736760fb9 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,9 +80,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -102,8 +96,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,9 +147,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -230,9 +223,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -248,8 +239,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -289,16 +281,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PacketCoreDataPlane] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PacketCoreDataPlane") @@ -319,8 +309,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,7 +440,7 @@ 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 model type or a IO type. Required. + 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. @@ -471,9 +462,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PacketCoreDataPlane] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -602,8 +591,8 @@ async def update_tags( :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 - :param parameters: Parameters supplied to update packet core data plane tags. Is either a model - type or a IO type. Required. + :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. @@ -624,16 +613,14 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PacketCoreDataPlane] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -654,8 +641,9 @@ async def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -696,9 +684,7 @@ def list_by_packet_core_control_plane( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -752,8 +738,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 c9655609adc45..cfedaeac69ce5 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,9 +76,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -98,8 +92,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -145,9 +140,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -220,9 +213,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -238,8 +229,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -279,16 +271,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Service] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Service") @@ -309,8 +299,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -438,7 +429,7 @@ async def begin_create_or_update( strings - ``default``\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to the create or update service operation. Is either a - model type or a IO type. Required. + 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. @@ -459,9 +450,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Service] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -593,8 +582,8 @@ async def update_tags( :param service_name: The name of the service. You must not use any of the following reserved strings - ``default``\ , ``requested`` or ``service``. Required. :type service_name: str - :param parameters: Parameters supplied to update service tags. Is either a model type or a IO - type. Required. + :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. @@ -615,16 +604,14 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Service] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -645,8 +632,9 @@ async def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -686,9 +674,7 @@ def list_by_mobile_network( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -742,8 +728,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 4c29abbdaa5ee..55b4d2d082241 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,9 +77,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -98,8 +92,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -140,9 +135,7 @@ async def begin_delete(self, resource_group_name: str, sim_group_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -209,9 +202,7 @@ async def get(self, resource_group_name: str, sim_group_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -226,8 +217,9 @@ async def get(self, resource_group_name: str, sim_group_name: str, **kwargs: Any 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -262,16 +254,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SimGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SimGroup") @@ -291,8 +281,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -401,7 +392,7 @@ 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 - model type or a IO type. Required. + 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. @@ -422,9 +413,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SimGroup] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -477,20 +466,20 @@ async def update_tags( self, resource_group_name: str, sim_group_name: str, - parameters: _models.TagsObject, + parameters: _models.IdentityAndTagsObject, *, content_type: str = "application/json", **kwargs: Any ) -> _models.SimGroup: - """Updates SIM group tags. + """Patch SIM group resource. :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 update SIM group tags. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject + :param parameters: Parameters supplied to patch SIM group resource. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -510,14 +499,14 @@ async def update_tags( content_type: str = "application/json", **kwargs: Any ) -> _models.SimGroup: - """Updates SIM group tags. + """Patch SIM group resource. :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 update SIM group tags. Required. + :param parameters: Parameters supplied to patch SIM group resource. Required. :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -530,18 +519,22 @@ async def update_tags( @distributed_trace_async async def update_tags( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.IdentityAndTagsObject, IO], + **kwargs: Any ) -> _models.SimGroup: - """Updates SIM group tags. + """Patch SIM group resource. :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 update SIM group tags. Is either a model type or a IO - type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO + :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 @@ -561,19 +554,17 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SimGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "TagsObject") + _json = self._serialize.body(parameters, "IdentityAndTagsObject") request = build_update_tags_request( resource_group_name=resource_group_name, @@ -590,8 +581,9 @@ async def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -624,9 +616,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SimGroup _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -678,8 +668,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -711,9 +702,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -766,8 +755,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 70af130226141..cf6aac7ba1609 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,9 +76,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -98,8 +92,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -144,9 +139,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -218,9 +211,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -236,8 +227,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -277,16 +269,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SimPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SimPolicy") @@ -307,8 +297,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -433,7 +424,7 @@ 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 model type or a IO type. Required. + 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. @@ -454,9 +445,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SimPolicy] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -585,8 +574,8 @@ async def update_tags( :type mobile_network_name: str :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 model type or a - IO type. Required. + :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. @@ -607,16 +596,14 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SimPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -637,8 +624,9 @@ async def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -678,9 +666,7 @@ def list_by_mobile_network( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -734,8 +720,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 8a48522df1595..3e8d92ac9f70d 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -41,10 +41,6 @@ build_list_by_group_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,9 +78,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -100,8 +94,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -146,9 +141,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -218,9 +211,7 @@ async def get(self, resource_group_name: str, sim_group_name: str, sim_name: str _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -236,8 +227,9 @@ async def get(self, resource_group_name: str, sim_group_name: str, sim_name: str 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -277,16 +269,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Sim] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Sim") @@ -307,8 +297,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -427,7 +418,7 @@ async def begin_create_or_update( :type sim_group_name: str :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 model + :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'. @@ -448,9 +439,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Sim] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -518,9 +507,7 @@ def list_by_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -574,8 +561,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -606,16 +594,14 @@ async def _bulk_upload_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SimUploadList") @@ -635,8 +621,9 @@ async def _bulk_upload_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -744,8 +731,8 @@ async def begin_bulk_upload( :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 the bulk SIM upload operation. Is either a model type - or a IO type. Required. + :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. @@ -767,9 +754,7 @@ async def begin_bulk_upload( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -830,16 +815,14 @@ async def _bulk_delete_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SimDeleteList") @@ -859,8 +842,9 @@ async def _bulk_delete_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -968,8 +952,8 @@ async def begin_bulk_delete( :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 the bulk SIM delete operation. Is either a model type - or a IO type. Required. + :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. @@ -991,9 +975,7 @@ async def begin_bulk_delete( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1058,16 +1040,14 @@ async def _bulk_upload_encrypted_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "EncryptedSimUploadList") @@ -1087,8 +1067,9 @@ async def _bulk_upload_encrypted_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1201,7 +1182,7 @@ 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 - model type or a IO type. Required. + 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. @@ -1223,9 +1204,7 @@ async def begin_bulk_upload_encrypted( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) 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 14fcb844264e7..7e84c5aa117fb 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -33,16 +33,13 @@ from ..._vendor import _convert_request from ...operations._sites_operations import ( build_create_or_update_request, + build_delete_packet_core_request, build_delete_request, build_get_request, build_list_by_mobile_network_request, build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,9 +77,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -98,8 +93,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -145,9 +141,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -219,9 +213,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -237,8 +229,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -278,16 +271,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Site] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Site") @@ -308,8 +299,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -434,7 +426,7 @@ 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 model type or a IO type. Required. + 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. @@ -454,9 +446,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Site] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -585,8 +575,8 @@ async def update_tags( :type mobile_network_name: str :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 model type or a - IO type. Required. + :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. @@ -607,16 +597,14 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Site] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -637,8 +625,9 @@ async def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -678,9 +667,7 @@ def list_by_mobile_network( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -734,8 +721,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -751,3 +739,230 @@ async def get_next(next_link=None): 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], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SiteDeletePacketCore") + + request = build_delete_packet_core_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, + 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) + + _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) + + 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" + } + + @overload + async def begin_delete_packet_core( + self, + resource_group_name: str, + mobile_network_name: str, + site_name: str, + parameters: _models.SiteDeletePacketCore, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a packet core under the specified mobile network site. + + :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 + :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: ~azure.mgmt.mobilenetwork.models.SiteDeletePacketCore + :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: + """ + + @overload + async def begin_delete_packet_core( + self, + resource_group_name: str, + mobile_network_name: str, + site_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a packet core under the specified mobile network site. + + :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 + :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 + :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: + """ + + @distributed_trace_async + async def begin_delete_packet_core( + self, + resource_group_name: str, + mobile_network_name: str, + site_name: str, + parameters: Union[_models.SiteDeletePacketCore, IO], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a packet core under the specified mobile network site. + + :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 + :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. + :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: + """ + _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[None] = 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._delete_packet_core_initial( # type: ignore + resource_group_name=resource_group_name, + mobile_network_name=mobile_network_name, + site_name=site_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): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_packet_core.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}/deletePacketCore" + } 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 21837f3133076..017c3de2e5e62 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,10 +39,6 @@ build_update_tags_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,9 +76,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -98,8 +92,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -144,9 +139,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -218,9 +211,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -236,8 +227,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -277,16 +269,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Slice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Slice") @@ -307,8 +297,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -433,7 +424,7 @@ 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 model type or a IO type. Required. + 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. @@ -453,9 +444,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Slice] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -584,8 +573,8 @@ async def update_tags( :type mobile_network_name: str :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 model type or - a IO type. Required. + :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. @@ -606,16 +595,14 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Slice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -636,8 +623,9 @@ async def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -677,9 +665,7 @@ def list_by_mobile_network( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -733,8 +719,9 @@ async def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 9b9e5b6f47a11..3c7f15dcdda49 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 @@ -23,12 +23,16 @@ from ._models_py3 import DataNetworkConfiguration from ._models_py3 import DataNetworkListResult from ._models_py3 import DataNetworkResourceId +from ._models_py3 import DiagnosticsPackage +from ._models_py3 import DiagnosticsPackageListResult +from ._models_py3 import DiagnosticsUploadConfiguration from ._models_py3 import EncryptedSimPropertiesFormat from ._models_py3 import EncryptedSimUploadList from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse from ._models_py3 import HttpsServerCertificate +from ._models_py3 import IdentityAndTagsObject from ._models_py3 import Installation from ._models_py3 import InterfaceProperties from ._models_py3 import KeyVaultKey @@ -41,9 +45,12 @@ from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationList +from ._models_py3 import PacketCapture +from ._models_py3 import PacketCaptureListResult from ._models_py3 import PacketCoreControlPlane from ._models_py3 import PacketCoreControlPlaneCollectDiagnosticsPackage from ._models_py3 import PacketCoreControlPlaneListResult +from ._models_py3 import PacketCoreControlPlaneResourceId from ._models_py3 import PacketCoreControlPlaneVersion from ._models_py3 import PacketCoreControlPlaneVersionListResult from ._models_py3 import PacketCoreDataPlane @@ -79,6 +86,7 @@ from ._models_py3 import SimStaticIpPropertiesStaticIp from ._models_py3 import SimUploadList from ._models_py3 import Site +from ._models_py3 import SiteDeletePacketCore from ._models_py3 import SiteListResult from ._models_py3 import SiteResourceId from ._models_py3 import Slice @@ -97,16 +105,21 @@ from ._mobile_network_management_client_enums import CertificateProvisioningState from ._mobile_network_management_client_enums import CoreNetworkType from ._mobile_network_management_client_enums import CreatedByType +from ._mobile_network_management_client_enums import DesiredInstallationState +from ._mobile_network_management_client_enums import DiagnosticsPackageStatus +from ._mobile_network_management_client_enums import InstallationReason 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 ObsoleteVersion +from ._mobile_network_management_client_enums import PacketCaptureStatus from ._mobile_network_management_client_enums import PduSessionType from ._mobile_network_management_client_enums import PlatformType from ._mobile_network_management_client_enums import PreemptionCapability from ._mobile_network_management_client_enums import PreemptionVulnerability from ._mobile_network_management_client_enums import ProvisioningState from ._mobile_network_management_client_enums import RecommendedVersion +from ._mobile_network_management_client_enums import ReinstallRequired from ._mobile_network_management_client_enums import SdfDirection from ._mobile_network_management_client_enums import SimState from ._mobile_network_management_client_enums import SiteProvisioningState @@ -134,12 +147,16 @@ "DataNetworkConfiguration", "DataNetworkListResult", "DataNetworkResourceId", + "DiagnosticsPackage", + "DiagnosticsPackageListResult", + "DiagnosticsUploadConfiguration", "EncryptedSimPropertiesFormat", "EncryptedSimUploadList", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", "HttpsServerCertificate", + "IdentityAndTagsObject", "Installation", "InterfaceProperties", "KeyVaultKey", @@ -152,9 +169,12 @@ "Operation", "OperationDisplay", "OperationList", + "PacketCapture", + "PacketCaptureListResult", "PacketCoreControlPlane", "PacketCoreControlPlaneCollectDiagnosticsPackage", "PacketCoreControlPlaneListResult", + "PacketCoreControlPlaneResourceId", "PacketCoreControlPlaneVersion", "PacketCoreControlPlaneVersionListResult", "PacketCoreDataPlane", @@ -190,6 +210,7 @@ "SimStaticIpPropertiesStaticIp", "SimUploadList", "Site", + "SiteDeletePacketCore", "SiteListResult", "SiteResourceId", "Slice", @@ -207,16 +228,21 @@ "CertificateProvisioningState", "CoreNetworkType", "CreatedByType", + "DesiredInstallationState", + "DiagnosticsPackageStatus", + "InstallationReason", "InstallationState", "ManagedServiceIdentityType", "NaptEnabled", "ObsoleteVersion", + "PacketCaptureStatus", "PduSessionType", "PlatformType", "PreemptionCapability", "PreemptionVulnerability", "ProvisioningState", "RecommendedVersion", + "ReinstallRequired", "SdfDirection", "SimState", "SiteProvisioningState", 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 5e10313e04f9e..3e5708a9cc61e 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 @@ -13,10 +13,10 @@ class AuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """How to authenticate users who access local diagnostics APIs.""" - #: Use AAD SSO to authenticate the user (this requires internet access). AAD = "AAD" - #: Use locally stored passwords to authenticate the user. + """Use AAD SSO to authenticate the user (this requires internet access).""" PASSWORD = "Password" + """Use locally stored passwords to authenticate the user.""" class BillingSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -24,40 +24,38 @@ class BillingSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): SKU gets added or an exiting SKU gets removed. """ - #: 100 Mbps, 20 active SIMs plan G0 = "G0" - #: 1 Gbps, 100 active SIMs plan + """100 Mbps, 20 active SIMs plan, 2 RANs""" G1 = "G1" - #: 2 Gbps, 200 active SIMs plan + """1 Gbps, 100 active SIMs plan, 5 RANs""" G2 = "G2" - #: 3 Gbps, 300 active SIMs plan - G3 = "G3" - #: 4 Gbps, 400 active SIMs plan - G4 = "G4" - #: 5 Gbps, 500 active SIMs plan + """2 Gbps, 200 active SIMs plan, 10 RANs""" G5 = "G5" - #: 10 Gbps, 1000 active SIMs plan + """5 Gbps, 500 active SIMs plan""" G10 = "G10" + """10 Gbps, 1000 active SIMs plan""" class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The certificate's provisioning state.""" - #: The certificate has not been provisioned. NOT_PROVISIONED = "NotProvisioned" - #: The certificate has been provisioned. + """The certificate has not been provisioned.""" PROVISIONED = "Provisioned" - #: The certificate failed to be provisioned. The "reason" property explains why. + """The certificate has been provisioned.""" FAILED = "Failed" + """The certificate failed to be provisioned. The "reason" property explains why.""" class CoreNetworkType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The core network technology generation (5G core or EPC / 4G core).""" + """The core network technology generation (5G core, EPC / 4G core or EPC / 4G + 5G core).""" - #: 5G core FIVE_GC = "5GC" - #: EPC / 4G core + """5G core""" EPC = "EPC" + """EPC / 4G core""" + EPC5_GC = "EPC + 5GC" + """Combined EPC / 4G and 5G core""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -69,56 +67,90 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class DesiredInstallationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The desired installation state of the packet core.""" + + UNINSTALLED = "Uninstalled" + """Don't install the packet core.""" + INSTALLED = "Installed" + """Install the packet core.""" + + +class DiagnosticsPackageStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the diagnostics package collection.""" + + NOT_STARTED = "NotStarted" + COLLECTING = "Collecting" + COLLECTED = "Collected" + ERROR = "Error" + + +class InstallationReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The reason for the installation state of the packet core.""" + + NO_SLICES = "NoSlices" + """The mobile network does not have any applicable configured slices.""" + NO_PACKET_CORE_DATA_PLANE = "NoPacketCoreDataPlane" + """There is no configured data plane for this packet core.""" + NO_ATTACHED_DATA_NETWORKS = "NoAttachedDataNetworks" + """The packet core has no attached data networks.""" + + class InstallationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The installation state of the packet core.""" - #: The packet core is uninstalled. UNINSTALLED = "Uninstalled" - #: The packet core is installing. + """The packet core is uninstalled.""" INSTALLING = "Installing" - #: The packet core is installed. + """The packet core is installing.""" INSTALLED = "Installed" - #: The packet core is updating its configuration. + """The packet core is installed.""" UPDATING = "Updating" - #: The packet core is upgrading to a different software version. + """The packet core is updating its configuration.""" UPGRADING = "Upgrading" - #: The packet core is uninstalling. + """The packet core is upgrading to a different software version.""" UNINSTALLING = "Uninstalling" - #: The packet core is reinstalling. + """The packet core is uninstalling.""" REINSTALLING = "Reinstalling" - #: The packet core is rolling back to its previous version. + """The packet core is reinstalling.""" ROLLING_BACK = "RollingBack" - #: The packet core is in failed state. + """The packet core is rolling back to its previous version.""" FAILED = "Failed" + """The packet core is in failed state.""" class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity (where both SystemAssigned and UserAssigned types are - allowed). - """ + """Type of managed service identity (currently only UserAssigned allowed).""" NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" class NaptEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether network address and port translation is enabled.""" - #: NAPT is enabled ENABLED = "Enabled" - #: NAPT is disabled + """NAPT is enabled""" DISABLED = "Disabled" + """NAPT is disabled""" class ObsoleteVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether this version is obsolete.""" - #: This version is obsolete for use in new packet core control plane deployments. OBSOLETE = "Obsolete" - #: This version is not obsolete for use in new packet core control plane deployments. + """This version is obsolete for use in new packet core control plane deployments.""" NOT_OBSOLETE = "NotObsolete" + """This version is not obsolete for use in new packet core control plane deployments.""" + + +class PacketCaptureStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the packet capture session.""" + + NOT_STARTED = "NotStarted" + RUNNING = "Running" + STOPPED = "Stopped" + ERROR = "Error" class PduSessionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -131,30 +163,30 @@ class PduSessionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PlatformType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The platform type where packet core is deployed. The contents of this enum can change.""" - #: 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. AKS_HCI = "AKS-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. + """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.""" 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.""" class PreemptionCapability(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Preemption capability.""" - #: Cannot preempt NOT_PREEMPT = "NotPreempt" - #: May preempt + """Cannot preempt""" MAY_PREEMPT = "MayPreempt" + """May preempt""" class PreemptionVulnerability(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Preemption vulnerability.""" - #: Cannot be preempted NOT_PREEMPTABLE = "NotPreemptable" - #: May be preempted + """Cannot be preempted""" PREEMPTABLE = "Preemptable" + """May be preempted""" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -174,72 +206,81 @@ class RecommendedVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): deployments. """ - #: This is the recommended version to use for new packet core control plane deployments. RECOMMENDED = "Recommended" - #: This is not the recommended version to use for new packet core control plane deployments. + """This is the recommended version to use for new packet core control plane deployments.""" NOT_RECOMMENDED = "NotRecommended" + """This is not the recommended version to use for new packet core control plane deployments.""" + + +class ReinstallRequired(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether a reinstall of the packet core is required to pick up the latest configuration changes.""" + + REQUIRED = "Required" + """A reinstall of the packet core is required.""" + NOT_REQUIRED = "NotRequired" + """A reinstall of the packet core is not required.""" class SdfDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Service data flow direction.""" - #: Traffic flowing from the UE to the data network. UPLINK = "Uplink" - #: Traffic flowing from the data network to the UE. + """Traffic flowing from the UE to the data network.""" DOWNLINK = "Downlink" - #: Traffic flowing both to and from the UE. + """Traffic flowing from the data network to the UE.""" BIDIRECTIONAL = "Bidirectional" + """Traffic flowing both to and from the UE.""" class SimState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The state of the SIM resource.""" - #: The SIM is disabled because not all configuration required for enabling is present. DISABLED = "Disabled" - #: The SIM is enabled. + """The SIM is disabled because not all configuration required for enabling is present.""" ENABLED = "Enabled" - #: The SIM cannot be enabled because some of the associated configuration is invalid. + """The SIM is enabled.""" INVALID = "Invalid" + """The SIM cannot be enabled because some of the associated configuration is invalid.""" class SiteProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of a resource e.g. SIM/SIM policy on a site.""" - #: The resource should not be provisioned on this site. NOT_APPLICABLE = "NotApplicable" - #: The resource is being added to this site. + """The resource should not be provisioned on this site.""" ADDING = "Adding" - #: The resource is being updated on this site. + """The resource is being added to this site.""" UPDATING = "Updating" - #: The resource is being deleted from this site. + """The resource is being updated on this site.""" DELETING = "Deleting" - #: The resource is provisioned on this site. + """The resource is being deleted from this site.""" PROVISIONED = "Provisioned" - #: The resource failed to be provisioned on this site. + """The resource is provisioned on this site.""" FAILED = "Failed" + """The resource failed to be provisioned on this site.""" class TrafficControlPermission(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Traffic control permission.""" - #: Traffic matching this rule is allowed to flow. ENABLED = "Enabled" - #: Traffic matching this rule is not allowed to flow. + """Traffic matching this rule is allowed to flow.""" BLOCKED = "Blocked" + """Traffic matching this rule is not allowed to flow.""" class VersionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The state of this packet core control plane version.""" - #: The state of this version is unknown. UNKNOWN = "Unknown" - #: This version is a preview and is not suitable for production use. + """The state of this version is unknown.""" PREVIEW = "Preview" - #: This version is currently being validated. + """This version is a preview and is not suitable for production use.""" VALIDATING = "Validating" - #: This version failed validation. + """This version is currently being validated.""" VALIDATION_FAILED = "ValidationFailed" - #: This version is active and suitable for production use. + """This version failed validation.""" ACTIVE = "Active" - #: This version is deprecated and is no longer supported. + """This version is active and suitable for production use.""" DEPRECATED = "Deprecated" + """This version is deprecated and is no longer supported.""" 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 0f4ee43562ce7..a4b75f661a89f 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 @@ -45,7 +45,7 @@ class Ambr(_serialization.Model): "downlink": {"key": "downlink", "type": "str"}, } - def __init__(self, *, uplink: str, downlink: str, **kwargs): + def __init__(self, *, uplink: str, downlink: str, **kwargs: Any) -> None: """ :keyword uplink: Uplink bit rate. Required. :paramtype uplink: str @@ -90,8 +90,8 @@ def __init__( priority_level: int, preempt_cap: Union[str, "_models.PreemptionCapability"], preempt_vuln: Union[str, "_models.PreemptionVulnerability"], - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword priority_level: ARP priority level. Required. :paramtype priority_level: int @@ -128,7 +128,7 @@ class AsyncOperationId(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Azure Async Operation ID. Required. :paramtype id: str @@ -192,8 +192,8 @@ def __init__( percent_complete: Optional[float] = None, properties: Optional[JSON] = None, error: Optional["_models.ErrorDetail"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Fully qualified ID for the async operation. :paramtype id: str @@ -232,8 +232,8 @@ 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. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -259,7 +259,7 @@ class Resource(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -269,14 +269,15 @@ def __init__(self, **kwargs): class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -309,7 +310,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -322,14 +323,15 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw class AttachedDataNetwork(TrackedResource): # pylint: disable=too-many-instance-attributes - """Attached data network resource. Must be created in the same location as its parent packet core data plane. + """Attached data network resource. Must be created in the same location as its parent packet core + data plane. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -417,8 +419,8 @@ def __init__( napt_configuration: Optional["_models.NaptConfiguration"] = None, user_equipment_address_pool_prefix: Optional[List[str]] = None, user_equipment_static_address_pool_prefix: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -481,7 +483,7 @@ class AttachedDataNetworkListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.AttachedDataNetwork"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.AttachedDataNetwork"]] = None, **kwargs: Any) -> None: """ :keyword value: A list of data networks in a resource group. :paramtype value: list[~azure.mgmt.mobilenetwork.models.AttachedDataNetwork] @@ -511,7 +513,7 @@ class AttachedDataNetworkResourceId(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Attached data network resource ID. Required. :paramtype id: str @@ -540,7 +542,7 @@ class AzureStackEdgeDeviceResourceId(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Azure Stack Edge device resource ID. Required. :paramtype id: str @@ -569,7 +571,7 @@ class AzureStackHCIClusterResourceId(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Azure Stack HCI cluster resource ID. Required. :paramtype id: str @@ -600,7 +602,7 @@ class CertificateProvisioning(_serialization.Model): "reason": {"key": "reason", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.state = None @@ -678,8 +680,8 @@ def __init__( device_type: Optional[str] = None, sim_policy: Optional["_models.SimPolicyResourceId"] = None, static_ip_configuration: Optional[List["_models.SimStaticIpProperties"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword international_mobile_subscriber_identity: The international mobile subscriber identity (IMSI) for the SIM. Required. @@ -732,7 +734,7 @@ class ConnectedClusterResourceId(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Azure Arc connected cluster resource ID. Required. :paramtype id: str @@ -761,7 +763,7 @@ class CustomLocationResourceId(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Azure Arc custom location resource ID. Required. :paramtype id: str @@ -777,8 +779,8 @@ class DataNetwork(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -820,8 +822,8 @@ class DataNetwork(TrackedResource): } def __init__( - self, *, location: str, tags: Optional[Dict[str, str]] = None, description: Optional[str] = None, **kwargs - ): + self, *, location: str, tags: Optional[Dict[str, str]] = None, description: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -847,12 +849,9 @@ class DataNetworkConfiguration(_serialization.Model): session. See 3GPP TS23.501 section 5.7.2.6 for a full description of the Session-AMBR. Required. :vartype session_ambr: ~azure.mgmt.mobilenetwork.models.Ambr - :ivar five_qi: Default QoS Flow 5G QoS Indicator value. The 5QI identifies a specific QoS - forwarding treatment to be provided to a flow. This must not be a standardized 5QI value - corresponding to a GBR (guaranteed bit rate) QoS Flow. The illegal GBR 5QI values are: 1, 2, 3, - 4, 65, 66, 67, 71, 72, 73, 74, 75, 76, 82, 83, 84, and 85. See 3GPP TS23.501 section 5.7.2.1 - for a full description of the 5QI parameter, and table 5.7.4-1 for the definition of which are - the GBR 5QI values. + :ivar five_qi: Default 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 the 5QI parameter, and table 5.7.4-1 for the definition the 5QI values. :vartype five_qi: int :ivar allocation_and_retention_priority_level: Default QoS Flow allocation and retention priority (ARP) level. Flows with higher priority preempt flows with lower priority, if the @@ -925,8 +924,8 @@ def __init__( default_session_type: Optional[Union[str, "_models.PduSessionType"]] = None, additional_allowed_session_types: Optional[List[Union[str, "_models.PduSessionType"]]] = None, maximum_number_of_buffered_packets: int = 10, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword 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. @@ -935,12 +934,9 @@ def __init__( session. See 3GPP TS23.501 section 5.7.2.6 for a full description of the Session-AMBR. Required. :paramtype session_ambr: ~azure.mgmt.mobilenetwork.models.Ambr - :keyword five_qi: Default QoS Flow 5G QoS Indicator value. The 5QI identifies a specific QoS - forwarding treatment to be provided to a flow. This must not be a standardized 5QI value - corresponding to a GBR (guaranteed bit rate) QoS Flow. The illegal GBR 5QI values are: 1, 2, 3, - 4, 65, 66, 67, 71, 72, 73, 74, 75, 76, 82, 83, 84, and 85. See 3GPP TS23.501 section 5.7.2.1 - for a full description of the 5QI parameter, and table 5.7.4-1 for the definition of which are - the GBR 5QI values. + :keyword five_qi: Default 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 the 5QI parameter, and table 5.7.4-1 for the definition the 5QI values. :paramtype five_qi: int :keyword allocation_and_retention_priority_level: Default QoS Flow allocation and retention priority (ARP) level. Flows with higher priority preempt flows with lower priority, if the @@ -1009,7 +1005,7 @@ class DataNetworkListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.DataNetwork"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.DataNetwork"]] = None, **kwargs: Any) -> None: """ :keyword value: A list of data networks. :paramtype value: list[~azure.mgmt.mobilenetwork.models.DataNetwork] @@ -1039,7 +1035,7 @@ class DataNetworkResourceId(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Data network resource ID. Required. :paramtype id: str @@ -1048,6 +1044,157 @@ def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin self.id = id +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + 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}". + :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 + """ + + _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. + + 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}". + :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 provisioning_state: The provisioning state of the diagnostics package resource. Known + values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and + "Deleted". + :vartype provisioning_state: str or ~azure.mgmt.mobilenetwork.models.ProvisioningState + :ivar status: The status of the diagnostics package collection. Known values are: "NotStarted", + "Collecting", "Collected", and "Error". + :vartype status: str or ~azure.mgmt.mobilenetwork.models.DiagnosticsPackageStatus + :ivar reason: The reason for the current state of the diagnostics package collection. + :vartype reason: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "reason": {"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"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + self.status = None + self.reason = None + + +class DiagnosticsPackageListResult(_serialization.Model): + """Response for diagnostics package API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of diagnostics packages under a packet core control plane. + :vartype value: list[~azure.mgmt.mobilenetwork.models.DiagnosticsPackage] + :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": "[DiagnosticsPackage]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.DiagnosticsPackage"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of diagnostics packages under a packet core control plane. + :paramtype value: list[~azure.mgmt.mobilenetwork.models.DiagnosticsPackage] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DiagnosticsUploadConfiguration(_serialization.Model): + """Configuration for uploading packet core diagnostics. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_account_container_url: The Storage Account Container URL to upload diagnostics + to. Required. + :vartype storage_account_container_url: str + """ + + _validation = { + "storage_account_container_url": {"required": True}, + } + + _attribute_map = { + "storage_account_container_url": {"key": "storageAccountContainerUrl", "type": "str"}, + } + + def __init__(self, *, storage_account_container_url: str, **kwargs: Any) -> None: + """ + :keyword storage_account_container_url: The Storage Account Container URL to upload diagnostics + to. Required. + :paramtype storage_account_container_url: str + """ + super().__init__(**kwargs) + self.storage_account_container_url = storage_account_container_url + + class EncryptedSimPropertiesFormat(CommonSimPropertiesFormat): # pylint: disable=too-many-instance-attributes """Encrypted SIM properties. @@ -1124,8 +1271,8 @@ def __init__( sim_policy: Optional["_models.SimPolicyResourceId"] = None, static_ip_configuration: Optional[List["_models.SimStaticIpProperties"]] = None, encrypted_credentials: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword international_mobile_subscriber_identity: The international mobile subscriber identity (IMSI) for the SIM. Required. @@ -1208,8 +1355,8 @@ def __init__( encrypted_transport_key: str, signed_transport_key: str, sims: List["_models.SimNameAndEncryptedProperties"], - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword version: The upload file format version. Required. :paramtype version: int @@ -1258,7 +1405,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -1298,7 +1445,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -1309,7 +1456,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.mobilenetwork.models.ErrorDetail @@ -1319,7 +1467,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.mobilenetwork.models.ErrorDetail @@ -1352,7 +1500,7 @@ class HttpsServerCertificate(_serialization.Model): "provisioning": {"key": "provisioning", "type": "CertificateProvisioning"}, } - def __init__(self, *, certificate_url: str, **kwargs): + def __init__(self, *, certificate_url: str, **kwargs: Any) -> None: """ :keyword certificate_url: The certificate URL, unversioned. For example: https://contosovault.vault.azure.net/certificates/ingress. Required. @@ -1363,38 +1511,87 @@ def __init__(self, *, certificate_url: str, **kwargs): self.provisioning = None +class IdentityAndTagsObject(_serialization.Model): + """Identity and Tags object for patch operations. + + :ivar identity: The managed service identity associated with this resource. + :vartype identity: ~azure.mgmt.mobilenetwork.models.ManagedServiceIdentity + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: The managed service identity associated with this resource. + :paramtype identity: ~azure.mgmt.mobilenetwork.models.ManagedServiceIdentity + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.identity = identity + self.tags = tags + + class Installation(_serialization.Model): """The installation state of the packet core. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar desired_state: The desired installation state. Known values are: "Uninstalled" and + "Installed". + :vartype desired_state: str or ~azure.mgmt.mobilenetwork.models.DesiredInstallationState :ivar state: Installation state. Known values are: "Uninstalled", "Installing", "Installed", "Updating", "Upgrading", "Uninstalling", "Reinstalling", "RollingBack", and "Failed". :vartype state: str or ~azure.mgmt.mobilenetwork.models.InstallationState + :ivar reinstall_required: Whether a reinstall of the packet core is required to pick up the + latest configuration changes. Known values are: "Required" and "NotRequired". + :vartype reinstall_required: str or ~azure.mgmt.mobilenetwork.models.ReinstallRequired + :ivar reasons: Reason(s) for the current installation state of the packet core. + :vartype reasons: list[str or ~azure.mgmt.mobilenetwork.models.InstallationReason] :ivar operation: A reference to an in-progress installation operation. :vartype operation: ~azure.mgmt.mobilenetwork.models.AsyncOperationId """ + _validation = { + "state": {"readonly": True}, + "reinstall_required": {"readonly": True}, + "reasons": {"readonly": True, "unique": True}, + "operation": {"readonly": True}, + } + _attribute_map = { + "desired_state": {"key": "desiredState", "type": "str"}, "state": {"key": "state", "type": "str"}, + "reinstall_required": {"key": "reinstallRequired", "type": "str"}, + "reasons": {"key": "reasons", "type": "[str]"}, "operation": {"key": "operation", "type": "AsyncOperationId"}, } def __init__( - self, - *, - state: Optional[Union[str, "_models.InstallationState"]] = None, - operation: Optional["_models.AsyncOperationId"] = None, - **kwargs - ): + self, *, desired_state: Optional[Union[str, "_models.DesiredInstallationState"]] = None, **kwargs: Any + ) -> None: """ - :keyword state: Installation state. Known values are: "Uninstalled", "Installing", "Installed", - "Updating", "Upgrading", "Uninstalling", "Reinstalling", "RollingBack", and "Failed". - :paramtype state: str or ~azure.mgmt.mobilenetwork.models.InstallationState - :keyword operation: A reference to an in-progress installation operation. - :paramtype operation: ~azure.mgmt.mobilenetwork.models.AsyncOperationId + :keyword desired_state: The desired installation state. Known values are: "Uninstalled" and + "Installed". + :paramtype desired_state: str or ~azure.mgmt.mobilenetwork.models.DesiredInstallationState """ super().__init__(**kwargs) - self.state = state - self.operation = operation + self.desired_state = desired_state + self.state = None + self.reinstall_required = None + self.reasons = None + self.operation = None class InterfaceProperties(_serialization.Model): @@ -1437,8 +1634,8 @@ def __init__( ipv4_address: Optional[str] = None, ipv4_subnet: Optional[str] = None, ipv4_gateway: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The logical name for this interface. This should match one of the interfaces configured on your Azure Stack Edge device. @@ -1469,7 +1666,7 @@ class KeyVaultKey(_serialization.Model): "key_url": {"key": "keyUrl", "type": "str"}, } - def __init__(self, *, key_url: Optional[str] = None, **kwargs): + def __init__(self, *, key_url: Optional[str] = None, **kwargs: Any) -> None: """ :keyword key_url: The key URL, unversioned. For example: https://contosovault.vault.azure.net/keys/azureKey. @@ -1480,7 +1677,8 @@ def __init__(self, *, key_url: Optional[str] = None, **kwargs): class LocalDiagnosticsAccessConfiguration(_serialization.Model): - """The kubernetes ingress configuration to control access to packet core diagnostics over local APIs. + """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. @@ -1506,8 +1704,8 @@ def __init__( *, authentication_type: Union[str, "_models.AuthenticationType"], https_server_certificate: Optional["_models.HttpsServerCertificate"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword authentication_type: How to authenticate users who access local diagnostics APIs. Required. Known values are: "AAD" and "Password". @@ -1522,21 +1720,12 @@ def __init__( class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - Variables are only populated by the server, and will be ignored when sending a request. + """Managed service identity (User assigned identity). All required parameters must be populated in order to send to Azure. - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". + :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: @@ -1547,14 +1736,10 @@ class ManagedServiceIdentity(_serialization.Model): """ _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, "type": {"required": True}, } _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, "type": {"key": "type", "type": "str"}, "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, } @@ -1564,12 +1749,11 @@ def __init__( *, type: Union[str, "_models.ManagedServiceIdentityType"], user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". + :keyword type: Type of managed service identity (currently only UserAssigned allowed). + Required. Known values are: "None" and "UserAssigned". :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: @@ -1579,8 +1763,6 @@ def __init__( ~azure.mgmt.mobilenetwork.models.UserAssignedIdentity] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1592,8 +1774,8 @@ class MobileNetwork(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1651,8 +1833,8 @@ def __init__( location: str, public_land_mobile_network_identifier: "_models.PlmnId", tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1691,7 +1873,7 @@ class MobileNetworkListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.MobileNetwork"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.MobileNetwork"]] = None, **kwargs: Any) -> None: """ :keyword value: A list of mobile networks in a resource group. :paramtype value: list[~azure.mgmt.mobilenetwork.models.MobileNetwork] @@ -1721,7 +1903,7 @@ class MobileNetworkResourceId(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Mobile network resource ID. Required. :paramtype id: str @@ -1774,8 +1956,8 @@ def __init__( port_reuse_hold_time: Optional["_models.PortReuseHoldTimes"] = None, pinhole_limits: int = 65536, pinhole_timeouts: Optional["_models.PinholeTimeouts"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Whether NAPT is enabled for connections to this attached data network. Known values are: "Enabled" and "Disabled". @@ -1830,7 +2012,7 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, is_data_action: Optional[bool] = None, **kwargs): + def __init__(self, *, is_data_action: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword is_data_action: Indicates whether the operation applies to data-plane. :paramtype is_data_action: bool @@ -1869,8 +2051,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Service provider: Microsoft.MobileNetwork. :paramtype provider: str @@ -1910,13 +2092,142 @@ class OperationList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None +class PacketCapture(ProxyResource): # pylint: disable=too-many-instance-attributes + """Packet capture session 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}". + :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 provisioning_state: The provisioning state of the packet capture session resource. Known + values are: "Unknown", "Succeeded", "Accepted", "Deleting", "Failed", "Canceled", and + "Deleted". + :vartype provisioning_state: str or ~azure.mgmt.mobilenetwork.models.ProvisioningState + :ivar status: The status of the packet capture session. Known values are: "NotStarted", + "Running", "Stopped", and "Error". + :vartype status: str or ~azure.mgmt.mobilenetwork.models.PacketCaptureStatus + :ivar reason: The reason the current packet capture session state. + :vartype reason: str + :ivar capture_start_time: The start time of the packet capture session. + :vartype capture_start_time: ~datetime.datetime + :ivar network_interfaces: List of network interfaces to capture on. + :vartype network_interfaces: list[str] + :ivar bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes are + truncated. The default "0" means the entire packet is captured. + :vartype bytes_to_capture_per_packet: int + :ivar total_bytes_per_session: Maximum size of the capture output. + :vartype total_bytes_per_session: int + :ivar time_limit_in_seconds: Maximum duration of the capture session in seconds. + :vartype time_limit_in_seconds: int + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status": {"readonly": True}, + "reason": {"readonly": True}, + "capture_start_time": {"readonly": True}, + "network_interfaces": {"min_items": 1, "unique": True}, + "bytes_to_capture_per_packet": {"maximum": 4294967295, "minimum": 0}, + "total_bytes_per_session": {"maximum": 4294967295, "minimum": 0}, + "time_limit_in_seconds": {"maximum": 18000, "minimum": 0}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "reason": {"key": "properties.reason", "type": "str"}, + "capture_start_time": {"key": "properties.captureStartTime", "type": "iso-8601"}, + "network_interfaces": {"key": "properties.networkInterfaces", "type": "[str]"}, + "bytes_to_capture_per_packet": {"key": "properties.bytesToCapturePerPacket", "type": "int"}, + "total_bytes_per_session": {"key": "properties.totalBytesPerSession", "type": "int"}, + "time_limit_in_seconds": {"key": "properties.timeLimitInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + network_interfaces: Optional[List[str]] = None, + bytes_to_capture_per_packet: int = 0, + total_bytes_per_session: int = 67108864, + time_limit_in_seconds: int = 18000, + **kwargs: Any + ) -> None: + """ + :keyword network_interfaces: List of network interfaces to capture on. + :paramtype network_interfaces: list[str] + :keyword bytes_to_capture_per_packet: Number of bytes captured per packet, the remaining bytes + are truncated. The default "0" means the entire packet is captured. + :paramtype bytes_to_capture_per_packet: int + :keyword total_bytes_per_session: Maximum size of the capture output. + :paramtype total_bytes_per_session: int + :keyword time_limit_in_seconds: Maximum duration of the capture session in seconds. + :paramtype time_limit_in_seconds: int + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.status = None + self.reason = None + self.capture_start_time = None + self.network_interfaces = network_interfaces + self.bytes_to_capture_per_packet = bytes_to_capture_per_packet + self.total_bytes_per_session = total_bytes_per_session + self.time_limit_in_seconds = time_limit_in_seconds + + +class PacketCaptureListResult(_serialization.Model): + """Response for packet capture API service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of packet capture sessions under a packet core control plane. + :vartype value: list[~azure.mgmt.mobilenetwork.models.PacketCapture] + :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": "[PacketCapture]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.PacketCapture"]] = None, **kwargs: Any) -> None: + """ + :keyword value: A list of packet capture sessions under a packet core control plane. + :paramtype value: list[~azure.mgmt.mobilenetwork.models.PacketCapture] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + class PacketCoreControlPlane(TrackedResource): # pylint: disable=too-many-instance-attributes """Packet core control plane resource. @@ -1924,8 +2235,8 @@ class PacketCoreControlPlane(TrackedResource): # pylint: disable=too-many-insta All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1953,10 +2264,12 @@ class PacketCoreControlPlane(TrackedResource): # pylint: disable=too-many-insta :ivar platform: The platform where the packet core is deployed. Required. :vartype platform: ~azure.mgmt.mobilenetwork.models.PlatformConfiguration :ivar core_network_technology: The core network technology generation (5G core or EPC / 4G - core). Known values are: "5GC" and "EPC". + core). Known values are: "5GC", "EPC", and "EPC + 5GC". :vartype core_network_technology: str or ~azure.mgmt.mobilenetwork.models.CoreNetworkType - :ivar version: The version of the packet core software that is deployed. + :ivar version: The desired version of the packet core software. :vartype version: str + :ivar installed_version: The currently installed version of the packet core software. + :vartype installed_version: str :ivar rollback_version: The previous version of the packet core software that was deployed. Used when performing the rollback action. :vartype rollback_version: str @@ -1964,7 +2277,7 @@ class PacketCoreControlPlane(TrackedResource): # pylint: disable=too-many-insta networks, this is the N2 interface. For 4G networks, this is the S1-MME interface. Required. :vartype control_plane_access_interface: ~azure.mgmt.mobilenetwork.models.InterfaceProperties :ivar sku: The SKU defining the throughput and SIM allowances for this packet core control - plane deployment. Required. Known values are: "G0", "G1", "G2", "G3", "G4", "G5", and "G10". + plane deployment. Required. Known values are: "G0", "G1", "G2", "G5", and "G10". :vartype sku: str or ~azure.mgmt.mobilenetwork.models.BillingSku :ivar ue_mtu: The MTU (in bytes) signaled to the UE. The same MTU is set on the user plane data links for all data networks. The MTU set on the user plane access link is calculated to be 60 @@ -1974,6 +2287,8 @@ class PacketCoreControlPlane(TrackedResource): # pylint: disable=too-many-insta packet core diagnostics over local APIs. Required. :vartype local_diagnostics_access: ~azure.mgmt.mobilenetwork.models.LocalDiagnosticsAccessConfiguration + :ivar diagnostics_upload: Configuration for uploading packet core diagnostics. + :vartype diagnostics_upload: ~azure.mgmt.mobilenetwork.models.DiagnosticsUploadConfiguration :ivar interop_settings: Settings to allow interoperability with third party components e.g. RANs and UEs. :vartype interop_settings: JSON @@ -1986,9 +2301,9 @@ class PacketCoreControlPlane(TrackedResource): # pylint: disable=too-many-insta "system_data": {"readonly": True}, "location": {"required": True}, "provisioning_state": {"readonly": True}, - "installation": {"readonly": True}, "sites": {"required": True, "min_items": 1, "unique": True}, "platform": {"required": True}, + "installed_version": {"readonly": True}, "rollback_version": {"readonly": True}, "control_plane_access_interface": {"required": True}, "sku": {"required": True}, @@ -2010,6 +2325,7 @@ class PacketCoreControlPlane(TrackedResource): # pylint: disable=too-many-insta "platform": {"key": "properties.platform", "type": "PlatformConfiguration"}, "core_network_technology": {"key": "properties.coreNetworkTechnology", "type": "str"}, "version": {"key": "properties.version", "type": "str"}, + "installed_version": {"key": "properties.installedVersion", "type": "str"}, "rollback_version": {"key": "properties.rollbackVersion", "type": "str"}, "control_plane_access_interface": { "key": "properties.controlPlaneAccessInterface", @@ -2021,6 +2337,7 @@ class PacketCoreControlPlane(TrackedResource): # pylint: disable=too-many-insta "key": "properties.localDiagnosticsAccess", "type": "LocalDiagnosticsAccessConfiguration", }, + "diagnostics_upload": {"key": "properties.diagnosticsUpload", "type": "DiagnosticsUploadConfiguration"}, "interop_settings": {"key": "properties.interopSettings", "type": "object"}, } @@ -2035,12 +2352,14 @@ def __init__( local_diagnostics_access: "_models.LocalDiagnosticsAccessConfiguration", tags: Optional[Dict[str, str]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, + installation: Optional["_models.Installation"] = None, core_network_technology: Union[str, "_models.CoreNetworkType"] = "5GC", version: Optional[str] = None, ue_mtu: int = 1440, + diagnostics_upload: Optional["_models.DiagnosticsUploadConfiguration"] = None, interop_settings: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2048,21 +2367,23 @@ def __init__( :paramtype location: str :keyword identity: The identity used to retrieve the ingress certificate from Azure key vault. :paramtype identity: ~azure.mgmt.mobilenetwork.models.ManagedServiceIdentity + :keyword installation: The installation state of the packet core control plane resource. + :paramtype installation: ~azure.mgmt.mobilenetwork.models.Installation :keyword sites: Site(s) under which this packet core control plane should be deployed. The sites must be in the same location as the packet core control plane. Required. :paramtype sites: list[~azure.mgmt.mobilenetwork.models.SiteResourceId] :keyword platform: The platform where the packet core is deployed. Required. :paramtype platform: ~azure.mgmt.mobilenetwork.models.PlatformConfiguration :keyword core_network_technology: The core network technology generation (5G core or EPC / 4G - core). Known values are: "5GC" and "EPC". + core). Known values are: "5GC", "EPC", and "EPC + 5GC". :paramtype core_network_technology: str or ~azure.mgmt.mobilenetwork.models.CoreNetworkType - :keyword version: The version of the packet core software that is deployed. + :keyword version: The desired version of the packet core software. :paramtype version: str :keyword control_plane_access_interface: The control plane interface on the access network. For 5G networks, this is the N2 interface. For 4G networks, this is the S1-MME interface. Required. :paramtype control_plane_access_interface: ~azure.mgmt.mobilenetwork.models.InterfaceProperties :keyword sku: The SKU defining the throughput and SIM allowances for this packet core control - plane deployment. Required. Known values are: "G0", "G1", "G2", "G3", "G4", "G5", and "G10". + plane deployment. Required. Known values are: "G0", "G1", "G2", "G5", and "G10". :paramtype sku: str or ~azure.mgmt.mobilenetwork.models.BillingSku :keyword ue_mtu: The MTU (in bytes) signaled to the UE. The same MTU is set on the user plane data links for all data networks. The MTU set on the user plane access link is calculated to be @@ -2072,6 +2393,8 @@ def __init__( packet core diagnostics over local APIs. Required. :paramtype local_diagnostics_access: ~azure.mgmt.mobilenetwork.models.LocalDiagnosticsAccessConfiguration + :keyword diagnostics_upload: Configuration for uploading packet core diagnostics. + :paramtype diagnostics_upload: ~azure.mgmt.mobilenetwork.models.DiagnosticsUploadConfiguration :keyword interop_settings: Settings to allow interoperability with third party components e.g. RANs and UEs. :paramtype interop_settings: JSON @@ -2079,16 +2402,18 @@ def __init__( super().__init__(tags=tags, location=location, **kwargs) self.identity = identity self.provisioning_state = None - self.installation = None + self.installation = installation self.sites = sites self.platform = platform self.core_network_technology = core_network_technology self.version = version + self.installed_version = None self.rollback_version = None self.control_plane_access_interface = control_plane_access_interface self.sku = sku self.ue_mtu = ue_mtu self.local_diagnostics_access = local_diagnostics_access + self.diagnostics_upload = diagnostics_upload self.interop_settings = interop_settings @@ -2110,7 +2435,7 @@ class PacketCoreControlPlaneCollectDiagnosticsPackage(_serialization.Model): "storage_account_blob_url": {"key": "storageAccountBlobUrl", "type": "str"}, } - def __init__(self, *, storage_account_blob_url: str, **kwargs): + def __init__(self, *, storage_account_blob_url: str, **kwargs: Any) -> None: """ :keyword storage_account_blob_url: The Storage Account Blob URL to upload the diagnostics package to. Required. @@ -2140,7 +2465,7 @@ class PacketCoreControlPlaneListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.PacketCoreControlPlane"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PacketCoreControlPlane"]] = None, **kwargs: Any) -> None: """ :keyword value: A list of packet core control planes in a resource group. :paramtype value: list[~azure.mgmt.mobilenetwork.models.PacketCoreControlPlane] @@ -2150,41 +2475,33 @@ def __init__(self, *, value: Optional[List["_models.PacketCoreControlPlane"]] = self.next_link = None -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. +class PacketCoreControlPlaneResourceId(_serialization.Model): + """Reference to an packet core control plane 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. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Packet core control plane resource ID. Required. :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 """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, + "id": { + "required": True, + "pattern": r"^/[sS][uU][bB][sS][cC][rR][iI][pP][tT][iI][oO][nN][sS]/[^/?#]+/[rR][eE][sS][oO][uU][rR][cC][eE][gG][rR][oO][uU][pP][sS]/[^/?#]+/[pP][rR][oO][vV][iI][dD][eE][rR][sS]/[mM][iI][cC][rR][oO][sS][oO][fF][tT]\.[mM][oO][bB][iI][lL][eE][nN][eE][tT][wW][oO][rR][kK]/[pP][aA][cC][kK][eE][tT][cC][oO][rR][eE][cC][oO][nN][tT][rR][oO][lL][pP][lL][aA][nN][eE][sS]/[^/?#]+$", + }, } _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): - """ """ + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Packet core control plane resource ID. Required. + :paramtype id: str + """ super().__init__(**kwargs) + self.id = id class PacketCoreControlPlaneVersion(ProxyResource): @@ -2192,8 +2509,8 @@ 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. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2228,7 +2545,7 @@ class PacketCoreControlPlaneVersion(ProxyResource): "platforms": {"key": "properties.platforms", "type": "[Platform]"}, } - def __init__(self, *, platforms: Optional[List["_models.Platform"]] = None, **kwargs): + def __init__(self, *, platforms: Optional[List["_models.Platform"]] = None, **kwargs: Any) -> None: """ :keyword platforms: Platform specific packet core control plane version properties. :paramtype platforms: list[~azure.mgmt.mobilenetwork.models.Platform] @@ -2258,7 +2575,7 @@ class PacketCoreControlPlaneVersionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.PacketCoreControlPlaneVersion"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PacketCoreControlPlaneVersion"]] = None, **kwargs: Any) -> None: """ :keyword value: A list of supported packet core control plane versions. :paramtype value: list[~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneVersion] @@ -2269,14 +2586,15 @@ def __init__(self, *, value: Optional[List["_models.PacketCoreControlPlaneVersio class PacketCoreDataPlane(TrackedResource): - """Packet core data plane resource. Must be created in the same location as its parent packet core control plane. + """Packet core data plane resource. Must be created in the same location as its parent packet core + control plane. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2326,8 +2644,8 @@ def __init__( location: str, user_plane_access_interface: "_models.InterfaceProperties", tags: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2362,7 +2680,7 @@ class PacketCoreDataPlaneListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.PacketCoreDataPlane"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PacketCoreDataPlane"]] = None, **kwargs: Any) -> None: """ :keyword value: A list of packet core data planes in a resource group. :paramtype value: list[~azure.mgmt.mobilenetwork.models.PacketCoreDataPlane] @@ -2405,7 +2723,7 @@ class PccRuleConfiguration(_serialization.Model): "pattern": r"^(?!(default|requested|service)$)[a-zA-Z0-9][a-zA-Z0-9_-]*$", }, "rule_precedence": {"required": True, "maximum": 255, "minimum": 0}, - "service_data_flow_templates": {"required": True, "min_items": 1, "unique": True}, + "service_data_flow_templates": {"required": True, "max_items": 15, "min_items": 1, "unique": True}, } _attribute_map = { @@ -2424,8 +2742,8 @@ def __init__( service_data_flow_templates: List["_models.ServiceDataFlowTemplate"], rule_qos_policy: Optional["_models.PccRuleQosPolicy"] = None, traffic_control: Optional[Union[str, "_models.TrafficControlPermission"]] = None, - **kwargs - ): + **kwargs: Any + ) -> 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 @@ -2460,12 +2778,9 @@ class QosPolicy(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar five_qi: QoS Flow 5G QoS Indicator value. The 5QI identifies a specific QoS forwarding - treatment to be provided to a flow. This must not be a standardized 5QI value corresponding to - a GBR (guaranteed bit rate) QoS Flow. The illegal GBR 5QI values are: 1, 2, 3, 4, 65, 66, 67, - 71, 72, 73, 74, 75, 76, 82, 83, 84, and 85. See 3GPP TS23.501 section 5.7.2.1 for a full - description of the 5QI parameter, and table 5.7.4-1 for the definition of which are the GBR 5QI - values. + :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 + the 5QI parameter, and table 5.7.4-1 for the definition the 5QI values. :vartype five_qi: int :ivar allocation_and_retention_priority_level: QoS Flow allocation and retention priority (ARP) level. Flows with higher priority preempt flows with lower priority, if the settings of @@ -2511,15 +2826,12 @@ def __init__( allocation_and_retention_priority_level: Optional[int] = None, preemption_capability: Optional[Union[str, "_models.PreemptionCapability"]] = None, preemption_vulnerability: Optional[Union[str, "_models.PreemptionVulnerability"]] = None, - **kwargs - ): - """ - :keyword five_qi: QoS Flow 5G QoS Indicator value. The 5QI identifies a specific QoS forwarding - treatment to be provided to a flow. This must not be a standardized 5QI value corresponding to - a GBR (guaranteed bit rate) QoS Flow. The illegal GBR 5QI values are: 1, 2, 3, 4, 65, 66, 67, - 71, 72, 73, 74, 75, 76, 82, 83, 84, and 85. See 3GPP TS23.501 section 5.7.2.1 for a full - description of the 5QI parameter, and table 5.7.4-1 for the definition of which are the GBR 5QI - values. + **kwargs: Any + ) -> None: + """ + :keyword 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 + the 5QI parameter, and table 5.7.4-1 for the definition the 5QI values. :paramtype five_qi: int :keyword allocation_and_retention_priority_level: QoS Flow allocation and retention priority (ARP) level. Flows with higher priority preempt flows with lower priority, if the settings of @@ -2555,12 +2867,9 @@ class PccRuleQosPolicy(QosPolicy): All required parameters must be populated in order to send to Azure. - :ivar five_qi: QoS Flow 5G QoS Indicator value. The 5QI identifies a specific QoS forwarding - treatment to be provided to a flow. This must not be a standardized 5QI value corresponding to - a GBR (guaranteed bit rate) QoS Flow. The illegal GBR 5QI values are: 1, 2, 3, 4, 65, 66, 67, - 71, 72, 73, 74, 75, 76, 82, 83, 84, and 85. See 3GPP TS23.501 section 5.7.2.1 for a full - description of the 5QI parameter, and table 5.7.4-1 for the definition of which are the GBR 5QI - values. + :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 + the 5QI parameter, and table 5.7.4-1 for the definition the 5QI values. :vartype five_qi: int :ivar allocation_and_retention_priority_level: QoS Flow allocation and retention priority (ARP) level. Flows with higher priority preempt flows with lower priority, if the settings of @@ -2612,15 +2921,12 @@ def __init__( preemption_capability: Optional[Union[str, "_models.PreemptionCapability"]] = None, preemption_vulnerability: Optional[Union[str, "_models.PreemptionVulnerability"]] = None, guaranteed_bit_rate: Optional["_models.Ambr"] = None, - **kwargs - ): - """ - :keyword five_qi: QoS Flow 5G QoS Indicator value. The 5QI identifies a specific QoS forwarding - treatment to be provided to a flow. This must not be a standardized 5QI value corresponding to - a GBR (guaranteed bit rate) QoS Flow. The illegal GBR 5QI values are: 1, 2, 3, 4, 65, 66, 67, - 71, 72, 73, 74, 75, 76, 82, 83, 84, and 85. See 3GPP TS23.501 section 5.7.2.1 for a full - description of the 5QI parameter, and table 5.7.4-1 for the definition of which are the GBR 5QI - values. + **kwargs: Any + ) -> None: + """ + :keyword 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 + the 5QI parameter, and table 5.7.4-1 for the definition the 5QI values. :paramtype five_qi: int :keyword allocation_and_retention_priority_level: QoS Flow allocation and retention priority (ARP) level. Flows with higher priority preempt flows with lower priority, if the settings of @@ -2681,7 +2987,7 @@ class PinholeTimeouts(_serialization.Model): "icmp": {"key": "icmp", "type": "int"}, } - def __init__(self, *, tcp: int = 180, udp: int = 30, icmp: int = 30, **kwargs): + def __init__(self, *, tcp: int = 180, udp: int = 30, icmp: int = 30, **kwargs: Any) -> None: """ :keyword tcp: Pinhole timeout for TCP pinholes in seconds. Default for TCP is 3 minutes. :paramtype tcp: int @@ -2739,8 +3045,8 @@ 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, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword platform_type: The platform type where this version can be deployed. Known values are: "AKS-HCI" and "3P-AZURE-STACK-HCI". @@ -2820,8 +3126,8 @@ def __init__( azure_stack_hci_cluster: Optional["_models.AzureStackHCIClusterResourceId"] = None, connected_cluster: Optional["_models.ConnectedClusterResourceId"] = None, custom_location: Optional["_models.CustomLocationResourceId"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The platform type where packet core is deployed. Required. Known values are: "AKS-HCI" and "3P-AZURE-STACK-HCI". @@ -2870,7 +3176,7 @@ class PlmnId(_serialization.Model): "mnc": {"key": "mnc", "type": "str"}, } - def __init__(self, *, mcc: str, mnc: str, **kwargs): + def __init__(self, *, mcc: str, mnc: str, **kwargs: Any) -> None: """ :keyword mcc: Mobile country code (MCC). Required. :paramtype mcc: str @@ -2885,12 +3191,13 @@ def __init__(self, *, mcc: str, mnc: str, **kwargs): class PortRange(_serialization.Model): """Range of port numbers to use as translated ports on each translated address. If not specified and NAPT is enabled, this range defaults to 1,024 - 49,999. - (Ports under 1,024 should not be used because these are special purpose ports reserved by IANA. Ports 50,000 and above are reserved for non-NAPT use.). + (Ports under 1,024 should not be used because these are special purpose ports reserved by IANA. + Ports 50,000 and above are reserved for non-NAPT use.). - :ivar min_port: The minimum port number. - :vartype min_port: int - :ivar max_port: The maximum port number. - :vartype max_port: int + :ivar min_port: The minimum port number. + :vartype min_port: int + :ivar max_port: The maximum port number. + :vartype max_port: int """ _validation = { @@ -2903,7 +3210,7 @@ class PortRange(_serialization.Model): "max_port": {"key": "maxPort", "type": "int"}, } - def __init__(self, *, min_port: int = 1024, max_port: int = 49999, **kwargs): + def __init__(self, *, min_port: int = 1024, max_port: int = 49999, **kwargs: Any) -> None: """ :keyword min_port: The minimum port number. :paramtype min_port: int @@ -2916,7 +3223,8 @@ def __init__(self, *, min_port: int = 1024, max_port: int = 49999, **kwargs): class PortReuseHoldTimes(_serialization.Model): - """The minimum time (in seconds) that will pass before a port that was used by a closed pinhole can be recycled for use by another pinhole. All hold times must be minimum 1 second. + """The minimum time (in seconds) that will pass before a port that was used by a closed pinhole + can be recycled for use by another pinhole. All hold times must be minimum 1 second. :ivar tcp: Minimum time in seconds that will pass before a TCP port that was used by a closed pinhole can be reused. Default for TCP is 2 minutes. @@ -2936,7 +3244,7 @@ class PortReuseHoldTimes(_serialization.Model): "udp": {"key": "udp", "type": "int"}, } - def __init__(self, *, tcp: int = 120, udp: int = 60, **kwargs): + def __init__(self, *, tcp: int = 120, udp: int = 60, **kwargs: Any) -> None: """ :keyword tcp: Minimum time in seconds that will pass before a TCP port that was used by a closed pinhole can be reused. Default for TCP is 2 minutes. @@ -2957,8 +3265,8 @@ class Service(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3019,8 +3327,8 @@ def __init__( pcc_rules: List["_models.PccRuleConfiguration"], tags: Optional[Dict[str, str]] = None, service_qos_policy: Optional["_models.QosPolicy"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3106,8 +3414,8 @@ def __init__( protocol: List[str], remote_ip_list: List[str], ports: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :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 - @@ -3166,7 +3474,7 @@ class ServiceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Service"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Service"]] = None, **kwargs: Any) -> None: """ :keyword value: A list of services. :paramtype value: list[~azure.mgmt.mobilenetwork.models.Service] @@ -3196,7 +3504,7 @@ class ServiceResourceId(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Service resource ID. Required. :paramtype id: str @@ -3212,8 +3520,8 @@ class Sim(ProxyResource): # pylint: disable=too-many-instance-attributes All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3308,8 +3616,8 @@ def __init__( static_ip_configuration: Optional[List["_models.SimStaticIpProperties"]] = None, authentication_key: Optional[str] = None, operator_key_code: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword international_mobile_subscriber_identity: The international mobile subscriber identity (IMSI) for the SIM. Required. @@ -3365,7 +3673,7 @@ class SimDeleteList(_serialization.Model): "sims": {"key": "sims", "type": "[str]"}, } - def __init__(self, *, sims: List[str], **kwargs): + def __init__(self, *, sims: List[str], **kwargs: Any) -> None: """ :keyword sims: A list of SIM resource names to delete. Required. :paramtype sims: list[str] @@ -3381,8 +3689,8 @@ class SimGroup(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3438,8 +3746,8 @@ def __init__( identity: Optional["_models.ManagedServiceIdentity"] = None, encryption_key: Optional["_models.KeyVaultKey"] = None, mobile_network: Optional["_models.MobileNetworkResourceId"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3480,7 +3788,7 @@ class SimGroupListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SimGroup"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.SimGroup"]] = None, **kwargs: Any) -> None: """ :keyword value: A list of SIM groups in a resource group. :paramtype value: list[~azure.mgmt.mobilenetwork.models.SimGroup] @@ -3510,7 +3818,7 @@ class SimGroupResourceId(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: SIM group resource ID. Required. :paramtype id: str @@ -3539,7 +3847,7 @@ class SimListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Sim"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Sim"]] = None, **kwargs: Any) -> None: """ :keyword value: A list of SIMs in a resource group. :paramtype value: list[~azure.mgmt.mobilenetwork.models.Sim] @@ -3633,8 +3941,8 @@ def __init__( sim_policy: Optional["_models.SimPolicyResourceId"] = None, static_ip_configuration: Optional[List["_models.SimStaticIpProperties"]] = None, encrypted_credentials: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the SIM. Required. :paramtype name: str @@ -3762,8 +4070,8 @@ def __init__( static_ip_configuration: Optional[List["_models.SimStaticIpProperties"]] = None, authentication_key: Optional[str] = None, operator_key_code: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the SIM. Required. :paramtype name: str @@ -3812,8 +4120,8 @@ class SimPolicy(TrackedResource): # pylint: disable=too-many-instance-attribute All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3844,8 +4152,8 @@ class SimPolicy(TrackedResource): # pylint: disable=too-many-instance-attribute :ivar rfsp_index: RAT/Frequency Selection Priority Index, defined in 3GPP TS 36.413. This is an optional setting and by default is unspecified. :vartype rfsp_index: int - :ivar registration_timer: Interval for the UE periodic registration update procedure, in - seconds. + :ivar registration_timer: UE periodic registration update timer (5G) or UE periodic tracking + area update timer (4G), in seconds. :vartype registration_timer: int :ivar slice_configurations: The allowed slices and the settings to use for them. The list must not contain duplicate items and must contain at least one item. Required. @@ -3893,8 +4201,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, rfsp_index: Optional[int] = None, registration_timer: int = 3240, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3911,8 +4219,8 @@ def __init__( :keyword rfsp_index: RAT/Frequency Selection Priority Index, defined in 3GPP TS 36.413. This is an optional setting and by default is unspecified. :paramtype rfsp_index: int - :keyword registration_timer: Interval for the UE periodic registration update procedure, in - seconds. + :keyword registration_timer: UE periodic registration update timer (5G) or UE periodic tracking + area update timer (4G), in seconds. :paramtype registration_timer: int :keyword slice_configurations: The allowed slices and the settings to use for them. The list must not contain duplicate items and must contain at least one item. Required. @@ -3948,7 +4256,7 @@ class SimPolicyListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.SimPolicy"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.SimPolicy"]] = None, **kwargs: Any) -> None: """ :keyword value: A list of SIM policies. :paramtype value: list[~azure.mgmt.mobilenetwork.models.SimPolicy] @@ -3978,7 +4286,7 @@ class SimPolicyResourceId(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: SIM policy resource ID. Required. :paramtype id: str @@ -4068,8 +4376,8 @@ def __init__( static_ip_configuration: Optional[List["_models.SimStaticIpProperties"]] = None, authentication_key: Optional[str] = None, operator_key_code: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword international_mobile_subscriber_identity: The international mobile subscriber identity (IMSI) for the SIM. Required. @@ -4132,8 +4440,8 @@ def __init__( attached_data_network: Optional["_models.AttachedDataNetworkResourceId"] = None, slice: Optional["_models.SliceResourceId"] = None, static_ip: Optional["_models.SimStaticIpPropertiesStaticIp"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword attached_data_network: The attached data network on which the static IP address will be used. The combination of attached data network and slice defines the network scope of the IP @@ -4172,7 +4480,7 @@ class SimStaticIpPropertiesStaticIp(_serialization.Model): "ipv4_address": {"key": "ipv4Address", "type": "str"}, } - def __init__(self, *, ipv4_address: Optional[str] = None, **kwargs): + def __init__(self, *, ipv4_address: Optional[str] = None, **kwargs: Any) -> None: """ :keyword ipv4_address: The IPv4 address assigned to the SIM at this network scope. This address must be in the userEquipmentStaticAddressPoolPrefix defined in the attached data network. @@ -4199,7 +4507,7 @@ class SimUploadList(_serialization.Model): "sims": {"key": "sims", "type": "[SimNameAndProperties]"}, } - def __init__(self, *, sims: List["_models.SimNameAndProperties"], **kwargs): + def __init__(self, *, sims: List["_models.SimNameAndProperties"], **kwargs: Any) -> None: """ :keyword sims: A list of SIMs to upload. Required. :paramtype sims: list[~azure.mgmt.mobilenetwork.models.SimNameAndProperties] @@ -4215,8 +4523,8 @@ class Site(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4259,7 +4567,7 @@ class Site(TrackedResource): "network_functions": {"key": "properties.networkFunctions", "type": "[SubResource]"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -4271,6 +4579,28 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.network_functions = None +class SiteDeletePacketCore(_serialization.Model): + """The packet core to delete under a site. + + :ivar packet_core: Reference to an packet core control plane resource. + :vartype packet_core: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneResourceId + """ + + _attribute_map = { + "packet_core": {"key": "packetCore", "type": "PacketCoreControlPlaneResourceId"}, + } + + def __init__( + self, *, packet_core: Optional["_models.PacketCoreControlPlaneResourceId"] = None, **kwargs: Any + ) -> None: + """ + :keyword packet_core: Reference to an packet core control plane resource. + :paramtype packet_core: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneResourceId + """ + super().__init__(**kwargs) + self.packet_core = packet_core + + class SiteListResult(_serialization.Model): """Response for sites API service call. @@ -4291,7 +4621,7 @@ class SiteListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Site"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Site"]] = None, **kwargs: Any) -> None: """ :keyword value: A list of sites in a mobile network. :paramtype value: list[~azure.mgmt.mobilenetwork.models.Site] @@ -4321,7 +4651,7 @@ class SiteResourceId(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Site resource ID. Required. :paramtype id: str @@ -4337,8 +4667,8 @@ class Slice(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4391,8 +4721,8 @@ def __init__( snssai: "_models.Snssai", tags: Optional[Dict[str, str]] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -4446,8 +4776,8 @@ def __init__( slice: "_models.SliceResourceId", default_data_network: "_models.DataNetworkResourceId", data_network_configurations: List["_models.DataNetworkConfiguration"], - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword slice: A reference to the slice that these settings apply to. The slice must be in the same location as the SIM policy. Required. @@ -4487,7 +4817,7 @@ class SliceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Slice"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Slice"]] = None, **kwargs: Any) -> None: """ :keyword value: A list of network slices in a mobile network. :paramtype value: list[~azure.mgmt.mobilenetwork.models.Slice] @@ -4517,7 +4847,7 @@ class SliceResourceId(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Slice resource ID. Required. :paramtype id: str @@ -4547,7 +4877,7 @@ class Snssai(_serialization.Model): "sd": {"key": "sd", "type": "str"}, } - def __init__(self, *, sst: int, sd: Optional[str] = None, **kwargs): + def __init__(self, *, sst: int, sd: Optional[str] = None, **kwargs: Any) -> None: """ :keyword sst: Slice/service type (SST). Required. :paramtype sst: int @@ -4576,7 +4906,7 @@ class SubResource(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, id: str, **kwargs): # pylint: disable=redefined-builtin + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ :keyword id: Resource ID. Required. :paramtype id: str @@ -4622,8 +4952,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -4660,7 +4990,7 @@ class TagsObject(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -4690,7 +5020,7 @@ class UserAssignedIdentity(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None 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 072372a6f784e..2f03dce83d9ed 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 @@ -8,8 +8,10 @@ from ._attached_data_networks_operations import AttachedDataNetworksOperations from ._data_networks_operations import DataNetworksOperations +from ._diagnostics_packages_operations import DiagnosticsPackagesOperations from ._mobile_networks_operations import MobileNetworksOperations from ._operations import Operations +from ._packet_captures_operations import PacketCapturesOperations from ._packet_core_control_planes_operations import PacketCoreControlPlanesOperations from ._packet_core_control_plane_versions_operations import PacketCoreControlPlaneVersionsOperations from ._packet_core_data_planes_operations import PacketCoreDataPlanesOperations @@ -27,8 +29,10 @@ __all__ = [ "AttachedDataNetworksOperations", "DataNetworksOperations", + "DiagnosticsPackagesOperations", "MobileNetworksOperations", "Operations", + "PacketCapturesOperations", "PacketCoreControlPlanesOperations", "PacketCoreControlPlaneVersionsOperations", "PacketCoreDataPlanesOperations", 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 61521cb60af94..2a559db5b5220 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +59,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,7 +108,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +117,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -170,7 +166,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,7 +176,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -231,7 +227,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -241,7 +237,7 @@ def build_update_tags_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks/{attachedDataNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -291,7 +287,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -300,7 +296,7 @@ def build_list_by_packet_core_data_plane_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCoreDataPlanes/{packetCoreDataPlaneName}/attachedDataNetworks", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -369,9 +365,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -388,8 +382,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -441,9 +436,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -523,9 +516,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -542,8 +533,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -584,16 +576,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AttachedDataNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "AttachedDataNetwork") @@ -615,8 +605,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -752,7 +743,7 @@ 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 model type or a IO type. Required. + 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. @@ -773,9 +764,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AttachedDataNetwork] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -913,8 +902,8 @@ def update_tags( :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 - :param parameters: Parameters supplied to update attached data network tags. Is either a model - type or a IO type. Required. + :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. @@ -935,16 +924,14 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.AttachedDataNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -966,8 +953,9 @@ def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1013,9 +1001,7 @@ def list_by_packet_core_data_plane( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -1070,8 +1056,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 3bcff8dad74e4..536f9c8938bf1 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +54,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -91,7 +87,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +96,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -133,7 +129,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -143,7 +139,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -178,7 +174,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -188,7 +184,7 @@ def build_update_tags_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks/{dataNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -223,7 +219,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -232,7 +228,7 @@ def build_list_by_mobile_network_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/dataNetworks", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -285,9 +281,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -303,8 +297,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -349,9 +344,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -423,9 +416,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -441,8 +432,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -482,16 +474,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.DataNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DataNetwork") @@ -512,8 +502,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -640,7 +631,7 @@ 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 model type or a IO type. Required. + 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. @@ -661,9 +652,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.DataNetwork] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -791,8 +780,8 @@ def update_tags( :type mobile_network_name: str :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 model type or a - IO type. Required. + :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. @@ -813,16 +802,14 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.DataNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -843,8 +830,9 @@ def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -884,9 +872,7 @@ def list_by_mobile_network( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -940,8 +926,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 new file mode 100644 index 0000000000000..483ba1c97ffd6 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_diagnostics_packages_operations.py @@ -0,0 +1,678 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request( + resource_group_name: str, + packet_core_control_plane_name: str, + diagnostics_package_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", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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_-]*$", + ), + "diagnosticsPackageName": _SERIALIZER.url( + "diagnostics_package_name", + diagnostics_package_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + packet_core_control_plane_name: str, + diagnostics_package_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", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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_-]*$", + ), + "diagnosticsPackageName": _SERIALIZER.url( + "diagnostics_package_name", + diagnostics_package_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + packet_core_control_plane_name: str, + diagnostics_package_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", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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_-]*$", + ), + "diagnosticsPackageName": _SERIALIZER.url( + "diagnostics_package_name", + diagnostics_package_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_packet_core_control_plane_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", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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_-]*$", + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class DiagnosticsPackagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.mobilenetwork.MobileNetworkManagementClient`'s + :attr:`diagnostics_packages` 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") + + def _create_or_update_initial( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + diagnostics_package_name: str, + **kwargs: Any + ) -> _models.DiagnosticsPackage: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiagnosticsPackage] = kwargs.pop("cls", None) + + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DiagnosticsPackage", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DiagnosticsPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + 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, + resource_group_name: str, + packet_core_control_plane_name: str, + diagnostics_package_name: str, + **kwargs: Any + ) -> LROPoller[_models.DiagnosticsPackage]: + """Creates or updates a diagnostics package. + + :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 + :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] + :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.DiagnosticsPackage] = 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._create_or_update_initial( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + diagnostics_package_name=diagnostics_package_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DiagnosticsPackage", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + diagnostics_package_name: str, + **kwargs: Any + ) -> _models.DiagnosticsPackage: + """Gets information about the specified diagnostics package. + + :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 + :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 = { + 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.DiagnosticsPackage] = kwargs.pop("cls", None) + + 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) + + _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("DiagnosticsPackage", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + packet_core_control_plane_name: str, + diagnostics_package_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + 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) + + _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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + diagnostics_package_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified diagnostics package. + + :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 + :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: + """ + _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[None] = 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._delete_initial( # type: ignore + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + diagnostics_package_name=diagnostics_package_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/diagnosticsPackages/{diagnosticsPackageName}" + } + + @distributed_trace + def list_by_packet_core_control_plane( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> Iterable["_models.DiagnosticsPackage"]: + """Lists all the diagnostics packages under a packet core control plane. + + :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 + :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: + """ + _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.DiagnosticsPackageListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_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) + + 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("DiagnosticsPackageListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_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/_mobile_networks_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_mobile_networks_operations.py index 61210042dd483..6b670444e2512 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +54,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -84,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +89,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -119,7 +115,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +125,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -157,7 +153,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -167,7 +163,7 @@ def build_update_tags_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -193,7 +189,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +197,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/mobileNetworks" ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -219,7 +215,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -228,7 +224,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -278,9 +274,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -295,8 +289,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -337,9 +332,7 @@ def begin_delete(self, resource_group_name: str, mobile_network_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -406,9 +399,7 @@ def get(self, resource_group_name: str, mobile_network_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -423,8 +414,9 @@ def get(self, resource_group_name: str, mobile_network_name: str, **kwargs: Any) 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -463,16 +455,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.MobileNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "MobileNetwork") @@ -492,8 +482,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -608,7 +599,7 @@ 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 model type or a IO type. Required. + 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. @@ -629,9 +620,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.MobileNetwork] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -749,8 +738,8 @@ def update_tags( :type resource_group_name: str :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. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to update mobile 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. @@ -771,16 +760,14 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.MobileNetwork] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -800,8 +787,9 @@ def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -834,9 +822,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.MobileNetwork _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -888,8 +874,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -921,9 +908,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -976,8 +961,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 a8512ec8d19b2..bd395adcbf0a0 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 @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,9 +86,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -144,8 +137,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 new file mode 100644 index 0000000000000..63450d9ca37b3 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_captures_operations.py @@ -0,0 +1,936 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request( + resource_group_name: str, + packet_core_control_plane_name: str, + packet_capture_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", "2023-06-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/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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_-]*$", + ), + "packetCaptureName": _SERIALIZER.url( + "packet_capture_name", packet_capture_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + packet_core_control_plane_name: str, + packet_capture_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", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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_-]*$", + ), + "packetCaptureName": _SERIALIZER.url( + "packet_capture_name", packet_capture_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + packet_core_control_plane_name: str, + packet_capture_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", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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_-]*$", + ), + "packetCaptureName": _SERIALIZER.url( + "packet_capture_name", packet_capture_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_stop_request( + resource_group_name: str, + packet_core_control_plane_name: str, + packet_capture_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", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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_-]*$", + ), + "packetCaptureName": _SERIALIZER.url( + "packet_capture_name", packet_capture_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_packet_core_control_plane_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", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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_-]*$", + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class PacketCapturesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.mobilenetwork.MobileNetworkManagementClient`'s + :attr:`packet_captures` 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") + + def _create_or_update_initial( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + packet_capture_name: str, + parameters: Union[_models.PacketCapture, IO], + **kwargs: Any + ) -> _models.PacketCapture: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PacketCapture] = 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, "PacketCapture") + + 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, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("PacketCapture", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("PacketCapture", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + 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, + resource_group_name: str, + packet_core_control_plane_name: str, + packet_capture_name: str, + parameters: _models.PacketCapture, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PacketCapture]: + """Creates or updates a packet capture. + + :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 + :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. + Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCapture + :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] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + packet_capture_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PacketCapture]: + """Creates or updates a packet capture. + + :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 + :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. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :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] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + packet_capture_name: str, + parameters: Union[_models.PacketCapture, IO], + **kwargs: Any + ) -> LROPoller[_models.PacketCapture]: + """Creates or updates a packet capture. + + :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 + :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. + :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] + :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.PacketCapture] = 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._create_or_update_initial( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + packet_capture_name=packet_capture_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("PacketCapture", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, **kwargs: Any + ) -> _models.PacketCapture: + """Gets information about the specified packet capture session. + + :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 + :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 = { + 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.PacketCapture] = kwargs.pop("cls", None) + + 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) + + _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("PacketCapture", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" + } + + 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 = { + 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[None] = kwargs.pop("cls", None) + + 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) + + _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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified packet capture. + + :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 + :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: + """ + _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[None] = 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._delete_initial( # type: ignore + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + packet_capture_name=packet_capture_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}" + } + + 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 = { + 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[Optional[_models.AsyncOperationStatus]] = kwargs.pop("cls", None) + + 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) + + _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 + if response.status_code == 200: + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}/stop" + } + + @distributed_trace + def begin_stop( + self, resource_group_name: str, packet_core_control_plane_name: str, packet_capture_name: str, **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Stop a packet capture session. + + :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 + :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] + :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.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._stop_initial( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + packet_capture_name=packet_capture_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/packetCaptures/{packetCaptureName}/stop" + } + + @distributed_trace + def list_by_packet_core_control_plane( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> Iterable["_models.PacketCapture"]: + """Lists all the packet capture sessions under a packet core control plane. + + :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 + :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: + """ + _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.PacketCaptureListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_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) + + 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("PacketCaptureListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_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 4d6e39b900bac..48e576911347a 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 @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +64,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,6 +79,61 @@ def build_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_get_by_subscription_request(version_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", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "versionName": _SERIALIZER.url("version_name", version_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(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", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + class PacketCoreControlPlaneVersionsOperations: """ .. warning:: @@ -125,9 +175,7 @@ def get(self, version_name: str, **kwargs: Any) -> _models.PacketCoreControlPlan _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -140,8 +188,9 @@ def get(self, version_name: str, **kwargs: Any) -> _models.PacketCoreControlPlan 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -174,9 +223,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.PacketCoreControlPlaneVersion _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -227,8 +274,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,3 +290,147 @@ 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 = { + 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.PacketCoreControlPlaneVersion] = kwargs.pop("cls", None) + + 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) + + _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("PacketCoreControlPlaneVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlaneVersions/{versionName}" + } + + @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: + ~azure.core.paging.ItemPaged[~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneVersion] + :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.PacketCoreControlPlaneVersionListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_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) + + 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("PacketCoreControlPlaneVersionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_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 e32e6119b376a..50e4456221700 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +64,7 @@ def build_delete_request( max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -88,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +103,7 @@ def build_get_request( max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -127,7 +123,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +143,7 @@ def build_create_or_update_request( max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -169,7 +165,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -189,7 +185,7 @@ def build_update_tags_request( max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -209,7 +205,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -217,7 +213,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -235,7 +231,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -247,7 +243,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -267,7 +263,7 @@ def build_rollback_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -286,7 +282,7 @@ def build_rollback_request( max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -306,7 +302,7 @@ def build_reinstall_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -325,7 +321,7 @@ def build_reinstall_request( max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -345,7 +341,7 @@ def build_collect_diagnostics_package_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -365,7 +361,7 @@ def build_collect_diagnostics_package_request( max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -414,9 +410,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -431,8 +425,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -475,9 +470,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -546,9 +539,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -563,8 +554,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -603,16 +595,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PacketCoreControlPlane] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PacketCoreControlPlane") @@ -632,8 +622,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -748,7 +739,7 @@ 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 model type or a IO type. Required. + 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. @@ -769,9 +760,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PacketCoreControlPlane] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -823,20 +812,20 @@ def update_tags( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: _models.TagsObject, + parameters: _models.IdentityAndTagsObject, *, content_type: str = "application/json", **kwargs: Any ) -> _models.PacketCoreControlPlane: - """Updates packet core control planes tags. + """Patch packet core control plane resource. :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 - :param parameters: Parameters supplied to update packet core control plane tags. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject + :param parameters: Parameters supplied to patch packet core control plane resource. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -856,14 +845,14 @@ def update_tags( content_type: str = "application/json", **kwargs: Any ) -> _models.PacketCoreControlPlane: - """Updates packet core control planes tags. + """Patch packet core control plane resource. :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 - :param parameters: Parameters supplied to update packet core control plane tags. Required. + :param parameters: Parameters supplied to patch packet core control plane resource. Required. :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -879,19 +868,19 @@ def update_tags( self, resource_group_name: str, packet_core_control_plane_name: str, - parameters: Union[_models.TagsObject, IO], + parameters: Union[_models.IdentityAndTagsObject, IO], **kwargs: Any ) -> _models.PacketCoreControlPlane: - """Updates packet core control planes tags. + """Patch packet core control plane resource. :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 - :param parameters: Parameters supplied to update packet core control plane tags. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO + :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 @@ -911,19 +900,17 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PacketCoreControlPlane] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "TagsObject") + _json = self._serialize.body(parameters, "IdentityAndTagsObject") request = build_update_tags_request( resource_group_name=resource_group_name, @@ -940,8 +927,9 @@ def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -975,9 +963,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PacketCoreCon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -1029,8 +1015,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1065,9 +1052,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -1120,8 +1105,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1152,9 +1138,7 @@ def _rollback_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -1169,8 +1153,9 @@ def _rollback_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1221,9 +1206,7 @@ def begin_rollback( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -1281,9 +1264,7 @@ def _reinstall_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -1298,8 +1279,9 @@ def _reinstall_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1351,9 +1333,7 @@ def begin_reinstall( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 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) @@ -1415,16 +1395,14 @@ def _collect_diagnostics_package_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PacketCoreControlPlaneCollectDiagnosticsPackage") @@ -1444,8 +1422,9 @@ def _collect_diagnostics_package_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1562,7 +1541,8 @@ 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 model type or a IO type. Required. + package operation. Is either a PacketCoreControlPlaneCollectDiagnosticsPackage type or a IO + type. Required. :type parameters: ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneCollectDiagnosticsPackage or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1584,9 +1564,7 @@ def begin_collect_diagnostics_package( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) 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 29a3dde152be2..6d0d88ca55c22 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +49,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +75,7 @@ def build_delete_request( max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -103,7 +99,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +125,7 @@ def build_get_request( max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -153,7 +149,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,7 +176,7 @@ def build_create_or_update_request( max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -206,7 +202,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -233,7 +229,7 @@ def build_update_tags_request( max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -255,7 +251,7 @@ def build_list_by_packet_core_control_plane_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,7 +270,7 @@ def build_list_by_packet_core_control_plane_request( max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -325,9 +321,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -343,8 +337,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -393,9 +388,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -471,9 +464,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -489,8 +480,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -530,16 +522,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PacketCoreDataPlane] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PacketCoreDataPlane") @@ -560,8 +550,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -688,7 +679,7 @@ 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 model type or a IO type. Required. + 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. @@ -709,9 +700,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PacketCoreDataPlane] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -839,8 +828,8 @@ def update_tags( :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 - :param parameters: Parameters supplied to update packet core data plane tags. Is either a model - type or a IO type. Required. + :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. @@ -861,16 +850,14 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.PacketCoreDataPlane] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -891,8 +878,9 @@ def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -932,9 +920,7 @@ def list_by_packet_core_control_plane( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -988,8 +974,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 4c1ead59af25a..ec07cda26f46d 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +67,7 @@ def build_delete_request( max_length=64, pattern=r"^(?!(default|requested|service)$)[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -91,7 +87,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +109,7 @@ def build_get_request( max_length=64, pattern=r"^(?!(default|requested|service)$)[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -133,7 +129,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -156,7 +152,7 @@ def build_create_or_update_request( max_length=64, pattern=r"^(?!(default|requested|service)$)[a-zA-Z0-9][a-zA-Z0-9_-]*$", ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -178,7 +174,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -188,7 +184,7 @@ def build_update_tags_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/services/{serviceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -223,7 +219,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,7 +234,7 @@ def build_list_by_mobile_network_request( "mobileNetworkName": _SERIALIZER.url( "mobile_network_name", mobile_network_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -285,9 +281,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -303,8 +297,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -350,9 +345,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -425,9 +418,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -443,8 +434,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -484,16 +476,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Service] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Service") @@ -514,8 +504,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -641,7 +632,7 @@ def begin_create_or_update( strings - ``default``\ , ``requested`` or ``service``. Required. :type service_name: str :param parameters: Parameters supplied to the create or update service operation. Is either a - model type or a IO type. Required. + 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. @@ -661,9 +652,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Service] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -794,8 +783,8 @@ def update_tags( :param service_name: The name of the service. You must not use any of the following reserved strings - ``default``\ , ``requested`` or ``service``. Required. :type service_name: str - :param parameters: Parameters supplied to update service tags. Is either a model type or a IO - type. Required. + :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. @@ -816,16 +805,14 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Service] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -846,8 +833,9 @@ def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -887,9 +875,7 @@ def list_by_mobile_network( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -943,8 +929,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 c56d43ab9c416..5281569ccc168 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +54,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -84,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +89,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -119,7 +115,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +125,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -157,7 +153,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -167,7 +163,7 @@ def build_update_tags_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -193,13 +189,13 @@ 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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.MobileNetwork/simGroups") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -217,7 +213,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,7 +225,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -276,9 +272,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -293,8 +287,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,9 +330,7 @@ def begin_delete(self, resource_group_name: str, sim_group_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -404,9 +397,7 @@ def get(self, resource_group_name: str, sim_group_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -421,8 +412,9 @@ def get(self, resource_group_name: str, sim_group_name: str, **kwargs: Any) -> _ 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -457,16 +449,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SimGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SimGroup") @@ -486,8 +476,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -594,7 +585,7 @@ 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 - model type or a IO type. Required. + 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. @@ -614,9 +605,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SimGroup] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -668,20 +657,20 @@ def update_tags( self, resource_group_name: str, sim_group_name: str, - parameters: _models.TagsObject, + parameters: _models.IdentityAndTagsObject, *, content_type: str = "application/json", **kwargs: Any ) -> _models.SimGroup: - """Updates SIM group tags. + """Patch SIM group resource. :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 update SIM group tags. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject + :param parameters: Parameters supplied to patch SIM group resource. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.IdentityAndTagsObject :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -701,14 +690,14 @@ def update_tags( content_type: str = "application/json", **kwargs: Any ) -> _models.SimGroup: - """Updates SIM group tags. + """Patch SIM group resource. :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 update SIM group tags. Required. + :param parameters: Parameters supplied to patch SIM group resource. Required. :type parameters: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -721,18 +710,22 @@ def update_tags( @distributed_trace def update_tags( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.TagsObject, IO], **kwargs: Any + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.IdentityAndTagsObject, IO], + **kwargs: Any ) -> _models.SimGroup: - """Updates SIM group tags. + """Patch SIM group resource. :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 update SIM group tags. Is either a model type or a IO - type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.TagsObject or IO + :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 @@ -752,19 +745,17 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SimGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "TagsObject") + _json = self._serialize.body(parameters, "IdentityAndTagsObject") request = build_update_tags_request( resource_group_name=resource_group_name, @@ -781,8 +772,9 @@ def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -815,9 +807,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SimGroup"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -869,8 +859,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -902,9 +893,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -957,8 +946,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 5fd67faa146da..a005a1e726cb9 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +63,7 @@ def build_delete_request( "simPolicyName": _SERIALIZER.url( "sim_policy_name", sim_policy_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -87,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +101,7 @@ def build_get_request( "simPolicyName": _SERIALIZER.url( "sim_policy_name", sim_policy_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -125,7 +121,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -144,7 +140,7 @@ def build_create_or_update_request( "simPolicyName": _SERIALIZER.url( "sim_policy_name", sim_policy_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -166,7 +162,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -176,7 +172,7 @@ def build_update_tags_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/simPolicies/{simPolicyName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -207,7 +203,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -222,7 +218,7 @@ def build_list_by_mobile_network_request( "mobileNetworkName": _SERIALIZER.url( "mobile_network_name", mobile_network_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -269,9 +265,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -287,8 +281,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -333,9 +328,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -407,9 +400,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -425,8 +416,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -466,16 +458,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SimPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SimPolicy") @@ -496,8 +486,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -620,7 +611,7 @@ 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 model type or a IO type. Required. + 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. @@ -640,9 +631,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SimPolicy] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -770,8 +759,8 @@ def update_tags( :type mobile_network_name: str :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 model type or a - IO type. Required. + :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. @@ -792,16 +781,14 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.SimPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -822,8 +809,9 @@ def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -863,9 +851,7 @@ def list_by_mobile_network( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -919,8 +905,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 920c1ac25a539..5990573698b5e 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +54,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -85,7 +81,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +90,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -121,7 +117,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -131,7 +127,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims/{simName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -160,7 +156,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +168,7 @@ def build_list_by_group_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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_-]*$" ), @@ -195,7 +191,7 @@ def build_bulk_upload_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -208,7 +204,7 @@ def build_bulk_upload_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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_-]*$" ), @@ -233,7 +229,7 @@ def build_bulk_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -246,7 +242,7 @@ def build_bulk_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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_-]*$" ), @@ -271,7 +267,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -284,7 +280,7 @@ def build_bulk_upload_encrypted_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "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_-]*$" ), @@ -336,9 +332,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -354,8 +348,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,9 +395,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -472,9 +465,7 @@ def get(self, resource_group_name: str, sim_group_name: str, sim_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -490,8 +481,9 @@ def get(self, resource_group_name: str, sim_group_name: str, sim_name: str, **kw 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -531,16 +523,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Sim] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Sim") @@ -561,8 +551,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -681,7 +672,7 @@ def begin_create_or_update( :type sim_group_name: str :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 model + :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'. @@ -702,9 +693,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Sim] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -769,9 +758,7 @@ def list_by_group(self, resource_group_name: str, sim_group_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -825,8 +812,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -857,16 +845,14 @@ def _bulk_upload_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SimUploadList") @@ -886,8 +872,9 @@ def _bulk_upload_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -993,8 +980,8 @@ def begin_bulk_upload( :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 the bulk SIM upload operation. Is either a model type - or a IO type. Required. + :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. @@ -1015,9 +1002,7 @@ def begin_bulk_upload( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1078,16 +1063,14 @@ def _bulk_delete_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SimDeleteList") @@ -1107,8 +1090,9 @@ def _bulk_delete_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1214,8 +1198,8 @@ def begin_bulk_delete( :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 the bulk SIM delete operation. Is either a model type - or a IO type. Required. + :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. @@ -1236,9 +1220,7 @@ def begin_bulk_delete( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -1303,16 +1285,14 @@ def _bulk_upload_encrypted_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "EncryptedSimUploadList") @@ -1332,8 +1312,9 @@ def _bulk_upload_encrypted_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1444,7 +1425,7 @@ 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 - model type or a IO type. Required. + 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. @@ -1465,9 +1446,7 @@ def begin_bulk_upload_encrypted( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) 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 69793972cdb8d..285434c09b420 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +54,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -87,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +92,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -125,7 +121,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +131,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -166,7 +162,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -176,7 +172,7 @@ def build_update_tags_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -207,7 +203,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -216,7 +212,7 @@ def build_list_by_mobile_network_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -236,6 +232,47 @@ def build_list_by_mobile_network_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_delete_packet_core_request( + resource_group_name: str, mobile_network_name: str, site_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", "2023-06-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/mobileNetworks/{mobileNetworkName}/sites/{siteName}/deletePacketCore", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "mobileNetworkName": _SERIALIZER.url( + "mobile_network_name", mobile_network_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + "siteName": _SERIALIZER.url( + "site_name", site_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class SitesOperations: """ .. warning:: @@ -269,9 +306,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -287,8 +322,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -334,9 +370,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -406,9 +440,7 @@ def get(self, resource_group_name: str, mobile_network_name: str, site_name: str _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -424,8 +456,9 @@ def get(self, resource_group_name: str, mobile_network_name: str, site_name: str 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -465,16 +498,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Site] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Site") @@ -495,8 +526,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -621,7 +653,7 @@ 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 model type or a IO type. Required. + 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. @@ -641,9 +673,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Site] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -771,8 +801,8 @@ def update_tags( :type mobile_network_name: str :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 model type or a - IO type. Required. + :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. @@ -793,16 +823,14 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Site] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -823,8 +851,9 @@ def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -864,9 +893,7 @@ def list_by_mobile_network( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -920,8 +947,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -937,3 +965,230 @@ def get_next(next_link=None): 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], + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SiteDeletePacketCore") + + request = build_delete_packet_core_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, + 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) + + _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) + + 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" + } + + @overload + def begin_delete_packet_core( + self, + resource_group_name: str, + mobile_network_name: str, + site_name: str, + parameters: _models.SiteDeletePacketCore, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a packet core under the specified mobile network site. + + :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 + :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: ~azure.mgmt.mobilenetwork.models.SiteDeletePacketCore + :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: + """ + + @overload + def begin_delete_packet_core( + self, + resource_group_name: str, + mobile_network_name: str, + site_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a packet core under the specified mobile network site. + + :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 + :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 + :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: + """ + + @distributed_trace + def begin_delete_packet_core( + self, + resource_group_name: str, + mobile_network_name: str, + site_name: str, + parameters: Union[_models.SiteDeletePacketCore, IO], + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a packet core under the specified mobile network site. + + :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 + :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. + :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: + """ + _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[None] = 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._delete_packet_core_initial( # type: ignore + resource_group_name=resource_group_name, + mobile_network_name=mobile_network_name, + site_name=site_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): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete_packet_core.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/sites/{siteName}/deletePacketCore" + } 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 e070fefe01679..cb6f1c4b0c424 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +45,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +54,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -87,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +92,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -125,7 +121,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +131,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -166,7 +162,7 @@ def build_update_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -176,7 +172,7 @@ def build_update_tags_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices/{sliceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -207,7 +203,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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -216,7 +212,7 @@ def build_list_by_mobile_network_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/mobileNetworks/{mobileNetworkName}/slices", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -269,9 +265,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -287,8 +281,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -333,9 +328,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -405,9 +398,7 @@ def get(self, resource_group_name: str, mobile_network_name: str, slice_name: st _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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( @@ -423,8 +414,9 @@ def get(self, resource_group_name: str, mobile_network_name: str, slice_name: st 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -464,16 +456,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Slice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Slice") @@ -494,8 +484,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -620,7 +611,7 @@ 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 model type or a IO type. Required. + 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. @@ -640,9 +631,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Slice] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -770,8 +759,8 @@ def update_tags( :type mobile_network_name: str :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 model type or - a IO type. Required. + :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. @@ -792,16 +781,14 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Slice] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "TagsObject") @@ -822,8 +809,9 @@ def update_tags( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -863,9 +851,7 @@ def list_by_mobile_network( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -919,8 +905,9 @@ def extract_data(pipeline_response): 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 8b6c32f6046b8..e4e635a960a6b 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.attached_data_networks.begin_create_or_update( @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/AttachedDataNetworkCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 7fca1132eddc7..b8527b57b7612 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 @@ -26,18 +26,17 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.attached_data_networks.begin_delete( + client.attached_data_networks.begin_delete( resource_group_name="rg1", packet_core_control_plane_name="TestPacketCoreCP", packet_core_data_plane_name="TestPacketCoreDP", attached_data_network_name="TestAttachedDataNetwork", ).result() - print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/AttachedDataNetworkDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 3ee86f800208a..a0edab2f22b44 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.attached_data_networks.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/AttachedDataNetworkGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 0500074812335..e1663ad1316ec 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.attached_data_networks.list_by_packet_core_data_plane( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/AttachedDataNetworkListByPacketCoreDataPlane.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 30045053ebedf..e09a00aa767cd 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.attached_data_networks.update_tags( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/AttachedDataNetworkUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 6c1d68c3dd94a..d4f70674b0162 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.data_networks.begin_create_or_update( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/DataNetworkCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 9737f70aa5a6f..fe11977147ba8 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 @@ -26,17 +26,16 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.data_networks.begin_delete( + client.data_networks.begin_delete( resource_group_name="rg1", mobile_network_name="testMobileNetwork", data_network_name="testDataNetwork", ).result() - print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/DataNetworkDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 ecc4e60d471f3..40cb4c3007f45 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.data_networks.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/DataNetworkGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 d25bf96da424d..67cf88c673f9c 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.data_networks.list_by_mobile_network( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/DataNetworkListByMobileNetwork.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 a2d7d192ed683..26a048f00f331 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.data_networks.update_tags( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/DataNetworkUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 new file mode 100644 index 0000000000000..2e798b3ab943d --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_create.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 diagnostics_package_create.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.diagnostics_packages.begin_create_or_update( + resource_group_name="rg1", + packet_core_control_plane_name="TestPacketCoreCP", + diagnostics_package_name="dp1", + ).result() + print(response) + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 new file mode 100644 index 0000000000000..28dee190144ba --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_delete.py @@ -0,0 +1,41 @@ +# 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 diagnostics_package_delete.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", + ) + + client.diagnostics_packages.begin_delete( + resource_group_name="rg1", + packet_core_control_plane_name="TestPacketCoreCP", + diagnostics_package_name="dp1", + ).result() + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-01/examples/DiagnosticsPackageDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_update_tags.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_get.py similarity index 81% rename from sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_update_tags.py rename to sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_get.py index c45d7a70b676d..f57d0414a5e33 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_update_tags.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mobilenetwork # USAGE - python packet_core_control_plane_update_tags.py + python diagnostics_package_get.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, @@ -26,17 +26,17 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.packet_core_control_planes.update_tags( + response = client.diagnostics_packages.get( resource_group_name="rg1", packet_core_control_plane_name="TestPacketCoreCP", - parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, + diagnostics_package_name="dp1", ) print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 new file mode 100644 index 0000000000000..258e0646b9bc7 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/diagnostics_package_list_by_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 diagnostics_package_list_by_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.diagnostics_packages.list_by_packet_core_control_plane( + 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/2023-06-01/examples/DiagnosticsPackageListByPacketCoreControlPlane.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 b0ebb0fcf1207..153a25a1fca21 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.mobile_networks.begin_create_or_update( @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/MobileNetworkCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 19a992c0f7d44..23d3382938ebb 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 @@ -26,16 +26,15 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.mobile_networks.begin_delete( + client.mobile_networks.begin_delete( resource_group_name="rg1", mobile_network_name="testMobileNetwork", ).result() - print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/MobileNetworkDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 259045c0dbb9b..1755e38d53fb1 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.mobile_networks.get( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/MobileNetworkGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 302bc4cbc60ae..fe7172eea1146 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.mobile_networks.list_by_resource_group( @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/MobileNetworkListByResourceGroup.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 24df6552f3a04..b9f000d34645a 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.mobile_networks.list_by_subscription() @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/MobileNetworkListBySubscription.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 34f64a6fae985..903cd15a4fb36 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.mobile_networks.update_tags( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/MobileNetworkUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 3f7a877944e55..1ce48d9f3d741 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/operation_list.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/operation_list.py @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.operations.list() @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/OperationList.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 new file mode 100644 index 0000000000000..31c6ff2ef66c4 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_create.py @@ -0,0 +1,54 @@ +# 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 packet_capture_create.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.packet_captures.begin_create_or_update( + resource_group_name="rg1", + packet_core_control_plane_name="TestPacketCoreCP", + packet_capture_name="pc1", + parameters={ + "properties": { + "bytesToCapturePerPacket": 10000, + "networkInterfaces": [ + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP", + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP", + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestADN", + ], + "timeLimitInSeconds": 100, + "totalBytesPerSession": 100000, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 new file mode 100644 index 0000000000000..8e11f52470636 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_delete.py @@ -0,0 +1,41 @@ +# 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 packet_capture_delete.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", + ) + + client.packet_captures.begin_delete( + resource_group_name="rg1", + packet_core_control_plane_name="TestPacketCoreCP", + packet_capture_name="pc1", + ).result() + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-01/examples/PacketCaptureDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_update_tags.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_get.py similarity index 81% rename from sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_update_tags.py rename to sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_get.py index 40f8bf0950020..dbceb18562ff2 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_update_tags.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-mobilenetwork # USAGE - python sim_group_update_tags.py + python packet_capture_get.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, @@ -26,17 +26,17 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.sim_groups.update_tags( + response = client.packet_captures.get( resource_group_name="rg1", - sim_group_name="testSimGroup", - parameters={"tags": {"tag1": "value1", "tag2": "value2"}}, + packet_core_control_plane_name="TestPacketCoreCP", + packet_capture_name="pc1", ) print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimGroupUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 new file mode 100644 index 0000000000000..e6c81055ddc44 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_list_by_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 packet_capture_list_by_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.packet_captures.list_by_packet_core_control_plane( + 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/2023-06-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 new file mode 100644 index 0000000000000..d21605b0c64e5 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_capture_stop.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 packet_capture_stop.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.packet_captures.begin_stop( + resource_group_name="rg1", + packet_core_control_plane_name="TestPacketCoreCP", + packet_capture_name="pc1", + ).result() + print(response) + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 2c5e324cad090..0b6979758094c 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packet_core_control_planes.begin_collect_diagnostics_package( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneCollectDiagnosticsPackage.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 23223fe1d6835..229249932deaa 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packet_core_control_planes.begin_create_or_update( @@ -37,6 +37,7 @@ def main(): "properties": { "controlPlaneAccessInterface": {"name": "N2"}, "coreNetworkTechnology": "5GC", + "installation": {"desiredState": "Installed"}, "localDiagnosticsAccess": { "authenticationType": "AAD", "httpsServerCertificate": { @@ -45,19 +46,19 @@ def main(): }, "platform": { "azureStackEdgeDevice": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/TestAzureStackEdgeDevice" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/TestAzureStackEdgeDevice" }, "connectedCluster": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/TestConnectedCluster" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/TestConnectedCluster" }, "customLocation": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ExtendedLocation/customLocations/TestCustomLocation" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ExtendedLocation/customLocations/TestCustomLocation" }, "type": "AKS-HCI", }, "sites": [ { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/sites/testSite" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/sites/testSite" } ], "sku": "G0", @@ -69,6 +70,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 46dfcb714e62d..d1c2c285bbd7c 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 @@ -26,16 +26,15 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.packet_core_control_planes.begin_delete( + client.packet_core_control_planes.begin_delete( resource_group_name="rg1", packet_core_control_plane_name="TestPacketCoreCP", ).result() - print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 c1ebb51960fa0..334b6f814d72b 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packet_core_control_planes.get( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 2f2bf100372a7..6acf242af6d69 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packet_core_control_planes.list_by_resource_group( @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneListByResourceGroup.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 0d005535c9b7f..ea79780ba753d 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packet_core_control_planes.list_by_subscription() @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneListBySubscription.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 new file mode 100644 index 0000000000000..9e05624ab7e20 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_patch.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 azure.identity import DefaultAzureCredential +from azure.mgmt.mobilenetwork import MobileNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-mobilenetwork +# USAGE + python packet_core_control_plane_patch.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.packet_core_control_planes.update_tags( + resource_group_name="rg1", + packet_core_control_plane_name="TestPacketCoreCP", + parameters={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testUserAssignedManagedIdentity": {} + }, + }, + "tags": {"tag1": "value1", "tag2": "value2"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 b7d19822436ea..f4f9a9593040f 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packet_core_control_planes.begin_reinstall( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneReinstall.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 a0b8fc36772c6..3f0e45f28d9bc 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packet_core_control_planes.begin_rollback( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneRollback.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 4f8772d55fac1..0bc0fb05ef96e 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 @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneVersionGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 new file mode 100644 index 0000000000000..ccb898dff9bf9 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_get_by_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.mobilenetwork import MobileNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-mobilenetwork +# USAGE + python packet_core_control_plane_version_get_by_subscription.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.packet_core_control_plane_versions.get_by_subscription( + version_name="PMN-4-11-1", + ) + print(response) + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 141859e2c21fd..10687a8fec4b2 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 @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreControlPlaneVersionList.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 new file mode 100644 index 0000000000000..c0040d005dec2 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/packet_core_control_plane_version_list_by_subscription.py @@ -0,0 +1,39 @@ +# 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 packet_core_control_plane_version_list_by_subscription.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.packet_core_control_plane_versions.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 3944528a0c88a..60f511f87965c 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packet_core_data_planes.begin_create_or_update( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreDataPlaneCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 72a5ae33ab23b..f7b653a268fa1 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 @@ -26,17 +26,16 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.packet_core_data_planes.begin_delete( + client.packet_core_data_planes.begin_delete( resource_group_name="rg1", packet_core_control_plane_name="testPacketCoreCP", packet_core_data_plane_name="testPacketCoreDP", ).result() - print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreDataPlaneDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 c6c9d955073b6..19c5c7ef76956 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packet_core_data_planes.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreDataPlaneGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 037ee1a5cb264..25590e2952255 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packet_core_data_planes.list_by_packet_core_control_plane( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreDataPlaneListByPacketCoreControlPlane.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 8c012dfc7edeb..2659cb6b1c169 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.packet_core_data_planes.update_tags( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/PacketCoreDataPlaneUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-01/examples/PacketCoreDataPlaneUpdateTags.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 e5fe7d95ee6be..efbe15cc01f0b 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_create.py @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.services.begin_create_or_update( @@ -73,6 +73,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/ServiceCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 1fa765a1d710e..ac3ba404f3029 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_delete.py @@ -26,17 +26,16 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.services.begin_delete( + client.services.begin_delete( resource_group_name="rg1", mobile_network_name="testMobileNetwork", service_name="TestService", ).result() - print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/ServiceDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 3c015e6db02fa..9f68a6b0929cb 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/service_get.py @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.services.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/ServiceGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 3965a3e41ca37..dcee7e182a99b 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.services.list_by_mobile_network( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/ServiceListByMobileNetwork.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 3c7c459d932a2..f8bc473da75f8 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.services.update_tags( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/ServiceUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 510baee3b72f2..fabedf6e6d05a 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sims.begin_bulk_delete( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimBulkDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 daa807a3fd00e..3302c3046137d 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sims.begin_bulk_upload( @@ -43,15 +43,15 @@ def main(): "internationalMobileSubscriberIdentity": "00000", "operatorKeyCode": "00000000000000000000000000000000", "simPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy" }, "staticIpConfiguration": [ { "attachedDataNetwork": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork" }, "slice": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" }, "staticIp": {"ipv4Address": "2.4.0.1"}, } @@ -67,15 +67,15 @@ def main(): "internationalMobileSubscriberIdentity": "00000", "operatorKeyCode": "00000000000000000000000000000000", "simPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy" }, "staticIpConfiguration": [ { "attachedDataNetwork": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork" }, "slice": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" }, "staticIp": {"ipv4Address": "2.4.0.2"}, } @@ -88,6 +88,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimBulkUpload.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 11a7c4169deaa..9d266a8c86611 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sims.begin_bulk_upload_encrypted( @@ -45,15 +45,15 @@ def main(): "integratedCircuitCardIdentifier": "8900000000000000000", "internationalMobileSubscriberIdentity": "00000", "simPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy" }, "staticIpConfiguration": [ { "attachedDataNetwork": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork" }, "slice": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" }, "staticIp": {"ipv4Address": "2.4.0.1"}, } @@ -68,15 +68,15 @@ def main(): "integratedCircuitCardIdentifier": "8900000000000000001", "internationalMobileSubscriberIdentity": "00000", "simPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy" }, "staticIpConfiguration": [ { "attachedDataNetwork": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork" }, "slice": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" }, "staticIp": {"ipv4Address": "2.4.0.2"}, } @@ -91,6 +91,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimBulkUploadEncrypted.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-01/examples/SimBulkUploadEncrypted.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 345237253e561..6451d0d2850a5 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_create.py @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sims.begin_create_or_update( @@ -41,15 +41,15 @@ def main(): "internationalMobileSubscriberIdentity": "00000", "operatorKeyCode": "00000000000000000000000000000000", "simPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/simPolicies/MySimPolicy" }, "staticIpConfiguration": [ { "attachedDataNetwork": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP/packetCoreDataPlanes/TestPacketCoreDP/attachedDataNetworks/TestAttachedDataNetwork" }, "slice": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" }, "staticIp": {"ipv4Address": "2.4.0.1"}, } @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 9e895f599b9b7..60760eb2c414a 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_delete.py @@ -26,17 +26,16 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.sims.begin_delete( + client.sims.begin_delete( resource_group_name="testResourceGroupName", sim_group_name="testSimGroup", sim_name="testSim", ).result() - print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 cbc5fd9f2de95..95219877f3dfe 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_get.py @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sims.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 7e619f7076521..86f87e57b5c0c 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sim_groups.begin_create_or_update( @@ -36,14 +36,14 @@ def main(): "identity": { "type": "UserAssigned", "userAssignedIdentities": { - "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testUserAssignedManagedIdentity": {} + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testUserAssignedManagedIdentity": {} }, }, "location": "eastus", "properties": { "encryptionKey": {"keyUrl": "https://contosovault.vault.azure.net/keys/azureKey"}, "mobileNetwork": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork" }, }, }, @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimGroupCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 55ad0a0a704b7..bfc4883eef4ce 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 @@ -26,16 +26,15 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.sim_groups.begin_delete( + client.sim_groups.begin_delete( resource_group_name="testResourceGroupName", sim_group_name="testSimGroup", ).result() - print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimGroupDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 bb637cd3a671f..0ba04f4d0f1e7 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sim_groups.get( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimGroupGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-01/examples/SimGroupGet.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 96d8136c5eec9..e156a8fbb6212 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sim_groups.list_by_resource_group( @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimGroupListByResourceGroup.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 8e1f4763dae31..ea7a661221f6e 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sim_groups.list_by_subscription() @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimGroupListBySubscription.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 new file mode 100644 index 0000000000000..4dba120a40dea --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/sim_group_patch.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 azure.identity import DefaultAzureCredential +from azure.mgmt.mobilenetwork import MobileNetworkManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-mobilenetwork +# USAGE + python sim_group_patch.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.sim_groups.update_tags( + resource_group_name="rg1", + sim_group_name="testSimGroup", + parameters={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testUserAssignedManagedIdentity": {} + }, + }, + "tags": {"tag1": "value1", "tag2": "value2"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 abdb57da0a59a..c47e45065b201 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sims.list_by_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimListBySimGroup.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-01/examples/SimListBySimGroup.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 71f3886de1ba7..cb83a7bba7e0a 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sim_policies.begin_create_or_update( @@ -37,7 +37,7 @@ def main(): "location": "eastus", "properties": { "defaultSlice": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" }, "registrationTimer": 3240, "sliceConfigurations": [ @@ -49,11 +49,11 @@ def main(): "allocationAndRetentionPriorityLevel": 9, "allowedServices": [ { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/services/testService" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/services/testService" } ], "dataNetwork": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/dataNetworks/testdataNetwork" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/dataNetworks/testdataNetwork" }, "defaultSessionType": "IPv4", "maximumNumberOfBufferedPackets": 200, @@ -63,10 +63,10 @@ def main(): } ], "defaultDataNetwork": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/dataNetworks/testdataNetwork" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/dataNetworks/testdataNetwork" }, "slice": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/mobileNetworks/testMobileNetwork/slices/testSlice" }, } ], @@ -77,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimPolicyCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 d872574237094..a3968acb65f2a 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 @@ -26,17 +26,16 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.sim_policies.begin_delete( + client.sim_policies.begin_delete( resource_group_name="rg1", mobile_network_name="testMobileNetwork", sim_policy_name="testPolicy", ).result() - print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimPolicyDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 97cee6e50aa6f..bf567185a5253 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sim_policies.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimPolicyGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 a3fe709667ac9..66a5c09995673 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sim_policies.list_by_mobile_network( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimPolicyListByMobileNetwork.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 552ddc577f584..7628495b2f298 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sim_policies.update_tags( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SimPolicyUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 9225c8bb97812..ff3116c953fed 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_create.py @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sites.begin_create_or_update( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SiteCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 84743439a6db9..cd0892e0d8da0 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_delete.py @@ -26,17 +26,16 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.sites.begin_delete( + client.sites.begin_delete( resource_group_name="rg1", mobile_network_name="testMobileNetwork", site_name="testSite", ).result() - print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SiteDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 new file mode 100644 index 0000000000000..3b310af94c497 --- /dev/null +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_delete_packet_core.py @@ -0,0 +1,46 @@ +# 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 site_delete_packet_core.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", + ) + + client.sites.begin_delete_packet_core( + resource_group_name="rg1", + mobile_network_name="testMobileNetwork", + site_name="testSite", + parameters={ + "packetCore": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/TestPacketCoreCP" + } + }, + ).result() + + +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 c47cea02a6cdc..46f496476ed32 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/site_get.py @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sites.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SiteGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 1dd0d09264e25..31357f6a769a1 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sites.list_by_mobile_network( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SiteListByMobileNetwork.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 e7d084542fe36..36418ae5df73e 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.sites.update_tags( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SiteUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 1bda0f7042b7a..119a1693e72c5 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_create.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_create.py @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.slices.begin_create_or_update( @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SliceCreate.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 85e6ddd36dd8c..858d2a82aeffb 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_delete.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_delete.py @@ -26,17 +26,16 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.slices.begin_delete( + client.slices.begin_delete( resource_group_name="rg1", mobile_network_name="testMobileNetwork", slice_name="testSlice", ).result() - print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SliceDelete.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 69703bf26e046..73a16e169d491 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_get.py +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/generated_samples/slice_get.py @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.slices.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SliceGet.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 f80d0ed97de1f..1628382422325 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.slices.list_by_mobile_network( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SliceListByMobileNetwork.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-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 dcdc1e6ae0c54..a41770e73fa33 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 @@ -26,7 +26,7 @@ def main(): client = MobileNetworkManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.slices.update_tags( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2022-11-01/examples/SliceUpdateTags.json +# x-ms-original-file: specification/mobilenetwork/resource-manager/Microsoft.MobileNetwork/stable/2023-06-01/examples/SliceUpdateTags.json if __name__ == "__main__": main()