diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/_meta.json b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/_meta.json index 5eea24678c70..d5f7f2748b7e 100644 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/_meta.json +++ b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/_meta.json @@ -1,11 +1,11 @@ { - "commit": "fb1cc37993d7c2e27669854c1039d913461b5e33", + "commit": "b559fe7a8871fa709c0edad616d724874d21d2a4", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.2.16", "@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.2.16 --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/_mobile_network_management_client.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/_mobile_network_management_client.py index 11aef5196d36..f1b81f422b37 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 @@ -20,13 +20,11 @@ DataNetworksOperations, MobileNetworksOperations, Operations, - PacketCoreControlPlaneOperations, PacketCoreControlPlaneVersionsOperations, PacketCoreControlPlanesOperations, PacketCoreDataPlanesOperations, ServicesOperations, SimGroupsOperations, - SimOperations, SimPoliciesOperations, SimsOperations, SitesOperations, @@ -54,9 +52,6 @@ class MobileNetworkManagementClient: # pylint: disable=client-accepts-api-versi :ivar packet_core_control_planes: PacketCoreControlPlanesOperations operations :vartype packet_core_control_planes: azure.mgmt.mobilenetwork.operations.PacketCoreControlPlanesOperations - :ivar packet_core_control_plane: PacketCoreControlPlaneOperations operations - :vartype packet_core_control_plane: - azure.mgmt.mobilenetwork.operations.PacketCoreControlPlaneOperations :ivar packet_core_control_plane_versions: PacketCoreControlPlaneVersionsOperations operations :vartype packet_core_control_plane_versions: azure.mgmt.mobilenetwork.operations.PacketCoreControlPlaneVersionsOperations @@ -67,8 +62,6 @@ class MobileNetworkManagementClient: # pylint: disable=client-accepts-api-versi :vartype services: azure.mgmt.mobilenetwork.operations.ServicesOperations :ivar sims: SimsOperations operations :vartype sims: azure.mgmt.mobilenetwork.operations.SimsOperations - :ivar sim: SimOperations operations - :vartype sim: azure.mgmt.mobilenetwork.operations.SimOperations :ivar sim_groups: SimGroupsOperations operations :vartype sim_groups: azure.mgmt.mobilenetwork.operations.SimGroupsOperations :ivar sim_policies: SimPoliciesOperations operations @@ -115,9 +108,6 @@ def __init__( self.packet_core_control_planes = PacketCoreControlPlanesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.packet_core_control_plane = PacketCoreControlPlaneOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.packet_core_control_plane_versions = PacketCoreControlPlaneVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -126,7 +116,6 @@ def __init__( ) self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) self.sims = SimsOperations(self._client, self._config, self._serialize, self._deserialize) - self.sim = SimOperations(self._client, self._config, self._serialize, self._deserialize) self.sim_groups = SimGroupsOperations(self._client, self._config, self._serialize, self._deserialize) self.sim_policies = SimPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) self.sites = SitesOperations(self._client, self._config, self._serialize, self._deserialize) 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 2c170e28dbca..f17c068e833e 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 @@ -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 @@ -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 9aad73fc743e..bd0df84f5319 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 c47f66669f1b..e5754a47ce68 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 = "1.0.0" +VERSION = "1.0.0b1" 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 b84b0b99ed0e..82a13f3f66d6 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 @@ -20,13 +20,11 @@ DataNetworksOperations, MobileNetworksOperations, Operations, - PacketCoreControlPlaneOperations, PacketCoreControlPlaneVersionsOperations, PacketCoreControlPlanesOperations, PacketCoreDataPlanesOperations, ServicesOperations, SimGroupsOperations, - SimOperations, SimPoliciesOperations, SimsOperations, SitesOperations, @@ -54,9 +52,6 @@ class MobileNetworkManagementClient: # pylint: disable=client-accepts-api-versi :ivar packet_core_control_planes: PacketCoreControlPlanesOperations operations :vartype packet_core_control_planes: azure.mgmt.mobilenetwork.aio.operations.PacketCoreControlPlanesOperations - :ivar packet_core_control_plane: PacketCoreControlPlaneOperations operations - :vartype packet_core_control_plane: - azure.mgmt.mobilenetwork.aio.operations.PacketCoreControlPlaneOperations :ivar packet_core_control_plane_versions: PacketCoreControlPlaneVersionsOperations operations :vartype packet_core_control_plane_versions: azure.mgmt.mobilenetwork.aio.operations.PacketCoreControlPlaneVersionsOperations @@ -67,8 +62,6 @@ class MobileNetworkManagementClient: # pylint: disable=client-accepts-api-versi :vartype services: azure.mgmt.mobilenetwork.aio.operations.ServicesOperations :ivar sims: SimsOperations operations :vartype sims: azure.mgmt.mobilenetwork.aio.operations.SimsOperations - :ivar sim: SimOperations operations - :vartype sim: azure.mgmt.mobilenetwork.aio.operations.SimOperations :ivar sim_groups: SimGroupsOperations operations :vartype sim_groups: azure.mgmt.mobilenetwork.aio.operations.SimGroupsOperations :ivar sim_policies: SimPoliciesOperations operations @@ -115,9 +108,6 @@ def __init__( self.packet_core_control_planes = PacketCoreControlPlanesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.packet_core_control_plane = PacketCoreControlPlaneOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.packet_core_control_plane_versions = PacketCoreControlPlaneVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -126,7 +116,6 @@ def __init__( ) self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) self.sims = SimsOperations(self._client, self._config, self._serialize, self._deserialize) - self.sim = SimOperations(self._client, self._config, self._serialize, self._deserialize) self.sim_groups = SimGroupsOperations(self._client, self._config, self._serialize, self._deserialize) self.sim_policies = SimPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) self.sites = SitesOperations(self._client, self._config, self._serialize, self._deserialize) 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 3173a921e4c3..072372a6f784 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 @@ -11,12 +11,10 @@ from ._mobile_networks_operations import MobileNetworksOperations from ._operations import Operations from ._packet_core_control_planes_operations import PacketCoreControlPlanesOperations -from ._packet_core_control_plane_operations import PacketCoreControlPlaneOperations from ._packet_core_control_plane_versions_operations import PacketCoreControlPlaneVersionsOperations from ._packet_core_data_planes_operations import PacketCoreDataPlanesOperations from ._services_operations import ServicesOperations from ._sims_operations import SimsOperations -from ._sim_operations import SimOperations from ._sim_groups_operations import SimGroupsOperations from ._sim_policies_operations import SimPoliciesOperations from ._sites_operations import SitesOperations @@ -32,12 +30,10 @@ "MobileNetworksOperations", "Operations", "PacketCoreControlPlanesOperations", - "PacketCoreControlPlaneOperations", "PacketCoreControlPlaneVersionsOperations", "PacketCoreDataPlanesOperations", "ServicesOperations", "SimsOperations", - "SimOperations", "SimGroupsOperations", "SimPoliciesOperations", "SitesOperations", diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_control_plane_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_control_plane_operations.py deleted file mode 100644 index 5047231df3e6..000000000000 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_packet_core_control_plane_operations.py +++ /dev/null @@ -1,562 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -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_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_core_control_plane_operations import ( - build_collect_diagnostics_package_request, - build_reinstall_request, - build_rollback_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]] - - -class PacketCoreControlPlaneOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.mobilenetwork.aio.MobileNetworkManagementClient`'s - :attr:`packet_core_control_plane` 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 _rollback_initial( - self, resource_group_name: str, packet_core_control_plane_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: Literal["2022-11-01"] = 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( - resource_group_name=resource_group_name, - packet_core_control_plane_name=packet_core_control_plane_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._rollback_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 - - _rollback_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" - } - - @distributed_trace_async - async def begin_rollback( - self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Roll back the specified packet core control plane to the previous version, "rollbackVersion". - Multiple consecutive rollbacks are not possible. This action may cause a service outage. - - :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 - :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: Literal["2022-11-01"] = 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._rollback_initial( - resource_group_name=resource_group_name, - packet_core_control_plane_name=packet_core_control_plane_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_rollback.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" - } - - async def _reinstall_initial( - self, resource_group_name: str, packet_core_control_plane_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: Literal["2022-11-01"] = 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( - resource_group_name=resource_group_name, - packet_core_control_plane_name=packet_core_control_plane_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._reinstall_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 - - _reinstall_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" - } - - @distributed_trace_async - async def begin_reinstall( - self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Reinstall the specified packet core control plane. This action will remove any transaction - state from the packet core to return it to a known state. This action will cause a service - outage. - - :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 - :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: Literal["2022-11-01"] = 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._reinstall_initial( - resource_group_name=resource_group_name, - packet_core_control_plane_name=packet_core_control_plane_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_reinstall.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" - } - - async def _collect_diagnostics_package_initial( - self, - resource_group_name: str, - packet_core_control_plane_name: str, - parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO], - **kwargs: Any - ) -> Optional[_models.AsyncOperationStatus]: - 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: Literal["2022-11-01"] = 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)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PacketCoreControlPlaneCollectDiagnosticsPackage") - - request = build_collect_diagnostics_package_request( - resource_group_name=resource_group_name, - packet_core_control_plane_name=packet_core_control_plane_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._collect_diagnostics_package_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 - - _collect_diagnostics_package_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" - } - - @overload - async def begin_collect_diagnostics_package( - self, - resource_group_name: str, - packet_core_control_plane_name: str, - parameters: _models.PacketCoreControlPlaneCollectDiagnosticsPackage, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Collect a diagnostics package for the specified packet core control plane. This action will - upload the diagnostics to a storage account. - - :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 the packet core control plane collect diagnostics - package operation. Required. - :type parameters: - ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneCollectDiagnosticsPackage - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_collect_diagnostics_package( - self, - resource_group_name: str, - packet_core_control_plane_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Collect a diagnostics package for the specified packet core control plane. This action will - upload the diagnostics to a storage account. - - :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 the packet core control plane collect diagnostics - package 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 AsyncOperationStatus or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_collect_diagnostics_package( - self, - resource_group_name: str, - packet_core_control_plane_name: str, - parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Collect a diagnostics package for the specified packet core control plane. This action will - upload the diagnostics to a storage account. - - :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 the packet core control plane collect diagnostics - package operation. Is either a model 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'. - 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 AsyncOperationStatus or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._collect_diagnostics_package_initial( - resource_group_name=resource_group_name, - packet_core_control_plane_name=packet_core_control_plane_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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_collect_diagnostics_package.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" - } 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 9816e25ef3f8..409b951b3074 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 @@ -32,11 +32,14 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._packet_core_control_planes_operations import ( + build_collect_diagnostics_package_request, build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, + build_reinstall_request, + build_rollback_request, build_update_tags_request, ) @@ -810,3 +813,503 @@ async def get_next(next_link=None): list_by_resource_group.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes" } + + async def _rollback_initial( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + error_map = { + 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: Literal["2022-11-01"] = 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( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._rollback_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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 + + _rollback_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" + } + + @distributed_trace_async + async def begin_rollback( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Roll back the specified packet core control plane to the previous version, "rollbackVersion". + Multiple consecutive rollbacks are not possible. This action may cause a service outage. + + :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 + :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: Literal["2022-11-01"] = 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._rollback_initial( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_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_rollback.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" + } + + async def _reinstall_initial( + self, resource_group_name: str, packet_core_control_plane_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: Literal["2022-11-01"] = 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( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reinstall_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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 + + _reinstall_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" + } + + @distributed_trace_async + async def begin_reinstall( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Reinstall the specified packet core control plane. This action will remove any transaction + state from the packet core to return it to a known state. This action will cause a service + outage. + + :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 + :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: Literal["2022-11-01"] = 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._reinstall_initial( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_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_reinstall.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" + } + + async def _collect_diagnostics_package_initial( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO], + **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + 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: Literal["2022-11-01"] = 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)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PacketCoreControlPlaneCollectDiagnosticsPackage") + + request = build_collect_diagnostics_package_request( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._collect_diagnostics_package_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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 + + _collect_diagnostics_package_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" + } + + @overload + async def begin_collect_diagnostics_package( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + parameters: _models.PacketCoreControlPlaneCollectDiagnosticsPackage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Collect a diagnostics package for the specified packet core control plane. This action will + upload the diagnostics to a storage account. + + :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 the packet core control plane collect diagnostics + package operation. Required. + :type parameters: + ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneCollectDiagnosticsPackage + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_collect_diagnostics_package( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Collect a diagnostics package for the specified packet core control plane. This action will + upload the diagnostics to a storage account. + + :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 the packet core control plane collect diagnostics + package 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 AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_collect_diagnostics_package( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Collect a diagnostics package for the specified packet core control plane. This action will + upload the diagnostics to a storage account. + + :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 the packet core control plane collect diagnostics + package operation. Is either a model 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'. + 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 AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._collect_diagnostics_package_initial( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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_collect_diagnostics_package.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" + } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sim_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sim_operations.py deleted file mode 100644 index 9e3fec128b01..000000000000 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/aio/operations/_sim_operations.py +++ /dev/null @@ -1,742 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -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_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._sim_operations import ( - build_bulk_delete_request, - build_bulk_upload_encrypted_request, - build_bulk_upload_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]] - - -class SimOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.mobilenetwork.aio.MobileNetworkManagementClient`'s - :attr:`sim` 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 _bulk_upload_initial( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimUploadList, IO], **kwargs: Any - ) -> Optional[_models.AsyncOperationStatus]: - 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: Literal["2022-11-01"] = 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)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SimUploadList") - - request = build_bulk_upload_request( - resource_group_name=resource_group_name, - sim_group_name=sim_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._bulk_upload_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 - - _bulk_upload_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" - } - - @overload - async def begin_bulk_upload( - self, - resource_group_name: str, - sim_group_name: str, - parameters: _models.SimUploadList, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Bulk upload SIMs to a SIM group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sim_group_name: The name of the SIM Group. Required. - :type sim_group_name: str - :param parameters: Parameters supplied to the bulk SIM upload operation. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimUploadList - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_bulk_upload( - self, - resource_group_name: str, - sim_group_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Bulk upload SIMs to a SIM group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sim_group_name: The name of the SIM Group. Required. - :type sim_group_name: str - :param parameters: Parameters supplied to the bulk SIM upload 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 AsyncOperationStatus or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_bulk_upload( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimUploadList, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Bulk upload SIMs to a SIM group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sim_group_name: The name of the SIM Group. Required. - :type sim_group_name: str - :param parameters: Parameters supplied to the bulk SIM upload operation. Is either a model type - or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimUploadList or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._bulk_upload_initial( - resource_group_name=resource_group_name, - sim_group_name=sim_group_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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_bulk_upload.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" - } - - async def _bulk_delete_initial( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimDeleteList, IO], **kwargs: Any - ) -> Optional[_models.AsyncOperationStatus]: - 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: Literal["2022-11-01"] = 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)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SimDeleteList") - - request = build_bulk_delete_request( - resource_group_name=resource_group_name, - sim_group_name=sim_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._bulk_delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _bulk_delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" - } - - @overload - async def begin_bulk_delete( - self, - resource_group_name: str, - sim_group_name: str, - parameters: _models.SimDeleteList, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Bulk delete SIMs from a SIM group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sim_group_name: The name of the SIM Group. Required. - :type sim_group_name: str - :param parameters: Parameters supplied to the bulk SIM delete operation. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimDeleteList - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_bulk_delete( - self, - resource_group_name: str, - sim_group_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Bulk delete SIMs from a SIM group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sim_group_name: The name of the SIM Group. Required. - :type sim_group_name: str - :param parameters: Parameters supplied to the bulk SIM delete 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 AsyncOperationStatus or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_bulk_delete( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimDeleteList, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Bulk delete SIMs from a SIM group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sim_group_name: The name of the SIM Group. Required. - :type sim_group_name: str - :param parameters: Parameters supplied to the bulk SIM delete operation. Is either a model type - or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimDeleteList or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._bulk_delete_initial( - resource_group_name=resource_group_name, - sim_group_name=sim_group_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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_bulk_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" - } - - async def _bulk_upload_encrypted_initial( - self, - resource_group_name: str, - sim_group_name: str, - parameters: Union[_models.EncryptedSimUploadList, IO], - **kwargs: Any - ) -> Optional[_models.AsyncOperationStatus]: - 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: Literal["2022-11-01"] = 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)): - _content = parameters - else: - _json = self._serialize.body(parameters, "EncryptedSimUploadList") - - request = build_bulk_upload_encrypted_request( - resource_group_name=resource_group_name, - sim_group_name=sim_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._bulk_upload_encrypted_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 - - _bulk_upload_encrypted_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" - } - - @overload - async def begin_bulk_upload_encrypted( - self, - resource_group_name: str, - sim_group_name: str, - parameters: _models.EncryptedSimUploadList, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. - - :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 the encrypted SIMs upload operation. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.EncryptedSimUploadList - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_bulk_upload_encrypted( - self, - resource_group_name: str, - sim_group_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. - - :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 the encrypted SIMs upload 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 AsyncOperationStatus or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_bulk_upload_encrypted( - self, - resource_group_name: str, - sim_group_name: str, - parameters: Union[_models.EncryptedSimUploadList, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.AsyncOperationStatus]: - """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. - - :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 the encrypted SIMs upload operation. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.EncryptedSimUploadList or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._bulk_upload_encrypted_initial( - resource_group_name=resource_group_name, - sim_group_name=sim_group_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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_bulk_upload_encrypted.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" - } 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 f8f959f25851..8a48522df159 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 @@ -32,6 +32,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._sims_operations import ( + build_bulk_delete_request, + build_bulk_upload_encrypted_request, + build_bulk_upload_request, build_create_or_update_request, build_delete_request, build_get_request, @@ -588,3 +591,683 @@ async def get_next(next_link=None): list_by_group.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims" } + + async def _bulk_upload_initial( + self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimUploadList, IO], **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + 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: Literal["2022-11-01"] = 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)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SimUploadList") + + request = build_bulk_upload_request( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._bulk_upload_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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 + + _bulk_upload_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" + } + + @overload + async def begin_bulk_upload( + self, + resource_group_name: str, + sim_group_name: str, + parameters: _models.SimUploadList, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Bulk upload SIMs to a SIM group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to the bulk SIM upload operation. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimUploadList + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_bulk_upload( + self, + resource_group_name: str, + sim_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Bulk upload SIMs to a SIM group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to the bulk SIM upload 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 AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_bulk_upload( + self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimUploadList, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Bulk upload SIMs to a SIM group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to the bulk SIM upload operation. Is either a model type + or a IO type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimUploadList or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._bulk_upload_initial( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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_bulk_upload.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" + } + + async def _bulk_delete_initial( + self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimDeleteList, IO], **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + 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: Literal["2022-11-01"] = 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)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SimDeleteList") + + request = build_bulk_delete_request( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._bulk_delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _bulk_delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" + } + + @overload + async def begin_bulk_delete( + self, + resource_group_name: str, + sim_group_name: str, + parameters: _models.SimDeleteList, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Bulk delete SIMs from a SIM group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to the bulk SIM delete operation. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimDeleteList + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_bulk_delete( + self, + resource_group_name: str, + sim_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Bulk delete SIMs from a SIM group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to the bulk SIM delete 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 AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_bulk_delete( + self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimDeleteList, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Bulk delete SIMs from a SIM group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to the bulk SIM delete operation. Is either a model type + or a IO type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimDeleteList or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._bulk_delete_initial( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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_bulk_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" + } + + async def _bulk_upload_encrypted_initial( + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.EncryptedSimUploadList, IO], + **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + 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: Literal["2022-11-01"] = 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)): + _content = parameters + else: + _json = self._serialize.body(parameters, "EncryptedSimUploadList") + + request = build_bulk_upload_encrypted_request( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._bulk_upload_encrypted_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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 + + _bulk_upload_encrypted_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" + } + + @overload + async def begin_bulk_upload_encrypted( + self, + resource_group_name: str, + sim_group_name: str, + parameters: _models.EncryptedSimUploadList, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. + + :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 the encrypted SIMs upload operation. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.EncryptedSimUploadList + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_bulk_upload_encrypted( + self, + resource_group_name: str, + sim_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. + + :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 the encrypted SIMs upload 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 AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_bulk_upload_encrypted( + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.EncryptedSimUploadList, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.AsyncOperationStatus]: + """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. + + :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 the encrypted SIMs upload operation. Is either a + model type or a IO type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.EncryptedSimUploadList or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AsyncOperationStatus or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._bulk_upload_encrypted_initial( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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_bulk_upload_encrypted.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" + } 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 5e10313e04f9..d2567bae1138 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,40 @@ 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 + """2 Gbps, 200 active SIMs plan, 10 RANs""" G3 = "G3" - #: 4 Gbps, 400 active SIMs plan + """3 Gbps, 300 active SIMs plan""" G4 = "G4" - #: 5 Gbps, 500 active SIMs plan + """4 Gbps, 400 active SIMs plan""" 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).""" - #: 5G core FIVE_GC = "5GC" - #: EPC / 4G core + """5G core""" EPC = "EPC" + """EPC / 4G core""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -72,24 +72,24 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): 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): @@ -106,19 +106,19 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): 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 PduSessionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -131,30 +131,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 +174,72 @@ 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 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 0f4ee43562ce..2d2900456f3d 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 @@ -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,7 +269,8 @@ 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. @@ -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,7 +323,8 @@ 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. @@ -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 @@ -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 @@ -1124,8 +1120,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 +1204,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 +1254,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 +1294,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 +1305,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 +1316,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 +1349,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. @@ -1383,8 +1380,8 @@ def __init__( *, state: Optional[Union[str, "_models.InstallationState"]] = None, operation: Optional["_models.AsyncOperationId"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword state: Installation state. Known values are: "Uninstalled", "Installing", "Installed", "Updating", "Upgrading", "Uninstalling", "Reinstalling", "RollingBack", and "Failed". @@ -1437,8 +1434,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 +1466,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 +1477,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 +1504,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". @@ -1564,8 +1562,8 @@ 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 @@ -1651,8 +1649,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 +1689,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 +1719,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 +1772,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 +1828,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 +1867,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,7 +1908,7 @@ 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 @@ -2039,8 +2037,8 @@ def __init__( version: Optional[str] = None, ue_mtu: int = 1440, interop_settings: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2110,7 +2108,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 +2138,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] @@ -2151,7 +2149,8 @@ def __init__(self, *, value: Optional[List["_models.PacketCoreControlPlane"]] = class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + """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. @@ -2182,7 +2181,7 @@ class ProxyResource(Resource): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -2228,7 +2227,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 +2257,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,7 +2268,8 @@ 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. @@ -2326,8 +2326,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 +2362,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] @@ -2424,8 +2424,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 +2460,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 +2508,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 +2549,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 +2603,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 +2669,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 +2727,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 +2808,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 +2858,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 +2873,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 +2892,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 +2905,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 +2926,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. @@ -3019,8 +3009,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 +3096,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 +3156,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 +3186,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 @@ -3308,8 +3298,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 +3355,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] @@ -3438,8 +3428,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 +3470,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 +3500,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 +3529,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 +3623,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 +3752,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 @@ -3893,8 +3883,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] @@ -3948,7 +3938,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 +3968,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 +4058,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 +4122,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 +4162,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 +4189,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] @@ -4259,7 +4249,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] @@ -4291,7 +4281,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 +4311,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 @@ -4391,8 +4381,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 +4436,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 +4477,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 +4507,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 +4537,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 +4566,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 +4612,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 +4650,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 +4680,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 3173a921e4c3..072372a6f784 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 @@ -11,12 +11,10 @@ from ._mobile_networks_operations import MobileNetworksOperations from ._operations import Operations from ._packet_core_control_planes_operations import PacketCoreControlPlanesOperations -from ._packet_core_control_plane_operations import PacketCoreControlPlaneOperations from ._packet_core_control_plane_versions_operations import PacketCoreControlPlaneVersionsOperations from ._packet_core_data_planes_operations import PacketCoreDataPlanesOperations from ._services_operations import ServicesOperations from ._sims_operations import SimsOperations -from ._sim_operations import SimOperations from ._sim_groups_operations import SimGroupsOperations from ._sim_policies_operations import SimPoliciesOperations from ._sites_operations import SitesOperations @@ -32,12 +30,10 @@ "MobileNetworksOperations", "Operations", "PacketCoreControlPlanesOperations", - "PacketCoreControlPlaneOperations", "PacketCoreControlPlaneVersionsOperations", "PacketCoreDataPlanesOperations", "ServicesOperations", "SimsOperations", - "SimOperations", "SimGroupsOperations", "SimPoliciesOperations", "SitesOperations", diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_control_plane_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_control_plane_operations.py deleted file mode 100644 index 0b9eb8408ffa..000000000000 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_packet_core_control_plane_operations.py +++ /dev/null @@ -1,676 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.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 - -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]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_rollback_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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "packetCoreControlPlaneName": _SERIALIZER.url( - "packet_core_control_plane_name", - packet_core_control_plane_name, - "str", - max_length=64, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reinstall_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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "packetCoreControlPlaneName": _SERIALIZER.url( - "packet_core_control_plane_name", - packet_core_control_plane_name, - "str", - max_length=64, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_collect_diagnostics_package_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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-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}/collectDiagnosticsPackage", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "packetCoreControlPlaneName": _SERIALIZER.url( - "packet_core_control_plane_name", - packet_core_control_plane_name, - "str", - max_length=64, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - 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 PacketCoreControlPlaneOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.mobilenetwork.MobileNetworkManagementClient`'s - :attr:`packet_core_control_plane` 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 _rollback_initial( - self, resource_group_name: str, packet_core_control_plane_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: Literal["2022-11-01"] = 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( - resource_group_name=resource_group_name, - packet_core_control_plane_name=packet_core_control_plane_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._rollback_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 - - _rollback_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" - } - - @distributed_trace - def begin_rollback( - self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Roll back the specified packet core control plane to the previous version, "rollbackVersion". - Multiple consecutive rollbacks are not possible. This action may cause a service outage. - - :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 - :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: Literal["2022-11-01"] = 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._rollback_initial( - resource_group_name=resource_group_name, - packet_core_control_plane_name=packet_core_control_plane_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_rollback.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" - } - - def _reinstall_initial( - self, resource_group_name: str, packet_core_control_plane_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: Literal["2022-11-01"] = 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( - resource_group_name=resource_group_name, - packet_core_control_plane_name=packet_core_control_plane_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._reinstall_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 - - _reinstall_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" - } - - @distributed_trace - def begin_reinstall( - self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Reinstall the specified packet core control plane. This action will remove any transaction - state from the packet core to return it to a known state. This action will cause a service - outage. - - :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 - :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: Literal["2022-11-01"] = 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._reinstall_initial( - resource_group_name=resource_group_name, - packet_core_control_plane_name=packet_core_control_plane_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_reinstall.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" - } - - def _collect_diagnostics_package_initial( - self, - resource_group_name: str, - packet_core_control_plane_name: str, - parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO], - **kwargs: Any - ) -> Optional[_models.AsyncOperationStatus]: - 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: Literal["2022-11-01"] = 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)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PacketCoreControlPlaneCollectDiagnosticsPackage") - - request = build_collect_diagnostics_package_request( - resource_group_name=resource_group_name, - packet_core_control_plane_name=packet_core_control_plane_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._collect_diagnostics_package_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 - - _collect_diagnostics_package_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" - } - - @overload - def begin_collect_diagnostics_package( - self, - resource_group_name: str, - packet_core_control_plane_name: str, - parameters: _models.PacketCoreControlPlaneCollectDiagnosticsPackage, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Collect a diagnostics package for the specified packet core control plane. This action will - upload the diagnostics to a storage account. - - :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 the packet core control plane collect diagnostics - package operation. Required. - :type parameters: - ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneCollectDiagnosticsPackage - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_collect_diagnostics_package( - self, - resource_group_name: str, - packet_core_control_plane_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Collect a diagnostics package for the specified packet core control plane. This action will - upload the diagnostics to a storage account. - - :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 the packet core control plane collect diagnostics - package 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 AsyncOperationStatus or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_collect_diagnostics_package( - self, - resource_group_name: str, - packet_core_control_plane_name: str, - parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO], - **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Collect a diagnostics package for the specified packet core control plane. This action will - upload the diagnostics to a storage account. - - :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 the packet core control plane collect diagnostics - package operation. Is either a model 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'. - 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 AsyncOperationStatus or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._collect_diagnostics_package_initial( - resource_group_name=resource_group_name, - packet_core_control_plane_name=packet_core_control_plane_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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_collect_diagnostics_package.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" - } 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 a1477ad93b45..e32e6119b376 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 @@ -261,6 +261,126 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_rollback_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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "packetCoreControlPlaneName": _SERIALIZER.url( + "packet_core_control_plane_name", + packet_core_control_plane_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_reinstall_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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "packetCoreControlPlaneName": _SERIALIZER.url( + "packet_core_control_plane_name", + packet_core_control_plane_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_collect_diagnostics_package_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: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-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}/collectDiagnosticsPackage", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "packetCoreControlPlaneName": _SERIALIZER.url( + "packet_core_control_plane_name", + packet_core_control_plane_name, + "str", + max_length=64, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + 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 PacketCoreControlPlanesOperations: """ .. warning:: @@ -1017,3 +1137,498 @@ def get_next(next_link=None): list_by_resource_group.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes" } + + def _rollback_initial( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + error_map = { + 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: Literal["2022-11-01"] = 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( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._rollback_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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 + + _rollback_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" + } + + @distributed_trace + def begin_rollback( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Roll back the specified packet core control plane to the previous version, "rollbackVersion". + Multiple consecutive rollbacks are not possible. This action may cause a service outage. + + :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 + :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: Literal["2022-11-01"] = 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._rollback_initial( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_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_rollback.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/rollback" + } + + def _reinstall_initial( + self, resource_group_name: str, packet_core_control_plane_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: Literal["2022-11-01"] = 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( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._reinstall_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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 + + _reinstall_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" + } + + @distributed_trace + def begin_reinstall( + self, resource_group_name: str, packet_core_control_plane_name: str, **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Reinstall the specified packet core control plane. This action will remove any transaction + state from the packet core to return it to a known state. This action will cause a service + outage. + + :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 + :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: Literal["2022-11-01"] = 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._reinstall_initial( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_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_reinstall.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/reinstall" + } + + def _collect_diagnostics_package_initial( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO], + **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + 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: Literal["2022-11-01"] = 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)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PacketCoreControlPlaneCollectDiagnosticsPackage") + + request = build_collect_diagnostics_package_request( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._collect_diagnostics_package_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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 + + _collect_diagnostics_package_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" + } + + @overload + def begin_collect_diagnostics_package( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + parameters: _models.PacketCoreControlPlaneCollectDiagnosticsPackage, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Collect a diagnostics package for the specified packet core control plane. This action will + upload the diagnostics to a storage account. + + :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 the packet core control plane collect diagnostics + package operation. Required. + :type parameters: + ~azure.mgmt.mobilenetwork.models.PacketCoreControlPlaneCollectDiagnosticsPackage + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_collect_diagnostics_package( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Collect a diagnostics package for the specified packet core control plane. This action will + upload the diagnostics to a storage account. + + :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 the packet core control plane collect diagnostics + package 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 AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_collect_diagnostics_package( + self, + resource_group_name: str, + packet_core_control_plane_name: str, + parameters: Union[_models.PacketCoreControlPlaneCollectDiagnosticsPackage, IO], + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Collect a diagnostics package for the specified packet core control plane. This action will + upload the diagnostics to a storage account. + + :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 the packet core control plane collect diagnostics + package operation. Is either a model 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'. + 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 AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._collect_diagnostics_package_initial( + resource_group_name=resource_group_name, + packet_core_control_plane_name=packet_core_control_plane_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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_collect_diagnostics_package.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/{packetCoreControlPlaneName}/collectDiagnosticsPackage" + } diff --git a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sim_operations.py b/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sim_operations.py deleted file mode 100644 index 7df28e3a708a..000000000000 --- a/sdk/mobilenetwork/azure-mgmt-mobilenetwork/azure/mgmt/mobilenetwork/operations/_sim_operations.py +++ /dev/null @@ -1,846 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.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 - -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]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_bulk_upload_request( - resource_group_name: str, sim_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "simGroupName": _SERIALIZER.url( - "sim_group_name", sim_group_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" - ), - } - - _url: str = _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) - - -def build_bulk_delete_request( - resource_group_name: str, sim_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "simGroupName": _SERIALIZER.url( - "sim_group_name", sim_group_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" - ), - } - - _url: str = _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) - - -def build_bulk_upload_encrypted_request( - resource_group_name: str, sim_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "simGroupName": _SERIALIZER.url( - "sim_group_name", sim_group_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" - ), - } - - _url: str = _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 SimOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.mobilenetwork.MobileNetworkManagementClient`'s - :attr:`sim` 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 _bulk_upload_initial( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimUploadList, IO], **kwargs: Any - ) -> Optional[_models.AsyncOperationStatus]: - 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: Literal["2022-11-01"] = 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)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SimUploadList") - - request = build_bulk_upload_request( - resource_group_name=resource_group_name, - sim_group_name=sim_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._bulk_upload_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 - - _bulk_upload_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" - } - - @overload - def begin_bulk_upload( - self, - resource_group_name: str, - sim_group_name: str, - parameters: _models.SimUploadList, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Bulk upload SIMs to a SIM group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sim_group_name: The name of the SIM Group. Required. - :type sim_group_name: str - :param parameters: Parameters supplied to the bulk SIM upload operation. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimUploadList - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_bulk_upload( - self, - resource_group_name: str, - sim_group_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Bulk upload SIMs to a SIM group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sim_group_name: The name of the SIM Group. Required. - :type sim_group_name: str - :param parameters: Parameters supplied to the bulk SIM upload 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 AsyncOperationStatus or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_bulk_upload( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimUploadList, IO], **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Bulk upload SIMs to a SIM group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sim_group_name: The name of the SIM Group. Required. - :type sim_group_name: str - :param parameters: Parameters supplied to the bulk SIM upload operation. Is either a model type - or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimUploadList or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._bulk_upload_initial( - resource_group_name=resource_group_name, - sim_group_name=sim_group_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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_bulk_upload.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" - } - - def _bulk_delete_initial( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimDeleteList, IO], **kwargs: Any - ) -> Optional[_models.AsyncOperationStatus]: - 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: Literal["2022-11-01"] = 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)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SimDeleteList") - - request = build_bulk_delete_request( - resource_group_name=resource_group_name, - sim_group_name=sim_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._bulk_delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _bulk_delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" - } - - @overload - def begin_bulk_delete( - self, - resource_group_name: str, - sim_group_name: str, - parameters: _models.SimDeleteList, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Bulk delete SIMs from a SIM group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sim_group_name: The name of the SIM Group. Required. - :type sim_group_name: str - :param parameters: Parameters supplied to the bulk SIM delete operation. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimDeleteList - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_bulk_delete( - self, - resource_group_name: str, - sim_group_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Bulk delete SIMs from a SIM group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sim_group_name: The name of the SIM Group. Required. - :type sim_group_name: str - :param parameters: Parameters supplied to the bulk SIM delete 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 AsyncOperationStatus or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_bulk_delete( - self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimDeleteList, IO], **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Bulk delete SIMs from a SIM group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param sim_group_name: The name of the SIM Group. Required. - :type sim_group_name: str - :param parameters: Parameters supplied to the bulk SIM delete operation. Is either a model type - or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.SimDeleteList or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._bulk_delete_initial( - resource_group_name=resource_group_name, - sim_group_name=sim_group_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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_bulk_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" - } - - def _bulk_upload_encrypted_initial( - self, - resource_group_name: str, - sim_group_name: str, - parameters: Union[_models.EncryptedSimUploadList, IO], - **kwargs: Any - ) -> Optional[_models.AsyncOperationStatus]: - 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: Literal["2022-11-01"] = 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)): - _content = parameters - else: - _json = self._serialize.body(parameters, "EncryptedSimUploadList") - - request = build_bulk_upload_encrypted_request( - resource_group_name=resource_group_name, - sim_group_name=sim_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._bulk_upload_encrypted_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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 - - _bulk_upload_encrypted_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" - } - - @overload - def begin_bulk_upload_encrypted( - self, - resource_group_name: str, - sim_group_name: str, - parameters: _models.EncryptedSimUploadList, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. - - :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 the encrypted SIMs upload operation. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.EncryptedSimUploadList - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_bulk_upload_encrypted( - self, - resource_group_name: str, - sim_group_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. - - :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 the encrypted SIMs upload 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 AsyncOperationStatus or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_bulk_upload_encrypted( - self, - resource_group_name: str, - sim_group_name: str, - parameters: Union[_models.EncryptedSimUploadList, IO], - **kwargs: Any - ) -> LROPoller[_models.AsyncOperationStatus]: - """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. - - :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 the encrypted SIMs upload operation. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.mobilenetwork.models.EncryptedSimUploadList or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-11-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._bulk_upload_encrypted_initial( - resource_group_name=resource_group_name, - sim_group_name=sim_group_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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_bulk_upload_encrypted.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" - } 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 87fcd7093275..920c1ac25a53 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 @@ -189,6 +189,120 @@ def build_list_by_group_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_bulk_upload_request( + resource_group_name: str, sim_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "simGroupName": _SERIALIZER.url( + "sim_group_name", sim_group_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _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) + + +def build_bulk_delete_request( + resource_group_name: str, sim_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "simGroupName": _SERIALIZER.url( + "sim_group_name", sim_group_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _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) + + +def build_bulk_upload_encrypted_request( + resource_group_name: str, sim_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-11-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "simGroupName": _SERIALIZER.url( + "sim_group_name", sim_group_name, "str", max_length=64, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]*$" + ), + } + + _url: str = _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 SimsOperations: """ .. warning:: @@ -728,3 +842,674 @@ def get_next(next_link=None): list_by_group.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/sims" } + + def _bulk_upload_initial( + self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimUploadList, IO], **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + 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: Literal["2022-11-01"] = 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)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SimUploadList") + + request = build_bulk_upload_request( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._bulk_upload_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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 + + _bulk_upload_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" + } + + @overload + def begin_bulk_upload( + self, + resource_group_name: str, + sim_group_name: str, + parameters: _models.SimUploadList, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Bulk upload SIMs to a SIM group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to the bulk SIM upload operation. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimUploadList + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_bulk_upload( + self, + resource_group_name: str, + sim_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Bulk upload SIMs to a SIM group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to the bulk SIM upload 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 AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_bulk_upload( + self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimUploadList, IO], **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Bulk upload SIMs to a SIM group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to the bulk SIM upload operation. Is either a model type + or a IO type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimUploadList or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._bulk_upload_initial( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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_bulk_upload.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadSims" + } + + def _bulk_delete_initial( + self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimDeleteList, IO], **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + 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: Literal["2022-11-01"] = 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)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SimDeleteList") + + request = build_bulk_delete_request( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._bulk_delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _bulk_delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" + } + + @overload + def begin_bulk_delete( + self, + resource_group_name: str, + sim_group_name: str, + parameters: _models.SimDeleteList, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Bulk delete SIMs from a SIM group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to the bulk SIM delete operation. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimDeleteList + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_bulk_delete( + self, + resource_group_name: str, + sim_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Bulk delete SIMs from a SIM group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to the bulk SIM delete 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 AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_bulk_delete( + self, resource_group_name: str, sim_group_name: str, parameters: Union[_models.SimDeleteList, IO], **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Bulk delete SIMs from a SIM group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param sim_group_name: The name of the SIM Group. Required. + :type sim_group_name: str + :param parameters: Parameters supplied to the bulk SIM delete operation. Is either a model type + or a IO type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.SimDeleteList or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._bulk_delete_initial( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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_bulk_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/deleteSims" + } + + def _bulk_upload_encrypted_initial( + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.EncryptedSimUploadList, IO], + **kwargs: Any + ) -> Optional[_models.AsyncOperationStatus]: + 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: Literal["2022-11-01"] = 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)): + _content = parameters + else: + _json = self._serialize.body(parameters, "EncryptedSimUploadList") + + request = build_bulk_upload_encrypted_request( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._bulk_upload_encrypted_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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 + + _bulk_upload_encrypted_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" + } + + @overload + def begin_bulk_upload_encrypted( + self, + resource_group_name: str, + sim_group_name: str, + parameters: _models.EncryptedSimUploadList, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. + + :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 the encrypted SIMs upload operation. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.EncryptedSimUploadList + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_bulk_upload_encrypted( + self, + resource_group_name: str, + sim_group_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. + + :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 the encrypted SIMs upload 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 AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_bulk_upload_encrypted( + self, + resource_group_name: str, + sim_group_name: str, + parameters: Union[_models.EncryptedSimUploadList, IO], + **kwargs: Any + ) -> LROPoller[_models.AsyncOperationStatus]: + """Bulk upload SIMs in encrypted form to a SIM group. The SIM credentials must be encrypted. + + :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 the encrypted SIMs upload operation. Is either a + model type or a IO type. Required. + :type parameters: ~azure.mgmt.mobilenetwork.models.EncryptedSimUploadList or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AsyncOperationStatus or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.mobilenetwork.models.AsyncOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-11-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AsyncOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._bulk_upload_encrypted_initial( + resource_group_name=resource_group_name, + sim_group_name=sim_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("AsyncOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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_bulk_upload_encrypted.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileNetwork/simGroups/{simGroupName}/uploadEncryptedSims" + } 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 f12ed92c7bf4..2c5e324cad09 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 @@ -29,7 +29,7 @@ def main(): subscription_id="subid", ) - response = client.packet_core_control_plane.begin_collect_diagnostics_package( + response = client.packet_core_control_planes.begin_collect_diagnostics_package( resource_group_name="rg1", packet_core_control_plane_name="TestPacketCoreCP", parameters={ 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 c9c09667f10c..b7d19822436e 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 @@ -29,7 +29,7 @@ def main(): subscription_id="subid", ) - response = client.packet_core_control_plane.begin_reinstall( + response = client.packet_core_control_planes.begin_reinstall( resource_group_name="rg1", packet_core_control_plane_name="TestPacketCoreCP", ).result() 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 e74d736a73fb..a0b8fc36772c 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 @@ -29,7 +29,7 @@ def main(): subscription_id="subid", ) - response = client.packet_core_control_plane.begin_rollback( + response = client.packet_core_control_planes.begin_rollback( resource_group_name="rg1", packet_core_control_plane_name="TestPacketCoreCP", ).result() 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 2f76a3805a54..510baee3b72f 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 @@ -29,7 +29,7 @@ def main(): subscription_id="subid", ) - response = client.sim.begin_bulk_delete( + response = client.sims.begin_bulk_delete( resource_group_name="testResourceGroupName", sim_group_name="testSimGroup", parameters={"sims": ["testSim", "testSim2"]}, 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 299d046dc50e..daa807a3fd00 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 @@ -29,7 +29,7 @@ def main(): subscription_id="subid", ) - response = client.sim.begin_bulk_upload( + response = client.sims.begin_bulk_upload( resource_group_name="rg1", sim_group_name="testSimGroup", parameters={ 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 f5304c45a0ea..11a7c4169dea 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 @@ -29,7 +29,7 @@ def main(): subscription_id="subid", ) - response = client.sim.begin_bulk_upload_encrypted( + response = client.sims.begin_bulk_upload_encrypted( resource_group_name="rg1", sim_group_name="testSimGroup", parameters={