diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/README.md b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/README.md index 785809972f9a..5b1285d6b1b2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/README.md +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Paloaltonetworksngfw Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_meta.json b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_meta.json index 12fe0d5e02b1..0ce12c7d543b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_meta.json +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/_meta.json @@ -1,11 +1,11 @@ { - "commit": "7c906b15744aaf7b782dfb82ccefcbef05cbf20b", + "commit": "35bc4cba2e7ada56be676bf7a2b263fe904e73e5", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.27.4", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/paloaltonetworks/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/paloaltonetworks/resource-manager/readme.md --generate-sample=True --generate-test=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.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/paloaltonetworks/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/__init__.py index d11a9719d50b..f7f6023b3ee3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._palo_alto_networks_ngfw_mgmt_client import PaloAltoNetworksNgfwMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._palo_alto_networks_ngfw_mgmt_client import PaloAltoNetworksNgfwMgmtClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "PaloAltoNetworksNgfwMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py index 7e69dd76f260..e89a59472df3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_configuration.py @@ -8,18 +8,16 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class PaloAltoNetworksNgfwMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class PaloAltoNetworksNgfwMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for PaloAltoNetworksNgfwMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +27,13 @@ class PaloAltoNetworksNgfwMgmtClientConfiguration(Configuration): # pylint: dis :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-02-06-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(PaloAltoNetworksNgfwMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-09-01") + api_version: str = kwargs.pop("api_version", "2025-02-06-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +45,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-paloaltonetworksngfw/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_palo_alto_networks_ngfw_mgmt_client.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_palo_alto_networks_ngfw_mgmt_client.py index aae495a25e03..3416d400b308 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_palo_alto_networks_ngfw_mgmt_client.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_palo_alto_networks_ngfw_mgmt_client.py @@ -8,9 +8,12 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration @@ -26,6 +29,7 @@ LocalRulesOperations, LocalRulestacksOperations, Operations, + PaloAltoNetworksCloudngfwOperations, PostRulesOperations, PreRulesOperations, PrefixListGlobalRulestackOperations, @@ -33,11 +37,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=too-many-instance-attributes """PaloAltoNetworksNgfwMgmtClient. :ivar global_rulestack: GlobalRulestackOperations operations @@ -58,6 +61,9 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers :vartype pre_rules: azure.mgmt.paloaltonetworksngfw.operations.PreRulesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.paloaltonetworksngfw.operations.Operations + :ivar palo_alto_networks_cloudngfw: PaloAltoNetworksCloudngfwOperations operations + :vartype palo_alto_networks_cloudngfw: + azure.mgmt.paloaltonetworksngfw.operations.PaloAltoNetworksCloudngfwOperations :ivar firewalls: FirewallsOperations operations :vartype firewalls: azure.mgmt.paloaltonetworksngfw.operations.FirewallsOperations :ivar local_rulestacks: LocalRulestacksOperations operations @@ -81,8 +87,8 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-02-06-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -98,7 +104,25 @@ def __init__( self._config = PaloAltoNetworksNgfwMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -119,6 +143,9 @@ def __init__( ) self.pre_rules = PreRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.palo_alto_networks_cloudngfw = PaloAltoNetworksCloudngfwOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.firewalls = FirewallsOperations(self._client, self._config, self._serialize, self._deserialize) self.local_rulestacks = LocalRulestacksOperations( self._client, self._config, self._serialize, self._deserialize @@ -135,7 +162,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -155,12 +182,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() - def __enter__(self) -> "PaloAltoNetworksNgfwMgmtClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_serialization.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_serialization.py index 4bae2292227b..b24ab2885450 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_serialization.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_serialization.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -24,7 +25,6 @@ # # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -52,7 +52,6 @@ MutableMapping, Type, List, - Mapping, ) try: @@ -63,8 +62,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -91,6 +90,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +113,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -124,7 +125,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +144,9 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -153,6 +156,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -170,13 +178,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -189,15 +190,30 @@ class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" def utcoffset(self, dt): - """UTF offset for UTC is 0.""" + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ return datetime.timedelta(0) def tzname(self, dt): - """Timestamp representation.""" + """Timestamp representation. + + :param datetime.datetime dt: The datetime + :returns: The timestamp representation + :rtype: str + """ return "Z" def dst(self, dt): - """No daylight saving for UTC.""" + """No daylight saving for UTC. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ return datetime.timedelta(hours=1) @@ -211,7 +227,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore :param datetime.timedelta offset: offset in timedelta format """ - def __init__(self, offset): + def __init__(self, offset) -> None: self.__offset = offset def utcoffset(self, dt): @@ -240,24 +256,26 @@ def __getinitargs__(self): _FLATTEN = re.compile(r"(? None: - self.additional_properties: Dict[str, Any] = {} - for k in kwargs: + self.additional_properties: Optional[Dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items 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__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -305,13 +330,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -331,7 +366,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -340,7 +379,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +390,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -385,12 +426,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -400,7 +444,7 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @@ -413,9 +457,10 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -431,9 +476,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -445,7 +492,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -453,21 +500,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -506,11 +557,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -545,7 +598,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,17 +614,20 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict :raises: SerializationError if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -597,12 +653,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -638,7 +696,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -649,7 +708,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,18 +727,18 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) - else: - return serialized + raise SerializationError(msg) from err + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict :raises: SerializationError if serialization fails. :raises: ValueError if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -708,18 +767,20 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str + :returns: The serialized URL path :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -730,30 +791,30 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -763,19 +824,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -784,32 +846,31 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None :raises: AttributeError if required data is None. :raises: ValueError if data is None :raises: SerializationError if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -824,12 +885,11 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) - else: - return self._serialize(data, **kwargs) + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -845,23 +905,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -875,8 +938,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -886,15 +948,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -949,9 +1009,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -975,7 +1034,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -983,6 +1042,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -993,7 +1053,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1007,7 +1067,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1038,56 +1098,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1095,11 +1160,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1109,30 +1175,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: TypeError if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1145,12 +1213,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: SerializationError if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1170,19 +1239,20 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int :raises: SerializationError if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1190,11 +1260,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1209,14 +1279,15 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1230,7 +1301,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1238,17 +1308,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1285,7 +1367,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1337,22 +1419,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1360,7 +1441,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1369,9 +1450,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - 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}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1472,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1409,11 +1490,12 @@ def __call__(self, target_obj, response_data, content_type=None): :param str content_type: Swagger "produces" if available. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree @@ -1422,12 +1504,13 @@ def _deserialize(self, target_obj, data): :param object data: Object to deserialize. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1444,15 +1527,15 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1481,10 +1564,9 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1511,18 +1593,20 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1537,10 +1621,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1558,10 +1644,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1578,31 +1666,42 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1611,15 +1710,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1633,7 +1733,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1652,15 +1756,15 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) - else: - return self._deserialize(obj_type, data) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1677,6 +1781,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1687,11 +1792,12 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict :raises: TypeError if non-builtin datatype encountered. """ @@ -1700,7 +1806,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1726,11 +1832,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1738,6 +1843,7 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool :raises: TypeError if string format is not valid. """ @@ -1749,24 +1855,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1774,6 +1879,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1787,8 +1893,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1800,6 +1905,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1808,12 +1914,11 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1829,6 +1934,7 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1841,6 +1947,7 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1856,22 +1963,24 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal + :return: Deserialized decimal :raises: DeserializationError if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int :raises: ValueError if string format invalid. """ @@ -1884,6 +1993,7 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta :raises: DeserializationError if string format invalid. """ @@ -1893,15 +2003,15 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) - else: - return duration + raise DeserializationError(msg) from err + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date :raises: DeserializationError if string format invalid. """ @@ -1910,13 +2020,14 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time :raises: DeserializationError if string format invalid. """ @@ -1931,6 +2042,7 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1945,15 +2057,15 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1982,9 +2094,8 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj @staticmethod def deserialize_unix(attr): @@ -1992,15 +2103,16 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_vendor.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_version.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_version.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/__init__.py index dbb1355bf320..6895cdf82b34 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._palo_alto_networks_ngfw_mgmt_client import PaloAltoNetworksNgfwMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._palo_alto_networks_ngfw_mgmt_client import PaloAltoNetworksNgfwMgmtClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "PaloAltoNetworksNgfwMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_configuration.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_configuration.py index b436ff93ee90..1cccbaf6a372 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_configuration.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_configuration.py @@ -8,18 +8,16 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class PaloAltoNetworksNgfwMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class PaloAltoNetworksNgfwMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for PaloAltoNetworksNgfwMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +27,13 @@ class PaloAltoNetworksNgfwMgmtClientConfiguration(Configuration): # pylint: dis :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-02-06-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(PaloAltoNetworksNgfwMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-09-01") + api_version: str = kwargs.pop("api_version", "2025-02-06-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +45,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-paloaltonetworksngfw/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_palo_alto_networks_ngfw_mgmt_client.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_palo_alto_networks_ngfw_mgmt_client.py index ce71a100f71f..59020fb39c24 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_palo_alto_networks_ngfw_mgmt_client.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/_palo_alto_networks_ngfw_mgmt_client.py @@ -8,9 +8,12 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -26,6 +29,7 @@ LocalRulesOperations, LocalRulestacksOperations, Operations, + PaloAltoNetworksCloudngfwOperations, PostRulesOperations, PreRulesOperations, PrefixListGlobalRulestackOperations, @@ -33,11 +37,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=too-many-instance-attributes """PaloAltoNetworksNgfwMgmtClient. :ivar global_rulestack: GlobalRulestackOperations operations @@ -59,6 +62,9 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers :vartype pre_rules: azure.mgmt.paloaltonetworksngfw.aio.operations.PreRulesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.paloaltonetworksngfw.aio.operations.Operations + :ivar palo_alto_networks_cloudngfw: PaloAltoNetworksCloudngfwOperations operations + :vartype palo_alto_networks_cloudngfw: + azure.mgmt.paloaltonetworksngfw.aio.operations.PaloAltoNetworksCloudngfwOperations :ivar firewalls: FirewallsOperations operations :vartype firewalls: azure.mgmt.paloaltonetworksngfw.aio.operations.FirewallsOperations :ivar local_rulestacks: LocalRulestacksOperations operations @@ -84,8 +90,8 @@ class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-vers :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-09-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-02-06-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -101,7 +107,25 @@ def __init__( self._config = PaloAltoNetworksNgfwMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -122,6 +146,9 @@ def __init__( ) self.pre_rules = PreRulesOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.palo_alto_networks_cloudngfw = PaloAltoNetworksCloudngfwOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.firewalls = FirewallsOperations(self._client, self._config, self._serialize, self._deserialize) self.local_rulestacks = LocalRulestacksOperations( self._client, self._config, self._serialize, self._deserialize @@ -138,7 +165,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -158,12 +187,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "PaloAltoNetworksNgfwMgmtClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/__init__.py index 72bdc9199a7f..3875b679c3ed 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/__init__.py @@ -5,24 +5,31 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._global_rulestack_operations import GlobalRulestackOperations -from ._certificate_object_global_rulestack_operations import CertificateObjectGlobalRulestackOperations -from ._fqdn_list_global_rulestack_operations import FqdnListGlobalRulestackOperations -from ._post_rules_operations import PostRulesOperations -from ._prefix_list_global_rulestack_operations import PrefixListGlobalRulestackOperations -from ._pre_rules_operations import PreRulesOperations -from ._operations import Operations -from ._firewalls_operations import FirewallsOperations -from ._local_rulestacks_operations import LocalRulestacksOperations -from ._firewall_status_operations import FirewallStatusOperations -from ._certificate_object_local_rulestack_operations import CertificateObjectLocalRulestackOperations -from ._fqdn_list_local_rulestack_operations import FqdnListLocalRulestackOperations -from ._local_rules_operations import LocalRulesOperations -from ._prefix_list_local_rulestack_operations import PrefixListLocalRulestackOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._global_rulestack_operations import GlobalRulestackOperations # type: ignore +from ._certificate_object_global_rulestack_operations import CertificateObjectGlobalRulestackOperations # type: ignore +from ._fqdn_list_global_rulestack_operations import FqdnListGlobalRulestackOperations # type: ignore +from ._post_rules_operations import PostRulesOperations # type: ignore +from ._prefix_list_global_rulestack_operations import PrefixListGlobalRulestackOperations # type: ignore +from ._pre_rules_operations import PreRulesOperations # type: ignore +from ._operations import Operations # type: ignore +from ._palo_alto_networks_cloudngfw_operations import PaloAltoNetworksCloudngfwOperations # type: ignore +from ._firewalls_operations import FirewallsOperations # type: ignore +from ._local_rulestacks_operations import LocalRulestacksOperations # type: ignore +from ._firewall_status_operations import FirewallStatusOperations # type: ignore +from ._certificate_object_local_rulestack_operations import CertificateObjectLocalRulestackOperations # type: ignore +from ._fqdn_list_local_rulestack_operations import FqdnListLocalRulestackOperations # type: ignore +from ._local_rules_operations import LocalRulesOperations # type: ignore +from ._prefix_list_local_rulestack_operations import PrefixListLocalRulestackOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -33,6 +40,7 @@ "PrefixListGlobalRulestackOperations", "PreRulesOperations", "Operations", + "PaloAltoNetworksCloudngfwOperations", "FirewallsOperations", "LocalRulestacksOperations", "FirewallStatusOperations", @@ -41,5 +49,5 @@ "LocalRulesOperations", "PrefixListLocalRulestackOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_global_rulestack_operations.py index bc3759376562..f03ab46fd2ac 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_global_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_object_global_rulestack_operations import ( build_create_or_update_request, build_delete_request, @@ -38,11 +38,15 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class CertificateObjectGlobalRulestackOperations: +class CertificateObjectGlobalRulestackOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -65,11 +69,11 @@ def __init__(self, *args, **kwargs) -> None: def list( self, global_rulestack_name: str, **kwargs: Any ) -> AsyncIterable["_models.CertificateObjectGlobalRulestackResource"]: + # pylint: disable=line-too-long """List CertificateObjectGlobalRulestackResource resources by Tenant. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -82,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,15 +97,13 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -113,13 +115,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("CertificateObjectGlobalRulestackResourceListResult", pipeline_response) @@ -129,11 +130,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -146,8 +147,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates"} - @distributed_trace_async async def get( self, global_rulestack_name: str, name: str, **kwargs: Any @@ -158,12 +157,11 @@ async def get( :type global_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,20 +175,18 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -200,25 +196,21 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, global_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectGlobalRulestackResource, IO], + resource: Union[_models.CertificateObjectGlobalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.CertificateObjectGlobalRulestackResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +223,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -241,47 +233,42 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "CertificateObjectGlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } - @overload async def begin_create_or_update( self, @@ -292,6 +279,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]: + # pylint: disable=line-too-long """Create a CertificateObjectGlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. @@ -304,14 +292,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -324,11 +304,12 @@ async def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]: + # pylint: disable=line-too-long """Create a CertificateObjectGlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. @@ -336,18 +317,10 @@ async def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -360,9 +333,10 @@ async def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectGlobalRulestackResource, IO], + resource: Union[_models.CertificateObjectGlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]: + # pylint: disable=line-too-long """Create a CertificateObjectGlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. @@ -370,20 +344,9 @@ async def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Is either a - CertificateObjectGlobalRulestackResource type or a IO type. Required. + CertificateObjectGlobalRulestackResource type or a IO[bytes] type. Required. :type resource: - ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -411,12 +374,15 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize( + "CertificateObjectGlobalRulestackResource", pipeline_response.http_response + ) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -429,22 +395,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return AsyncLROPoller[_models.CertificateObjectGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -456,37 +418,40 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -496,14 +461,6 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An :type global_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -517,7 +474,7 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, @@ -526,11 +483,12 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -542,14 +500,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_local_rulestack_operations.py index 28ea651d9a25..51365f6c690d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_certificate_object_local_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._certificate_object_local_rulestack_operations import ( build_create_or_update_request, build_delete_request, @@ -38,11 +38,15 @@ build_list_by_local_rulestacks_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class CertificateObjectLocalRulestackOperations: +class CertificateObjectLocalRulestackOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -65,6 +69,7 @@ def __init__(self, *args, **kwargs) -> None: def list_by_local_rulestacks( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any ) -> AsyncIterable["_models.CertificateObjectLocalRulestackResource"]: + # pylint: disable=line-too-long """List CertificateObjectLocalRulestackResource resources by LocalRulestacks. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -72,7 +77,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -85,7 +89,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectLocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,17 +100,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +120,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("CertificateObjectLocalRulestackResourceListResult", pipeline_response) @@ -134,11 +135,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,10 +152,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates" - } - @distributed_trace_async async def get( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any @@ -168,12 +165,11 @@ async def get( :type local_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,22 +183,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectLocalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -212,26 +206,22 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectLocalRulestackResource, IO], + resource: Union[_models.CertificateObjectLocalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.CertificateObjectLocalRulestackResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +234,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateObjectLocalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -254,7 +244,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "CertificateObjectLocalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -263,40 +253,35 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } - @overload async def begin_create_or_update( self, @@ -308,6 +293,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]: + # pylint: disable=line-too-long """Create a CertificateObjectLocalRulestackResource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -322,14 +308,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -343,11 +321,12 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]: + # pylint: disable=line-too-long """Create a CertificateObjectLocalRulestackResource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -358,18 +337,10 @@ async def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -383,9 +354,10 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectLocalRulestackResource, IO], + resource: Union[_models.CertificateObjectLocalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]: + # pylint: disable=line-too-long """Create a CertificateObjectLocalRulestackResource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -396,20 +368,9 @@ async def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Is either a - CertificateObjectLocalRulestackResource type or a IO type. Required. + CertificateObjectLocalRulestackResource type or a IO[bytes] type. Required. :type resource: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource - 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. + or IO[bytes] :return: An instance of AsyncLROPoller that returns either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -438,12 +399,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -456,22 +418,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.CertificateObjectLocalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return AsyncLROPoller[_models.CertificateObjectLocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -483,39 +443,42 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -530,14 +493,6 @@ async def begin_delete( :type local_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -551,7 +506,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -561,11 +516,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -577,14 +533,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewall_status_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewall_status_operations.py index b7e8edbe4134..9976fb76bea4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewall_status_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewall_status_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,17 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._firewall_status_operations import build_get_request, build_list_by_firewalls_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +66,6 @@ def list_by_firewalls( :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallStatusResource or the result of cls(response) :rtype: @@ -77,7 +78,7 @@ def list_by_firewalls( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallStatusResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -88,17 +89,15 @@ def list_by_firewalls( def prepare_request(next_link=None): if not next_link: - request = build_list_by_firewalls_request( + _request = build_list_by_firewalls_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_firewalls.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -110,13 +109,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FirewallStatusResourceListResult", pipeline_response) @@ -126,11 +124,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -143,10 +141,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_firewalls.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses" - } - @distributed_trace_async async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.FirewallStatusResource: """Get a FirewallStatusResource. @@ -156,12 +150,11 @@ async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallStatusResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,21 +168,19 @@ async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallStatusResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -199,13 +190,9 @@ async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallStatusResource", pipeline_response) + deserialized = self._deserialize("FirewallStatusResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses/default" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewalls_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewalls_operations.py index 8cc8d9e5ce7f..e7ae372fcb52 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewalls_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewalls_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._firewalls_operations import ( build_create_or_update_request, build_delete_request, @@ -44,6 +45,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,6 @@ def __init__(self, *args, **kwargs) -> None: def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.FirewallResource"]: """List FirewallResource resources by subscription ID. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] @@ -83,7 +87,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Firewall api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,15 +98,13 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Firewall def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -114,13 +116,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FirewallResourceListResult", pipeline_response) @@ -130,11 +131,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,10 +148,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/firewalls" - } - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any @@ -160,7 +157,6 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] @@ -172,7 +168,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -183,16 +179,14 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -204,13 +198,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FirewallResourceListResult", pipeline_response) @@ -220,11 +213,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,10 +230,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls" - } - @distributed_trace_async async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.FirewallResource: """Get a FirewallResource. @@ -250,12 +239,11 @@ async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,21 +257,19 @@ async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -293,21 +279,21 @@ async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallResource", pipeline_response) + deserialized = self._deserialize("FirewallResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return deserialized # type: ignore async def _create_or_update_initial( - self, resource_group_name: str, firewall_name: str, resource: Union[_models.FirewallResource, IO], **kwargs: Any - ) -> _models.FirewallResource: - error_map = { + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.FirewallResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -320,7 +306,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -330,7 +316,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "FirewallResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, @@ -338,40 +324,35 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FirewallResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } - @overload async def begin_create_or_update( self, @@ -394,14 +375,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FirewallResource or the result of cls(response) :rtype: @@ -414,7 +387,7 @@ async def begin_create_or_update( self, resource_group_name: str, firewall_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -427,18 +400,10 @@ async def begin_create_or_update( :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FirewallResource or the result of cls(response) :rtype: @@ -448,7 +413,11 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, firewall_name: str, resource: Union[_models.FirewallResource, IO], **kwargs: Any + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.FirewallResource, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.FirewallResource]: """Create a FirewallResource. @@ -457,20 +426,9 @@ async def begin_create_or_update( :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :param resource: Resource create parameters. Is either a FirewallResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource 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. + :param resource: Resource create parameters. Is either a FirewallResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either FirewallResource or the result of cls(response) :rtype: @@ -498,12 +456,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallResource", pipeline_response) + deserialized = self._deserialize("FirewallResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -516,17 +475,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.FirewallResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return AsyncLROPoller[_models.FirewallResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update( @@ -550,7 +507,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: @@ -561,7 +517,7 @@ async def update( self, resource_group_name: str, firewall_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -574,11 +530,10 @@ async def update( :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: @@ -589,7 +544,7 @@ async def update( self, resource_group_name: str, firewall_name: str, - properties: Union[_models.FirewallResourceUpdate, IO], + properties: Union[_models.FirewallResourceUpdate, IO[bytes]], **kwargs: Any ) -> _models.FirewallResource: """Update a FirewallResource. @@ -600,17 +555,13 @@ async def update( :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param properties: The resource properties to be updated. Is either a FirewallResourceUpdate - type or a IO type. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate or IO[bytes] :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -633,7 +584,7 @@ async def update( else: _json = self._serialize.body(properties, "FirewallResourceUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, @@ -641,16 +592,14 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -660,21 +609,17 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallResource", pipeline_response) + deserialized = self._deserialize("FirewallResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, firewall_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -686,38 +631,41 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -728,14 +676,6 @@ async def begin_delete(self, resource_group_name: str, firewall_name: str, **kwa :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -749,7 +689,7 @@ async def begin_delete(self, resource_group_name: str, firewall_name: str, **kwa lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, firewall_name=firewall_name, api_version=api_version, @@ -758,11 +698,12 @@ async def begin_delete(self, resource_group_name: str, firewall_name: str, **kwa params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -774,17 +715,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_global_rulestack( @@ -797,12 +734,11 @@ async def get_global_rulestack( :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -816,21 +752,19 @@ async def get_global_rulestack( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalRulestackInfo] = kwargs.pop("cls", None) - request = build_get_global_rulestack_request( + _request = build_get_global_rulestack_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_global_rulestack.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -840,16 +774,12 @@ async def get_global_rulestack( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalRulestackInfo", pipeline_response) + deserialized = self._deserialize("GlobalRulestackInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_global_rulestack.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getGlobalRulestack" - } + return deserialized # type: ignore @distributed_trace_async async def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.LogSettings: @@ -860,12 +790,11 @@ async def get_log_profile(self, resource_group_name: str, firewall_name: str, ** :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LogSettings or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,21 +808,19 @@ async def get_log_profile(self, resource_group_name: str, firewall_name: str, ** api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LogSettings] = kwargs.pop("cls", None) - request = build_get_log_profile_request( + _request = build_get_log_profile_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_log_profile.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -903,16 +830,12 @@ async def get_log_profile(self, resource_group_name: str, firewall_name: str, ** error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LogSettings", pipeline_response) + deserialized = self._deserialize("LogSettings", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_log_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getLogProfile" - } + return deserialized # type: ignore @distributed_trace_async async def get_support_info( @@ -927,12 +850,11 @@ async def get_support_info( :type firewall_name: str :param email: email address on behalf of which this API called. Default value is None. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -946,22 +868,20 @@ async def get_support_info( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportInfo] = kwargs.pop("cls", None) - request = build_get_support_info_request( + _request = build_get_support_info_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, email=email, api_version=api_version, - template_url=self.get_support_info.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -971,19 +891,15 @@ async def get_support_info( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportInfo", pipeline_response) + deserialized = self._deserialize("SupportInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_support_info.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getSupportInfo" - } + return deserialized # type: ignore @overload - async def save_log_profile( # pylint: disable=inconsistent-return-statements + async def save_log_profile( self, resource_group_name: str, firewall_name: str, @@ -1004,18 +920,17 @@ async def save_log_profile( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def save_log_profile( # pylint: disable=inconsistent-return-statements + async def save_log_profile( self, resource_group_name: str, firewall_name: str, - log_settings: Optional[IO] = None, + log_settings: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1028,22 +943,21 @@ async def save_log_profile( # pylint: disable=inconsistent-return-statements :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param log_settings: Default value is None. - :type log_settings: IO + :type log_settings: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def save_log_profile( # pylint: disable=inconsistent-return-statements + async def save_log_profile( self, resource_group_name: str, firewall_name: str, - log_settings: Optional[Union[_models.LogSettings, IO]] = None, + log_settings: Optional[Union[_models.LogSettings, IO[bytes]]] = None, **kwargs: Any ) -> None: """Log Profile for Firewall. @@ -1053,17 +967,13 @@ async def save_log_profile( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :param log_settings: Is either a LogSettings type or a IO type. Default value is None. - :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings 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 + :param log_settings: Is either a LogSettings type or a IO[bytes] type. Default value is None. + :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1089,7 +999,7 @@ async def save_log_profile( # pylint: disable=inconsistent-return-statements else: _json = None - request = build_save_log_profile_request( + _request = build_save_log_profile_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, @@ -1097,16 +1007,14 @@ async def save_log_profile( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.save_log_profile.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1117,8 +1025,4 @@ async def save_log_profile( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - save_log_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/saveLogProfile" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_global_rulestack_operations.py index ccfa6967cf22..4a3608b04fb8 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_global_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._fqdn_list_global_rulestack_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +38,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,11 +69,11 @@ def __init__(self, *args, **kwargs) -> None: def list( self, global_rulestack_name: str, **kwargs: Any ) -> AsyncIterable["_models.FqdnListGlobalRulestackResource"]: + # pylint: disable=line-too-long """List FqdnListGlobalRulestackResource resources by Tenant. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -82,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,15 +97,13 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -113,13 +115,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FqdnListGlobalRulestackResourceListResult", pipeline_response) @@ -129,11 +130,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -146,8 +147,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists"} - @distributed_trace_async async def get( self, global_rulestack_name: str, name: str, **kwargs: Any @@ -158,12 +157,11 @@ async def get( :type global_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FqdnListGlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,20 +175,18 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListGlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -200,25 +196,21 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, global_rulestack_name: str, name: str, - resource: Union[_models.FqdnListGlobalRulestackResource, IO], + resource: Union[_models.FqdnListGlobalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.FqdnListGlobalRulestackResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +223,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FqdnListGlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -241,47 +233,42 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "FqdnListGlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } - @overload async def begin_create_or_update( self, @@ -303,14 +290,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -323,7 +302,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -335,18 +314,10 @@ async def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -359,7 +330,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: Union[_models.FqdnListGlobalRulestackResource, IO], + resource: Union[_models.FqdnListGlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.FqdnListGlobalRulestackResource]: """Create a FqdnListGlobalRulestackResource. @@ -369,19 +340,9 @@ async def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Is either a FqdnListGlobalRulestackResource type - or a IO type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource 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. + or a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource or + IO[bytes] :return: An instance of AsyncLROPoller that returns either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -409,12 +370,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -427,22 +389,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.FqdnListGlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return AsyncLROPoller[_models.FqdnListGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -454,37 +412,40 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -494,14 +455,6 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An :type global_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -515,7 +468,7 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, @@ -524,11 +477,12 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -540,14 +494,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_local_rulestack_operations.py index 6dd896a27094..8e412d345ef1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_fqdn_list_local_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._fqdn_list_local_rulestack_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +38,10 @@ build_list_by_local_rulestacks_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +76,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -85,7 +88,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListLocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,17 +99,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +119,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FqdnListLocalRulestackResourceListResult", pipeline_response) @@ -134,11 +134,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,10 +151,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists" - } - @distributed_trace_async async def get( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any @@ -168,12 +164,11 @@ async def get( :type local_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FqdnListLocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,22 +182,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListLocalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -212,26 +205,22 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.FqdnListLocalRulestackResource, IO], + resource: Union[_models.FqdnListLocalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.FqdnListLocalRulestackResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +233,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FqdnListLocalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -254,7 +243,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "FqdnListLocalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -263,40 +252,35 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } - @overload async def begin_create_or_update( self, @@ -322,14 +306,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -343,7 +319,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -358,18 +334,10 @@ async def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -383,7 +351,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.FqdnListLocalRulestackResource, IO], + resource: Union[_models.FqdnListLocalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.FqdnListLocalRulestackResource]: """Create a FqdnListLocalRulestackResource. @@ -396,19 +364,9 @@ async def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Is either a FqdnListLocalRulestackResource type or - a IO type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource or + IO[bytes] :return: An instance of AsyncLROPoller that returns either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -437,12 +395,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -455,22 +414,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.FqdnListLocalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return AsyncLROPoller[_models.FqdnListLocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -482,39 +439,42 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -529,14 +489,6 @@ async def begin_delete( :type local_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -550,7 +502,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -560,11 +512,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -576,14 +529,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_global_rulestack_operations.py index 33ae27c7c540..1faecb64e2d5 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_global_rulestack_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._global_rulestack_operations import ( build_commit_request, build_create_or_update_request, @@ -48,6 +49,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +80,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.GlobalRulestackResource"]: """List GlobalRulestackResource resources by Tenant. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GlobalRulestackResource or the result of cls(response) :rtype: @@ -88,7 +92,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.GlobalRulestackResource" api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -99,14 +103,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.GlobalRulestackResource" def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +120,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("GlobalRulestackResourceListResult", pipeline_response) @@ -134,11 +135,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,20 +152,17 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks"} - @distributed_trace_async async def get(self, global_rulestack_name: str, **kwargs: Any) -> _models.GlobalRulestackResource: """Get a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -178,19 +176,17 @@ async def get(self, global_rulestack_name: str, **kwargs: Any) -> _models.Global api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -200,19 +196,17 @@ async def get(self, global_rulestack_name: str, **kwargs: Any) -> _models.Global error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("GlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} + return deserialized # type: ignore async def _create_or_update_initial( - self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO], **kwargs: Any - ) -> _models.GlobalRulestackResource: - error_map = { + self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +219,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -235,46 +229,41 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "GlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" - } - @overload async def begin_create_or_update( self, @@ -293,14 +282,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either GlobalRulestackResource or the result of cls(response) :rtype: @@ -310,25 +291,17 @@ async def begin_create_or_update( @overload async def begin_create_or_update( - self, global_rulestack_name: str, resource: IO, *, content_type: str = "application/json", **kwargs: Any + self, global_rulestack_name: str, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GlobalRulestackResource]: """Create a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either GlobalRulestackResource or the result of cls(response) :rtype: @@ -338,26 +311,15 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO], **kwargs: Any + self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GlobalRulestackResource]: """Create a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :param resource: Resource create parameters. Is either a GlobalRulestackResource type or a IO - type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource 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. + :param resource: Resource create parameters. Is either a GlobalRulestackResource type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either GlobalRulestackResource or the result of cls(response) :rtype: @@ -384,12 +346,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("GlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -402,17 +365,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.GlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" - } + return AsyncLROPoller[_models.GlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update( @@ -432,7 +393,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -440,18 +400,22 @@ async def update( @overload async def update( - self, global_rulestack_name: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any + self, + global_rulestack_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.GlobalRulestackResource: """Update a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -459,24 +423,24 @@ async def update( @distributed_trace_async async def update( - self, global_rulestack_name: str, properties: Union[_models.GlobalRulestackResourceUpdate, IO], **kwargs: Any + self, + global_rulestack_name: str, + properties: Union[_models.GlobalRulestackResourceUpdate, IO[bytes]], + **kwargs: Any ) -> _models.GlobalRulestackResource: """Update a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str :param properties: The resource properties to be updated. Is either a - GlobalRulestackResourceUpdate type or a IO type. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate 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 + GlobalRulestackResourceUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate or + IO[bytes] :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,22 +463,20 @@ async def update( else: _json = self._serialize.body(properties, "GlobalRulestackResourceUpdate") - request = build_update_request( + _request = build_update_request( global_rulestack_name=global_rulestack_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -524,19 +486,15 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("GlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} + return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -548,34 +506,39 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -583,14 +546,6 @@ async def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> Async :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -604,7 +559,7 @@ async def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> Async lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( global_rulestack_name=global_rulestack_name, api_version=api_version, cls=lambda x, y, z: x, @@ -612,11 +567,12 @@ async def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> Async params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -628,20 +584,16 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} - - async def _commit_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + async def _commit_initial(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -653,36 +605,39 @@ async def _commit_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_commit_request( + _request = build_commit_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self._commit_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _commit_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/commit" - } + return deserialized # type: ignore @distributed_trace_async async def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -690,14 +645,6 @@ async def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> Async :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -711,7 +658,7 @@ async def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> Async 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._commit_initial( # type: ignore + raw_result = await self._commit_initial( global_rulestack_name=global_rulestack_name, api_version=api_version, cls=lambda x, y, z: x, @@ -719,11 +666,12 @@ async def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> Async params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -734,17 +682,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_commit.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/commit" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _models.Changelog: @@ -752,12 +696,11 @@ async def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _mo :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Changelog or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.Changelog :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -771,19 +714,17 @@ async def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _mo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Changelog] = kwargs.pop("cls", None) - request = build_get_change_log_request( + _request = build_get_change_log_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.get_change_log.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -793,16 +734,12 @@ async def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Changelog", pipeline_response) + deserialized = self._deserialize("Changelog", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_change_log.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/getChangeLog" - } + return deserialized # type: ignore @distributed_trace_async async def list_advanced_security_objects( @@ -823,12 +760,11 @@ async def list_advanced_security_objects( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: AdvSecurityObjectListResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -842,22 +778,20 @@ async def list_advanced_security_objects( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) - request = build_list_advanced_security_objects_request( + _request = build_list_advanced_security_objects_request( global_rulestack_name=global_rulestack_name, type=type, skip=skip, top=top, api_version=api_version, - template_url=self.list_advanced_security_objects.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -867,16 +801,12 @@ async def list_advanced_security_objects( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response) + deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_advanced_security_objects.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAdvancedSecurityObjects" - } + return deserialized # type: ignore @distributed_trace_async async def list_app_ids( @@ -900,12 +830,11 @@ async def list_app_ids( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListAppIdResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListAppIdResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -919,23 +848,21 @@ async def list_app_ids( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListAppIdResponse] = kwargs.pop("cls", None) - request = build_list_app_ids_request( + _request = build_list_app_ids_request( global_rulestack_name=global_rulestack_name, app_id_version=app_id_version, app_prefix=app_prefix, skip=skip, top=top, api_version=api_version, - template_url=self.list_app_ids.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -945,16 +872,12 @@ async def list_app_ids( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAppIdResponse", pipeline_response) + deserialized = self._deserialize("ListAppIdResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_app_ids.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAppIds" - } + return deserialized # type: ignore @distributed_trace_async async def list_countries( @@ -968,12 +891,11 @@ async def list_countries( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: CountriesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CountriesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -987,21 +909,19 @@ async def list_countries( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CountriesResponse] = kwargs.pop("cls", None) - request = build_list_countries_request( + _request = build_list_countries_request( global_rulestack_name=global_rulestack_name, skip=skip, top=top, api_version=api_version, - template_url=self.list_countries.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1011,16 +931,12 @@ async def list_countries( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CountriesResponse", pipeline_response) + deserialized = self._deserialize("CountriesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_countries.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listCountries" - } + return deserialized # type: ignore @distributed_trace_async async def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _models.ListFirewallsResponse: @@ -1028,12 +944,11 @@ async def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _mo :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListFirewallsResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1047,19 +962,17 @@ async def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _mo api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListFirewallsResponse] = kwargs.pop("cls", None) - request = build_list_firewalls_request( + _request = build_list_firewalls_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list_firewalls.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1069,16 +982,12 @@ async def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _mo error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListFirewallsResponse", pipeline_response) + deserialized = self._deserialize("ListFirewallsResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_firewalls.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listFirewalls" - } + return deserialized # type: ignore @distributed_trace_async async def list_predefined_url_categories( @@ -1092,12 +1001,11 @@ async def list_predefined_url_categories( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: PredefinedUrlCategoriesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategoriesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1111,21 +1019,19 @@ async def list_predefined_url_categories( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PredefinedUrlCategoriesResponse] = kwargs.pop("cls", None) - request = build_list_predefined_url_categories_request( + _request = build_list_predefined_url_categories_request( global_rulestack_name=global_rulestack_name, skip=skip, top=top, api_version=api_version, - template_url=self.list_predefined_url_categories.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1135,16 +1041,12 @@ async def list_predefined_url_categories( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PredefinedUrlCategoriesResponse", pipeline_response) + deserialized = self._deserialize("PredefinedUrlCategoriesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_predefined_url_categories.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listPredefinedUrlCategories" - } + return deserialized # type: ignore @distributed_trace_async async def list_security_services( @@ -1166,12 +1068,11 @@ async def list_security_services( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityServicesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1185,22 +1086,20 @@ async def list_security_services( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecurityServicesResponse] = kwargs.pop("cls", None) - request = build_list_security_services_request( + _request = build_list_security_services_request( global_rulestack_name=global_rulestack_name, type=type, skip=skip, top=top, api_version=api_version, - template_url=self.list_security_services.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1210,31 +1109,24 @@ async def list_security_services( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityServicesResponse", pipeline_response) + deserialized = self._deserialize("SecurityServicesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_security_services.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listSecurityServices" - } + return deserialized # type: ignore @distributed_trace_async - async def revert( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: + async def revert(self, global_rulestack_name: str, **kwargs: Any) -> None: """Revert rulestack configuration. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1248,19 +1140,17 @@ async def revert( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( + _request = build_revert_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1271,6 +1161,4 @@ async def revert( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - revert.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/revert"} + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rules_operations.py index bc2465ae9396..137d8512ce06 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rules_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._local_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -41,6 +41,10 @@ build_reset_counters_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +79,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocalRulesResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] @@ -87,7 +90,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulesResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,17 +101,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -120,13 +121,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("LocalRulesResourceListResult", pipeline_response) @@ -136,11 +136,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,10 +153,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules" - } - @distributed_trace_async async def get( self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any @@ -170,12 +166,11 @@ async def get( :type local_rulestack_name: str :param priority: Local Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulesResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -189,22 +184,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulesResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -214,26 +207,22 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalRulesResource", pipeline_response) + deserialized = self._deserialize("LocalRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, priority: str, - resource: Union[_models.LocalRulesResource, IO], + resource: Union[_models.LocalRulesResource, IO[bytes]], **kwargs: Any - ) -> _models.LocalRulesResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -246,7 +235,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulesResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -256,7 +245,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "LocalRulesResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, @@ -265,40 +254,35 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("LocalRulesResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LocalRulesResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } - @overload async def begin_create_or_update( self, @@ -324,14 +308,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LocalRulesResource or the result of cls(response) :rtype: @@ -345,7 +321,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, priority: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -360,18 +336,10 @@ async def begin_create_or_update( :param priority: Local Rule priority. Required. :type priority: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LocalRulesResource or the result of cls(response) :rtype: @@ -385,7 +353,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, priority: str, - resource: Union[_models.LocalRulesResource, IO], + resource: Union[_models.LocalRulesResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.LocalRulesResource]: """Create a LocalRulesResource. @@ -397,20 +365,9 @@ async def begin_create_or_update( :type local_rulestack_name: str :param priority: Local Rule priority. Required. :type priority: str - :param resource: Resource create parameters. Is either a LocalRulesResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource 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. + :param resource: Resource create parameters. Is either a LocalRulesResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either LocalRulesResource or the result of cls(response) :rtype: @@ -439,12 +396,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LocalRulesResource", pipeline_response) + deserialized = self._deserialize("LocalRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -457,22 +415,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.LocalRulesResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return AsyncLROPoller[_models.LocalRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -484,39 +440,42 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -531,14 +490,6 @@ async def begin_delete( :type local_rulestack_name: str :param priority: Local Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -552,7 +503,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, @@ -562,11 +513,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -578,17 +530,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_counters( @@ -610,12 +558,11 @@ async def get_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounter or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,23 +576,21 @@ async def get_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) - request = build_get_counters_request( + _request = build_get_counters_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, firewall_name=firewall_name, api_version=api_version, - template_url=self.get_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -655,19 +600,15 @@ async def get_counters( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounter", pipeline_response) + deserialized = self._deserialize("RuleCounter", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/getCounters" - } + return deserialized # type: ignore @distributed_trace_async - async def refresh_counters( # pylint: disable=inconsistent-return-statements + async def refresh_counters( self, resource_group_name: str, local_rulestack_name: str, @@ -686,12 +627,11 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -705,23 +645,21 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_refresh_counters_request( + _request = build_refresh_counters_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, firewall_name=firewall_name, api_version=api_version, - template_url=self.refresh_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -732,11 +670,7 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - refresh_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/refreshCounters" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def reset_counters( @@ -758,12 +692,11 @@ async def reset_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounterReset or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -777,23 +710,21 @@ async def reset_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) - request = build_reset_counters_request( + _request = build_reset_counters_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, firewall_name=firewall_name, api_version=api_version, - template_url=self.reset_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -803,13 +734,9 @@ async def reset_counters( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounterReset", pipeline_response) + deserialized = self._deserialize("RuleCounterReset", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/resetCounters" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rulestacks_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rulestacks_operations.py index 92fc81f8b5a5..075235b52a7d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rulestacks_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_local_rulestacks_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._local_rulestacks_operations import ( build_commit_request, build_create_or_update_request, @@ -47,6 +48,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +79,6 @@ def __init__(self, *args, **kwargs) -> None: def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.LocalRulestackResource"]: """List LocalRulestackResource resources by subscription ID. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocalRulestackResource or the result of cls(response) :rtype: @@ -87,7 +91,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.LocalRul api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,15 +102,13 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.LocalRul def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +120,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("LocalRulestackResourceListResult", pipeline_response) @@ -134,11 +135,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,10 +152,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks" - } - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any @@ -164,7 +161,6 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocalRulestackResource or the result of cls(response) :rtype: @@ -177,7 +173,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -188,16 +184,14 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -209,13 +203,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("LocalRulestackResourceListResult", pipeline_response) @@ -225,11 +218,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,10 +235,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks" - } - @distributed_trace_async async def get( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any @@ -257,12 +246,11 @@ async def get( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -276,21 +264,19 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -300,25 +286,21 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + deserialized = self._deserialize("LocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, - resource: Union[_models.LocalRulestackResource, IO], + resource: Union[_models.LocalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.LocalRulestackResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +313,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -341,7 +323,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "LocalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -349,40 +331,35 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } - @overload async def begin_create_or_update( self, @@ -405,14 +382,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LocalRulestackResource or the result of cls(response) :rtype: @@ -425,7 +394,7 @@ async def begin_create_or_update( self, resource_group_name: str, local_rulestack_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -438,18 +407,10 @@ async def begin_create_or_update( :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either LocalRulestackResource or the result of cls(response) :rtype: @@ -462,7 +423,7 @@ async def begin_create_or_update( self, resource_group_name: str, local_rulestack_name: str, - resource: Union[_models.LocalRulestackResource, IO], + resource: Union[_models.LocalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.LocalRulestackResource]: """Create a LocalRulestackResource. @@ -472,20 +433,9 @@ async def begin_create_or_update( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :param resource: Resource create parameters. Is either a LocalRulestackResource type or a IO - type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource 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. + :param resource: Resource create parameters. Is either a LocalRulestackResource type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either LocalRulestackResource or the result of cls(response) :rtype: @@ -513,12 +463,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + deserialized = self._deserialize("LocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -531,17 +482,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.LocalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return AsyncLROPoller[_models.LocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update( @@ -565,7 +514,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -576,7 +524,7 @@ async def update( self, resource_group_name: str, local_rulestack_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -589,11 +537,10 @@ async def update( :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -604,7 +551,7 @@ async def update( self, resource_group_name: str, local_rulestack_name: str, - properties: Union[_models.LocalRulestackResourceUpdate, IO], + properties: Union[_models.LocalRulestackResourceUpdate, IO[bytes]], **kwargs: Any ) -> _models.LocalRulestackResource: """Update a LocalRulestackResource. @@ -615,17 +562,14 @@ async def update( :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str :param properties: The resource properties to be updated. Is either a - LocalRulestackResourceUpdate type or a IO type. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate 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 + LocalRulestackResourceUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate or + IO[bytes] :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -648,7 +592,7 @@ async def update( else: _json = self._serialize.body(properties, "LocalRulestackResourceUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -656,16 +600,14 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -675,21 +617,17 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + deserialized = self._deserialize("LocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,38 +639,41 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -745,14 +686,6 @@ async def begin_delete( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -766,7 +699,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, api_version=api_version, @@ -775,11 +708,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -791,22 +725,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _commit_initial( # pylint: disable=inconsistent-return-statements + async def _commit_initial( self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -818,38 +748,41 @@ async def _commit_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_commit_request( + _request = build_commit_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._commit_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _commit_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/commit" - } + return deserialized # type: ignore @distributed_trace_async async def begin_commit( @@ -862,14 +795,6 @@ async def begin_commit( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -883,7 +808,7 @@ async def begin_commit( 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._commit_initial( # type: ignore + raw_result = await self._commit_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, api_version=api_version, @@ -892,11 +817,12 @@ async def begin_commit( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -907,17 +833,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_commit.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/commit" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_change_log( @@ -930,12 +852,11 @@ async def get_change_log( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Changelog or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.Changelog :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -949,21 +870,19 @@ async def get_change_log( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Changelog] = kwargs.pop("cls", None) - request = build_get_change_log_request( + _request = build_get_change_log_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_change_log.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -973,16 +892,12 @@ async def get_change_log( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Changelog", pipeline_response) + deserialized = self._deserialize("Changelog", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_change_log.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getChangeLog" - } + return deserialized # type: ignore @distributed_trace_async async def get_support_info( @@ -997,12 +912,11 @@ async def get_support_info( :type local_rulestack_name: str :param email: email address on behalf of which this API called. Default value is None. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1016,22 +930,20 @@ async def get_support_info( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportInfo] = kwargs.pop("cls", None) - request = build_get_support_info_request( + _request = build_get_support_info_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, email=email, api_version=api_version, - template_url=self.get_support_info.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1041,16 +953,12 @@ async def get_support_info( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportInfo", pipeline_response) + deserialized = self._deserialize("SupportInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_support_info.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getSupportInfo" - } + return deserialized # type: ignore @distributed_trace_async async def list_advanced_security_objects( @@ -1075,12 +983,11 @@ async def list_advanced_security_objects( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: AdvSecurityObjectListResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1094,7 +1001,7 @@ async def list_advanced_security_objects( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) - request = build_list_advanced_security_objects_request( + _request = build_list_advanced_security_objects_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -1102,16 +1009,14 @@ async def list_advanced_security_objects( skip=skip, top=top, api_version=api_version, - template_url=self.list_advanced_security_objects.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1121,16 +1026,12 @@ async def list_advanced_security_objects( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response) + deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_advanced_security_objects.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listAdvancedSecurityObjects" - } + return deserialized # type: ignore @distributed_trace_async async def list_firewalls( @@ -1143,12 +1044,11 @@ async def list_firewalls( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListFirewallsResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1162,21 +1062,19 @@ async def list_firewalls( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListFirewallsResponse] = kwargs.pop("cls", None) - request = build_list_firewalls_request( + _request = build_list_firewalls_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_firewalls.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1186,16 +1084,12 @@ async def list_firewalls( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListFirewallsResponse", pipeline_response) + deserialized = self._deserialize("ListFirewallsResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_firewalls.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listFirewalls" - } + return deserialized # type: ignore @distributed_trace_async async def list_security_services( @@ -1221,12 +1115,11 @@ async def list_security_services( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityServicesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1240,7 +1133,7 @@ async def list_security_services( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecurityServicesResponse] = kwargs.pop("cls", None) - request = build_list_security_services_request( + _request = build_list_security_services_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -1248,16 +1141,14 @@ async def list_security_services( skip=skip, top=top, api_version=api_version, - template_url=self.list_security_services.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1267,21 +1158,15 @@ async def list_security_services( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityServicesResponse", pipeline_response) + deserialized = self._deserialize("SecurityServicesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_security_services.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listSecurityServices" - } + return deserialized # type: ignore @distributed_trace_async - async def revert( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: + async def revert(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> None: """Revert rulestack configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1289,12 +1174,11 @@ async def revert( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1308,21 +1192,19 @@ async def revert( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( + _request = build_revert_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1333,8 +1215,4 @@ async def revert( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - revert.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/revert" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_operations.py index 771cc5ea381a..f251e082e059 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +58,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """List the operations for the provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.Operation] @@ -68,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,14 +80,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -98,13 +97,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -114,11 +112,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -130,5 +128,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/operations"} diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_palo_alto_networks_cloudngfw_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_palo_alto_networks_cloudngfw_operations.py new file mode 100644 index 000000000000..14bccdcc01f3 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_palo_alto_networks_cloudngfw_operations.py @@ -0,0 +1,256 @@ +# 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, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._palo_alto_networks_cloudngfw_operations import ( + build_create_product_serial_number_request, + build_list_cloud_manager_tenants_request, + build_list_product_serial_number_status_request, + build_list_support_info_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PaloAltoNetworksCloudngfwOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`palo_alto_networks_cloudngfw` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def create_product_serial_number(self, **kwargs: Any) -> _models.ProductSerialNumberRequestStatus: + """create_product_serial_number. + + :return: ProductSerialNumberRequestStatus or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberRequestStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProductSerialNumberRequestStatus] = kwargs.pop("cls", None) + + _request = build_create_product_serial_number_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ProductSerialNumberRequestStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_cloud_manager_tenants(self, **kwargs: Any) -> _models.CloudManagerTenantList: + """list_cloud_manager_tenants. + + :return: CloudManagerTenantList or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CloudManagerTenantList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudManagerTenantList] = kwargs.pop("cls", None) + + _request = build_list_cloud_manager_tenants_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CloudManagerTenantList", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_product_serial_number_status(self, **kwargs: Any) -> Optional[_models.ProductSerialNumberStatus]: + """list_product_serial_number_status. + + :return: ProductSerialNumberStatus or None or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberStatus or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ProductSerialNumberStatus]] = kwargs.pop("cls", None) + + _request = build_list_product_serial_number_status_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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("ProductSerialNumberStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_support_info(self, **kwargs: Any) -> _models.SupportInfoModel: + """list_support_info. + + :return: SupportInfoModel or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfoModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportInfoModel] = kwargs.pop("cls", None) + + _request = build_list_support_info_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SupportInfoModel", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_post_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_post_rules_operations.py index b350aa6b3171..9e41c9fdb744 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_post_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_post_rules_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._post_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -41,6 +41,10 @@ build_reset_counters_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +74,6 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_mod :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PostRulesResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] @@ -82,7 +85,7 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_mod api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostRulesResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,15 +96,13 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_mod def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -113,13 +114,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PostRulesResourceListResult", pipeline_response) @@ -129,11 +129,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -146,8 +146,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules"} - @distributed_trace_async async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _models.PostRulesResource: """Get a PostRulesResource. @@ -156,12 +154,11 @@ async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> :type global_rulestack_name: str :param priority: Post Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PostRulesResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,20 +172,18 @@ async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostRulesResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -198,21 +193,21 @@ async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PostRulesResource", pipeline_response) + deserialized = self._deserialize("PostRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return deserialized # type: ignore async def _create_or_update_initial( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PostRulesResource, IO], **kwargs: Any - ) -> _models.PostRulesResource: - error_map = { + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PostRulesResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +220,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PostRulesResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -235,47 +230,42 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "PostRulesResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PostRulesResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PostRulesResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } - @overload async def begin_create_or_update( self, @@ -297,14 +287,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PostRulesResource or the result of cls(response) :rtype: @@ -317,7 +299,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, priority: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -329,18 +311,10 @@ async def begin_create_or_update( :param priority: Post Rule priority. Required. :type priority: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PostRulesResource or the result of cls(response) :rtype: @@ -350,7 +324,11 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PostRulesResource, IO], **kwargs: Any + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PostRulesResource, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.PostRulesResource]: """Create a PostRulesResource. @@ -358,20 +336,9 @@ async def begin_create_or_update( :type global_rulestack_name: str :param priority: Post Rule priority. Required. :type priority: str - :param resource: Resource create parameters. Is either a PostRulesResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource 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. + :param resource: Resource create parameters. Is either a PostRulesResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either PostRulesResource or the result of cls(response) :rtype: @@ -399,12 +366,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PostRulesResource", pipeline_response) + deserialized = self._deserialize("PostRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -417,22 +385,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PostRulesResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return AsyncLROPoller[_models.PostRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -444,37 +408,40 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -484,14 +451,6 @@ async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs :type global_rulestack_name: str :param priority: Post Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -505,7 +464,7 @@ async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, @@ -514,11 +473,12 @@ async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -530,17 +490,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_counters( @@ -554,12 +510,11 @@ async def get_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounter or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -573,21 +528,19 @@ async def get_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) - request = build_get_counters_request( + _request = build_get_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.get_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -597,19 +550,15 @@ async def get_counters( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounter", pipeline_response) + deserialized = self._deserialize("RuleCounter", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/getCounters" - } + return deserialized # type: ignore @distributed_trace_async - async def refresh_counters( # pylint: disable=inconsistent-return-statements + async def refresh_counters( self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any ) -> None: """Refresh counters. @@ -620,12 +569,11 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -639,21 +587,19 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_refresh_counters_request( + _request = build_refresh_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.refresh_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -664,11 +610,7 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - refresh_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/refreshCounters" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def reset_counters( @@ -682,12 +624,11 @@ async def reset_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounterReset or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,21 +642,19 @@ async def reset_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) - request = build_reset_counters_request( + _request = build_reset_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.reset_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -725,13 +664,9 @@ async def reset_counters( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounterReset", pipeline_response) + deserialized = self._deserialize("RuleCounterReset", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/resetCounters" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_pre_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_pre_rules_operations.py index f3c54af9d87d..560c5fd85575 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_pre_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_pre_rules_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._pre_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -41,6 +41,10 @@ build_reset_counters_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +74,6 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_mod :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PreRulesResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] @@ -82,7 +85,7 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_mod api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PreRulesResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,15 +96,13 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> AsyncIterable["_mod def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -113,13 +114,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PreRulesResourceListResult", pipeline_response) @@ -129,11 +129,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -146,8 +146,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules"} - @distributed_trace_async async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _models.PreRulesResource: """Get a PreRulesResource. @@ -156,12 +154,11 @@ async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> :type global_rulestack_name: str :param priority: Pre Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PreRulesResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,20 +172,18 @@ async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PreRulesResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -198,21 +193,21 @@ async def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PreRulesResource", pipeline_response) + deserialized = self._deserialize("PreRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return deserialized # type: ignore async def _create_or_update_initial( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PreRulesResource, IO], **kwargs: Any - ) -> _models.PreRulesResource: - error_map = { + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PreRulesResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +220,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PreRulesResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -235,47 +230,42 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "PreRulesResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PreRulesResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PreRulesResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } - @overload async def begin_create_or_update( self, @@ -297,14 +287,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PreRulesResource or the result of cls(response) :rtype: @@ -317,7 +299,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, priority: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -329,18 +311,10 @@ async def begin_create_or_update( :param priority: Pre Rule priority. Required. :type priority: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PreRulesResource or the result of cls(response) :rtype: @@ -350,7 +324,11 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PreRulesResource, IO], **kwargs: Any + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PreRulesResource, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.PreRulesResource]: """Create a PreRulesResource. @@ -358,20 +336,9 @@ async def begin_create_or_update( :type global_rulestack_name: str :param priority: Pre Rule priority. Required. :type priority: str - :param resource: Resource create parameters. Is either a PreRulesResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource 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. + :param resource: Resource create parameters. Is either a PreRulesResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either PreRulesResource or the result of cls(response) :rtype: @@ -399,12 +366,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PreRulesResource", pipeline_response) + deserialized = self._deserialize("PreRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -417,22 +385,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PreRulesResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return AsyncLROPoller[_models.PreRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -444,37 +408,40 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -484,14 +451,6 @@ async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs :type global_rulestack_name: str :param priority: Pre Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -505,7 +464,7 @@ async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, @@ -514,11 +473,12 @@ async def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -530,17 +490,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_counters( @@ -554,12 +510,11 @@ async def get_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounter or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -573,21 +528,19 @@ async def get_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) - request = build_get_counters_request( + _request = build_get_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.get_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -597,19 +550,15 @@ async def get_counters( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounter", pipeline_response) + deserialized = self._deserialize("RuleCounter", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/getCounters" - } + return deserialized # type: ignore @distributed_trace_async - async def refresh_counters( # pylint: disable=inconsistent-return-statements + async def refresh_counters( self, global_rulestack_name: str, priority: str, firewall_name: Optional[str] = None, **kwargs: Any ) -> None: """Refresh counters. @@ -620,12 +569,11 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -639,21 +587,19 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_refresh_counters_request( + _request = build_refresh_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.refresh_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -664,11 +610,7 @@ async def refresh_counters( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - refresh_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/refreshCounters" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def reset_counters( @@ -682,12 +624,11 @@ async def reset_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounterReset or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,21 +642,19 @@ async def reset_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) - request = build_reset_counters_request( + _request = build_reset_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.reset_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -725,13 +664,9 @@ async def reset_counters( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounterReset", pipeline_response) + deserialized = self._deserialize("RuleCounterReset", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/resetCounters" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_global_rulestack_operations.py index 48950b46a194..ec1db34c6487 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_global_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._prefix_list_global_rulestack_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +38,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,11 +69,11 @@ def __init__(self, *args, **kwargs) -> None: def list( self, global_rulestack_name: str, **kwargs: Any ) -> AsyncIterable["_models.PrefixListGlobalRulestackResource"]: + # pylint: disable=line-too-long """List PrefixListGlobalRulestackResource resources by Tenant. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -82,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,15 +97,13 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -113,13 +115,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrefixListGlobalRulestackResourceListResult", pipeline_response) @@ -129,11 +130,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -146,8 +147,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists"} - @distributed_trace_async async def get( self, global_rulestack_name: str, name: str, **kwargs: Any @@ -158,12 +157,11 @@ async def get( :type global_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrefixListGlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,20 +175,18 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListGlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -200,25 +196,21 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, global_rulestack_name: str, name: str, - resource: Union[_models.PrefixListGlobalRulestackResource, IO], + resource: Union[_models.PrefixListGlobalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.PrefixListGlobalRulestackResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +223,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrefixListGlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -241,47 +233,42 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "PrefixListGlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } - @overload async def begin_create_or_update( self, @@ -303,14 +290,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -323,7 +302,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -335,18 +314,10 @@ async def begin_create_or_update( :param name: Local Rule priority. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -359,7 +330,7 @@ async def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: Union[_models.PrefixListGlobalRulestackResource, IO], + resource: Union[_models.PrefixListGlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrefixListGlobalRulestackResource]: """Create a PrefixListGlobalRulestackResource. @@ -369,19 +340,9 @@ async def begin_create_or_update( :param name: Local Rule priority. Required. :type name: str :param resource: Resource create parameters. Is either a PrefixListGlobalRulestackResource type - or a IO type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource 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. + or a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource or + IO[bytes] :return: An instance of AsyncLROPoller that returns either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -409,12 +370,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -427,22 +389,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrefixListGlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return AsyncLROPoller[_models.PrefixListGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + async def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -454,37 +412,40 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -494,14 +455,6 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An :type global_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -515,7 +468,7 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, @@ -524,11 +477,12 @@ async def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: An params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -540,14 +494,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_local_rulestack_operations.py index 162c902c17f3..63766ab89778 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_prefix_list_local_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._prefix_list_local_rulestack_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +38,10 @@ build_list_by_local_rulestacks_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +76,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrefixListResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] @@ -84,7 +87,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,17 +98,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -117,13 +118,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrefixListResourceListResult", pipeline_response) @@ -133,11 +133,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,10 +150,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists" - } - @distributed_trace_async async def get( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any @@ -167,12 +163,11 @@ async def get( :type local_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrefixListResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,22 +181,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -211,26 +204,22 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrefixListResource", pipeline_response) + deserialized = self._deserialize("PrefixListResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.PrefixListResource, IO], + resource: Union[_models.PrefixListResource, IO[bytes]], **kwargs: Any - ) -> _models.PrefixListResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +232,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrefixListResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -253,7 +242,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(resource, "PrefixListResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -262,40 +251,35 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrefixListResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrefixListResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } - @overload async def begin_create_or_update( self, @@ -321,14 +305,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrefixListResource or the result of cls(response) :rtype: @@ -342,7 +318,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -357,18 +333,10 @@ async def begin_create_or_update( :param name: Local Rule priority. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrefixListResource or the result of cls(response) :rtype: @@ -382,7 +350,7 @@ async def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.PrefixListResource, IO], + resource: Union[_models.PrefixListResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrefixListResource]: """Create a PrefixListResource. @@ -394,20 +362,9 @@ async def begin_create_or_update( :type local_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :param resource: Resource create parameters. Is either a PrefixListResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource 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. + :param resource: Resource create parameters. Is either a PrefixListResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either PrefixListResource or the result of cls(response) :rtype: @@ -436,12 +393,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrefixListResource", pipeline_response) + deserialized = self._deserialize("PrefixListResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -454,22 +412,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrefixListResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return AsyncLROPoller[_models.PrefixListResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -481,39 +437,42 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -528,14 +487,6 @@ async def begin_delete( :type local_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -549,7 +500,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -559,11 +510,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -575,14 +527,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/__init__.py index 2cb2e2ebaf6b..20aa32a083b1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/__init__.py @@ -5,122 +5,142 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AdvSecurityObjectListResponse -from ._models_py3 import AdvSecurityObjectModel -from ._models_py3 import AppSeenData -from ._models_py3 import AppSeenInfo -from ._models_py3 import ApplicationInsights -from ._models_py3 import AzureResourceManagerManagedIdentityProperties -from ._models_py3 import AzureResourceManagerUserAssignedIdentity -from ._models_py3 import Category -from ._models_py3 import CertificateObjectGlobalRulestackResource -from ._models_py3 import CertificateObjectGlobalRulestackResourceListResult -from ._models_py3 import CertificateObjectLocalRulestackResource -from ._models_py3 import CertificateObjectLocalRulestackResourceListResult -from ._models_py3 import Changelog -from ._models_py3 import CountriesResponse -from ._models_py3 import Country -from ._models_py3 import DNSSettings -from ._models_py3 import DestinationAddr -from ._models_py3 import EndpointConfiguration -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import EventHub -from ._models_py3 import FirewallResource -from ._models_py3 import FirewallResourceListResult -from ._models_py3 import FirewallResourceUpdate -from ._models_py3 import FirewallResourceUpdateProperties -from ._models_py3 import FirewallStatusResource -from ._models_py3 import FirewallStatusResourceListResult -from ._models_py3 import FqdnListGlobalRulestackResource -from ._models_py3 import FqdnListGlobalRulestackResourceListResult -from ._models_py3 import FqdnListLocalRulestackResource -from ._models_py3 import FqdnListLocalRulestackResourceListResult -from ._models_py3 import FrontendSetting -from ._models_py3 import GlobalRulestackInfo -from ._models_py3 import GlobalRulestackResource -from ._models_py3 import GlobalRulestackResourceListResult -from ._models_py3 import GlobalRulestackResourceUpdate -from ._models_py3 import GlobalRulestackResourceUpdateProperties -from ._models_py3 import IPAddress -from ._models_py3 import IPAddressSpace -from ._models_py3 import ListAppIdResponse -from ._models_py3 import ListFirewallsResponse -from ._models_py3 import LocalRulesResource -from ._models_py3 import LocalRulesResourceListResult -from ._models_py3 import LocalRulestackResource -from ._models_py3 import LocalRulestackResourceListResult -from ._models_py3 import LocalRulestackResourceUpdate -from ._models_py3 import LocalRulestackResourceUpdateProperties -from ._models_py3 import LogDestination -from ._models_py3 import LogSettings -from ._models_py3 import MarketplaceDetails -from ._models_py3 import MonitorLog -from ._models_py3 import NameDescriptionObject -from ._models_py3 import NetworkProfile -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PanoramaConfig -from ._models_py3 import PanoramaStatus -from ._models_py3 import PlanData -from ._models_py3 import PostRulesResource -from ._models_py3 import PostRulesResourceListResult -from ._models_py3 import PreRulesResource -from ._models_py3 import PreRulesResourceListResult -from ._models_py3 import PredefinedUrlCategoriesResponse -from ._models_py3 import PredefinedUrlCategory -from ._models_py3 import PrefixListGlobalRulestackResource -from ._models_py3 import PrefixListGlobalRulestackResourceListResult -from ._models_py3 import PrefixListResource -from ._models_py3 import PrefixListResourceListResult -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import RuleCounter -from ._models_py3 import RuleCounterReset -from ._models_py3 import RulestackDetails -from ._models_py3 import SecurityServices -from ._models_py3 import SecurityServicesResponse -from ._models_py3 import SecurityServicesTypeList -from ._models_py3 import SourceAddr -from ._models_py3 import StorageAccount -from ._models_py3 import SupportInfo -from ._models_py3 import SystemData -from ._models_py3 import TagInfo -from ._models_py3 import TrackedResource -from ._models_py3 import VnetConfiguration -from ._models_py3 import VwanConfiguration +from typing import TYPE_CHECKING -from ._palo_alto_networks_ngfw_mgmt_client_enums import ActionEnum -from ._palo_alto_networks_ngfw_mgmt_client_enums import ActionType -from ._palo_alto_networks_ngfw_mgmt_client_enums import AdvSecurityObjectTypeEnum -from ._palo_alto_networks_ngfw_mgmt_client_enums import BillingCycle -from ._palo_alto_networks_ngfw_mgmt_client_enums import BooleanEnum -from ._palo_alto_networks_ngfw_mgmt_client_enums import CreatedByType -from ._palo_alto_networks_ngfw_mgmt_client_enums import DNSProxy -from ._palo_alto_networks_ngfw_mgmt_client_enums import DecryptionRuleTypeEnum -from ._palo_alto_networks_ngfw_mgmt_client_enums import DefaultMode -from ._palo_alto_networks_ngfw_mgmt_client_enums import EgressNat -from ._palo_alto_networks_ngfw_mgmt_client_enums import EnabledDNSType -from ._palo_alto_networks_ngfw_mgmt_client_enums import HealthStatus -from ._palo_alto_networks_ngfw_mgmt_client_enums import LogOption -from ._palo_alto_networks_ngfw_mgmt_client_enums import LogType -from ._palo_alto_networks_ngfw_mgmt_client_enums import ManagedIdentityType -from ._palo_alto_networks_ngfw_mgmt_client_enums import MarketplaceSubscriptionStatus -from ._palo_alto_networks_ngfw_mgmt_client_enums import NetworkType -from ._palo_alto_networks_ngfw_mgmt_client_enums import Origin -from ._palo_alto_networks_ngfw_mgmt_client_enums import ProtocolType -from ._palo_alto_networks_ngfw_mgmt_client_enums import ProvisioningState -from ._palo_alto_networks_ngfw_mgmt_client_enums import ReadOnlyProvisioningState -from ._palo_alto_networks_ngfw_mgmt_client_enums import ScopeType -from ._palo_alto_networks_ngfw_mgmt_client_enums import SecurityServicesTypeEnum -from ._palo_alto_networks_ngfw_mgmt_client_enums import ServerStatus -from ._palo_alto_networks_ngfw_mgmt_client_enums import StateEnum -from ._palo_alto_networks_ngfw_mgmt_client_enums import UsageType +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AdvSecurityObjectListResponse, + AdvSecurityObjectModel, + AppSeenData, + AppSeenInfo, + ApplicationInsights, + AzureResourceManagerManagedIdentityProperties, + AzureResourceManagerUserAssignedIdentity, + Category, + CertificateObjectGlobalRulestackResource, + CertificateObjectGlobalRulestackResourceListResult, + CertificateObjectLocalRulestackResource, + CertificateObjectLocalRulestackResourceListResult, + Changelog, + CloudManagerTenantList, + CountriesResponse, + Country, + DNSSettings, + DestinationAddr, + EndpointConfiguration, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + EventHub, + FirewallResource, + FirewallResourceListResult, + FirewallResourceUpdate, + FirewallResourceUpdateProperties, + FirewallStatusResource, + FirewallStatusResourceListResult, + FqdnListGlobalRulestackResource, + FqdnListGlobalRulestackResourceListResult, + FqdnListLocalRulestackResource, + FqdnListLocalRulestackResourceListResult, + FrontendSetting, + GlobalRulestackInfo, + GlobalRulestackResource, + GlobalRulestackResourceListResult, + GlobalRulestackResourceUpdate, + GlobalRulestackResourceUpdateProperties, + IPAddress, + IPAddressSpace, + ListAppIdResponse, + ListFirewallsResponse, + LocalRulesResource, + LocalRulesResourceListResult, + LocalRulestackResource, + LocalRulestackResourceListResult, + LocalRulestackResourceUpdate, + LocalRulestackResourceUpdateProperties, + LogDestination, + LogSettings, + MarketplaceDetails, + MonitorLog, + NameDescriptionObject, + NetworkProfile, + Operation, + OperationDisplay, + OperationListResult, + PanoramaConfig, + PanoramaStatus, + PlanData, + PostRulesResource, + PostRulesResourceListResult, + PreRulesResource, + PreRulesResourceListResult, + PredefinedUrlCategoriesResponse, + PredefinedUrlCategory, + PrefixListGlobalRulestackResource, + PrefixListGlobalRulestackResourceListResult, + PrefixListResource, + PrefixListResourceListResult, + ProductSerialNumberRequestStatus, + ProductSerialNumberStatus, + ProxyResource, + Resource, + RuleCounter, + RuleCounterReset, + RulestackDetails, + SecurityServices, + SecurityServicesResponse, + SecurityServicesTypeList, + SourceAddr, + StorageAccount, + StrataCloudManagerConfig, + StrataCloudManagerInfo, + SupportInfo, + SupportInfoModel, + SystemData, + TagInfo, + TrackedResource, + VnetConfiguration, + VwanConfiguration, +) + +from ._palo_alto_networks_ngfw_mgmt_client_enums import ( # type: ignore + ActionEnum, + ActionType, + AdvSecurityObjectTypeEnum, + BillingCycle, + BooleanEnum, + CreatedByType, + DNSProxy, + DecryptionRuleTypeEnum, + DefaultMode, + EgressNat, + EnableStatus, + EnabledDNSType, + HealthStatus, + LogOption, + LogType, + ManagedIdentityType, + MarketplaceSubscriptionStatus, + NetworkType, + Origin, + ProductSerialStatusValues, + ProtocolType, + ProvisioningState, + ReadOnlyProvisioningState, + RegistrationStatus, + ScopeType, + SecurityServicesTypeEnum, + ServerStatus, + StateEnum, + UsageType, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -137,6 +157,7 @@ "CertificateObjectLocalRulestackResource", "CertificateObjectLocalRulestackResourceListResult", "Changelog", + "CloudManagerTenantList", "CountriesResponse", "Country", "DNSSettings", @@ -194,6 +215,8 @@ "PrefixListGlobalRulestackResourceListResult", "PrefixListResource", "PrefixListResourceListResult", + "ProductSerialNumberRequestStatus", + "ProductSerialNumberStatus", "ProxyResource", "Resource", "RuleCounter", @@ -204,7 +227,10 @@ "SecurityServicesTypeList", "SourceAddr", "StorageAccount", + "StrataCloudManagerConfig", + "StrataCloudManagerInfo", "SupportInfo", + "SupportInfoModel", "SystemData", "TagInfo", "TrackedResource", @@ -220,6 +246,7 @@ "DecryptionRuleTypeEnum", "DefaultMode", "EgressNat", + "EnableStatus", "EnabledDNSType", "HealthStatus", "LogOption", @@ -228,14 +255,16 @@ "MarketplaceSubscriptionStatus", "NetworkType", "Origin", + "ProductSerialStatusValues", "ProtocolType", "ProvisioningState", "ReadOnlyProvisioningState", + "RegistrationStatus", "ScopeType", "SecurityServicesTypeEnum", "ServerStatus", "StateEnum", "UsageType", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py index 9f11b2f7c47f..8150beb1ae9c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # 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. @@ -13,14 +13,13 @@ from .. import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models class AdvSecurityObjectListResponse(_serialization.Model): """advanced security object. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: response value. Required. :vartype value: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectModel @@ -54,7 +53,7 @@ def __init__( class AdvSecurityObjectModel(_serialization.Model): """List of custom and predefined url category. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: type of object. :vartype type: str @@ -116,7 +115,7 @@ def __init__( class AppSeenData(_serialization.Model): """Data Type for App Seen. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar count: number of rows. Required. :vartype count: int @@ -149,7 +148,7 @@ def __init__(self, *, count: int, app_seen_list: List["_models.AppSeenInfo"], ** class AppSeenInfo(_serialization.Model): """Definition for App Seen. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar title: title. Required. :vartype title: str @@ -225,12 +224,12 @@ def __init__( self.standard_ports = standard_ports -class AzureResourceManagerManagedIdentityProperties(_serialization.Model): +class AzureResourceManagerManagedIdentityProperties(_serialization.Model): # pylint: disable=name-too-long """The properties of the managed service identities assigned to this resource. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar tenant_id: The Active Directory tenant id of the principal. :vartype tenant_id: str @@ -311,7 +310,7 @@ def __init__(self, *, client_id: Optional[str] = None, principal_id: Optional[st class Category(_serialization.Model): """URL/EDL to match. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar url_custom: custom URL. Required. :vartype url_custom: list[str] @@ -347,7 +346,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -389,7 +388,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -401,34 +400,16 @@ class ProxyResource(Resource): :vartype system_data: ~azure.mgmt.paloaltonetworksngfw.models.SystemData """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class CertificateObjectGlobalRulestackResource(ProxyResource): """GlobalRulestack Certificate Object. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -511,10 +492,10 @@ def __init__( self.provisioning_state = None -class CertificateObjectGlobalRulestackResourceListResult(_serialization.Model): +class CertificateObjectGlobalRulestackResourceListResult(_serialization.Model): # pylint: disable=name-too-long """The response of a CertificateObjectGlobalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The items on this page. Required. :vartype value: @@ -556,10 +537,10 @@ class CertificateObjectLocalRulestackResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -642,10 +623,10 @@ def __init__( self.provisioning_state = None -class CertificateObjectLocalRulestackResourceListResult(_serialization.Model): +class CertificateObjectLocalRulestackResourceListResult(_serialization.Model): # pylint: disable=name-too-long """The response of a CertificateObjectLocalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The items on this page. Required. :vartype value: @@ -685,7 +666,7 @@ def __init__( class Changelog(_serialization.Model): """Changelog list. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar changes: list of changes. Required. :vartype changes: list[str] @@ -727,10 +708,36 @@ def __init__( self.last_modified = last_modified +class CloudManagerTenantList(_serialization.Model): + """Cloud Manager Tenant. + + All required parameters must be populated in order to send to server. + + :ivar value: List of Cloud Manager Tenants. Required. + :vartype value: list[str] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[str]"}, + } + + def __init__(self, *, value: List[str], **kwargs: Any) -> None: + """ + :keyword value: List of Cloud Manager Tenants. Required. + :paramtype value: list[str] + """ + super().__init__(**kwargs) + self.value = value + + class CountriesResponse(_serialization.Model): """Countries Response Object. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: List of countries. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.Country] @@ -762,7 +769,7 @@ def __init__(self, *, value: List["_models.Country"], next_link: Optional[str] = class Country(_serialization.Model): """Country Description. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar code: country code. Required. :vartype code: str @@ -890,7 +897,7 @@ def __init__( class EndpointConfiguration(_serialization.Model): """Endpoint Configuration for frontend and backend. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar port: port ID. Required. :vartype port: str @@ -1071,10 +1078,10 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1119,15 +1126,15 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class FirewallResource(TrackedResource): # pylint: disable=too-many-instance-attributes +class FirewallResource(TrackedResource): """PaloAltoNetworks Firewall. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1151,8 +1158,15 @@ class FirewallResource(TrackedResource): # pylint: disable=too-many-instance-at :ivar is_panorama_managed: Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: "TRUE" and "FALSE". :vartype is_panorama_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar is_strata_cloud_managed: Strata Cloud Managed: Default is False. Default will be CloudSec + managed. Known values are: "TRUE" and "FALSE". + :vartype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum :ivar panorama_config: Panorama Configuration. :vartype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig + :ivar strata_cloud_manager_config: Strata Cloud Manager Configuration, only applicable if + Strata Cloud Manager is selected. + :vartype strata_cloud_manager_config: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig :ivar associated_rulestack: Associated Rulestack. :vartype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails :ivar dns_settings: DNS settings for Firewall. Required. @@ -1193,7 +1207,12 @@ class FirewallResource(TrackedResource): # pylint: disable=too-many-instance-at "pan_etag": {"key": "properties.panEtag", "type": "str"}, "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, "is_panorama_managed": {"key": "properties.isPanoramaManaged", "type": "str"}, + "is_strata_cloud_managed": {"key": "properties.isStrataCloudManaged", "type": "str"}, "panorama_config": {"key": "properties.panoramaConfig", "type": "PanoramaConfig"}, + "strata_cloud_manager_config": { + "key": "properties.strataCloudManagerConfig", + "type": "StrataCloudManagerConfig", + }, "associated_rulestack": {"key": "properties.associatedRulestack", "type": "RulestackDetails"}, "dns_settings": {"key": "properties.dnsSettings", "type": "DNSSettings"}, "front_end_settings": {"key": "properties.frontEndSettings", "type": "[FrontendSetting]"}, @@ -1214,7 +1233,9 @@ def __init__( identity: Optional["_models.AzureResourceManagerManagedIdentityProperties"] = None, pan_etag: Optional[str] = None, is_panorama_managed: Optional[Union[str, "_models.BooleanEnum"]] = None, + is_strata_cloud_managed: Optional[Union[str, "_models.BooleanEnum"]] = None, panorama_config: Optional["_models.PanoramaConfig"] = None, + strata_cloud_manager_config: Optional["_models.StrataCloudManagerConfig"] = None, associated_rulestack: Optional["_models.RulestackDetails"] = None, front_end_settings: Optional[List["_models.FrontendSetting"]] = None, **kwargs: Any @@ -1234,8 +1255,15 @@ def __init__( :keyword is_panorama_managed: Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: "TRUE" and "FALSE". :paramtype is_panorama_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :keyword is_strata_cloud_managed: Strata Cloud Managed: Default is False. Default will be + CloudSec managed. Known values are: "TRUE" and "FALSE". + :paramtype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum :keyword panorama_config: Panorama Configuration. :paramtype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig + :keyword strata_cloud_manager_config: Strata Cloud Manager Configuration, only applicable if + Strata Cloud Manager is selected. + :paramtype strata_cloud_manager_config: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig :keyword associated_rulestack: Associated Rulestack. :paramtype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails :keyword dns_settings: DNS settings for Firewall. Required. @@ -1252,7 +1280,9 @@ def __init__( self.pan_etag = pan_etag self.network_profile = network_profile self.is_panorama_managed = is_panorama_managed + self.is_strata_cloud_managed = is_strata_cloud_managed self.panorama_config = panorama_config + self.strata_cloud_manager_config = strata_cloud_manager_config self.associated_rulestack = associated_rulestack self.dns_settings = dns_settings self.front_end_settings = front_end_settings @@ -1264,7 +1294,7 @@ def __init__( class FirewallResourceListResult(_serialization.Model): """The response of a FirewallResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] @@ -1346,8 +1376,15 @@ class FirewallResourceUpdateProperties(_serialization.Model): :ivar is_panorama_managed: Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: "TRUE" and "FALSE". :vartype is_panorama_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar is_strata_cloud_managed: Strata Cloud Managed: Default is False. Default will be CloudSec + managed. Known values are: "TRUE" and "FALSE". + :vartype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum :ivar panorama_config: Panorama Configuration. :vartype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig + :ivar strata_cloud_manager_config: Strata Cloud Manager Configuration, only applicable if + Strata Cloud Manager is selected. + :vartype strata_cloud_manager_config: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig :ivar associated_rulestack: Associated Rulestack. :vartype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails :ivar dns_settings: DNS settings for Firewall. @@ -1364,7 +1401,9 @@ class FirewallResourceUpdateProperties(_serialization.Model): "pan_etag": {"key": "panEtag", "type": "str"}, "network_profile": {"key": "networkProfile", "type": "NetworkProfile"}, "is_panorama_managed": {"key": "isPanoramaManaged", "type": "str"}, + "is_strata_cloud_managed": {"key": "isStrataCloudManaged", "type": "str"}, "panorama_config": {"key": "panoramaConfig", "type": "PanoramaConfig"}, + "strata_cloud_manager_config": {"key": "strataCloudManagerConfig", "type": "StrataCloudManagerConfig"}, "associated_rulestack": {"key": "associatedRulestack", "type": "RulestackDetails"}, "dns_settings": {"key": "dnsSettings", "type": "DNSSettings"}, "front_end_settings": {"key": "frontEndSettings", "type": "[FrontendSetting]"}, @@ -1378,7 +1417,9 @@ def __init__( pan_etag: Optional[str] = None, network_profile: Optional["_models.NetworkProfile"] = None, is_panorama_managed: Optional[Union[str, "_models.BooleanEnum"]] = None, + is_strata_cloud_managed: Optional[Union[str, "_models.BooleanEnum"]] = None, panorama_config: Optional["_models.PanoramaConfig"] = None, + strata_cloud_manager_config: Optional["_models.StrataCloudManagerConfig"] = None, associated_rulestack: Optional["_models.RulestackDetails"] = None, dns_settings: Optional["_models.DNSSettings"] = None, front_end_settings: Optional[List["_models.FrontendSetting"]] = None, @@ -1394,8 +1435,15 @@ def __init__( :keyword is_panorama_managed: Panorama Managed: Default is False. Default will be CloudSec managed. Known values are: "TRUE" and "FALSE". :paramtype is_panorama_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :keyword is_strata_cloud_managed: Strata Cloud Managed: Default is False. Default will be + CloudSec managed. Known values are: "TRUE" and "FALSE". + :paramtype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum :keyword panorama_config: Panorama Configuration. :paramtype panorama_config: ~azure.mgmt.paloaltonetworksngfw.models.PanoramaConfig + :keyword strata_cloud_manager_config: Strata Cloud Manager Configuration, only applicable if + Strata Cloud Manager is selected. + :paramtype strata_cloud_manager_config: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerConfig :keyword associated_rulestack: Associated Rulestack. :paramtype associated_rulestack: ~azure.mgmt.paloaltonetworksngfw.models.RulestackDetails :keyword dns_settings: DNS settings for Firewall. @@ -1411,7 +1459,9 @@ def __init__( self.pan_etag = pan_etag self.network_profile = network_profile self.is_panorama_managed = is_panorama_managed + self.is_strata_cloud_managed = is_strata_cloud_managed self.panorama_config = panorama_config + self.strata_cloud_manager_config = strata_cloud_manager_config self.associated_rulestack = associated_rulestack self.dns_settings = dns_settings self.front_end_settings = front_end_settings @@ -1425,7 +1475,7 @@ class FirewallStatusResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1449,6 +1499,12 @@ class FirewallStatusResource(ProxyResource): "Failed", and "Deleted". :vartype provisioning_state: str or ~azure.mgmt.paloaltonetworksngfw.models.ReadOnlyProvisioningState + :ivar is_strata_cloud_managed: Strata Cloud Manager. Known values are: "TRUE" and "FALSE". + :vartype is_strata_cloud_managed: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum + :ivar strata_cloud_manager_info: This field is only present if Strata Cloud Manager is managing + the policy for this firewall. + :vartype strata_cloud_manager_info: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerInfo """ _validation = { @@ -1461,6 +1517,7 @@ class FirewallStatusResource(ProxyResource): "health_reason": {"readonly": True}, "panorama_status": {"readonly": True}, "provisioning_state": {"readonly": True}, + "is_strata_cloud_managed": {"readonly": True}, } _attribute_map = { @@ -1473,22 +1530,33 @@ class FirewallStatusResource(ProxyResource): "health_reason": {"key": "properties.healthReason", "type": "str"}, "panorama_status": {"key": "properties.panoramaStatus", "type": "PanoramaStatus"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "is_strata_cloud_managed": {"key": "properties.isStrataCloudManaged", "type": "str"}, + "strata_cloud_manager_info": {"key": "properties.strataCloudManagerInfo", "type": "StrataCloudManagerInfo"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, strata_cloud_manager_info: Optional["_models.StrataCloudManagerInfo"] = None, **kwargs: Any + ) -> None: + """ + :keyword strata_cloud_manager_info: This field is only present if Strata Cloud Manager is + managing the policy for this firewall. + :paramtype strata_cloud_manager_info: + ~azure.mgmt.paloaltonetworksngfw.models.StrataCloudManagerInfo + """ super().__init__(**kwargs) self.is_panorama_managed = None self.health_status = None self.health_reason = None self.panorama_status = None self.provisioning_state = None + self.is_strata_cloud_managed = None + self.strata_cloud_manager_info = strata_cloud_manager_info class FirewallStatusResourceListResult(_serialization.Model): """The response of a FirewallStatusResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource] @@ -1524,10 +1592,10 @@ class FqdnListGlobalRulestackResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1599,10 +1667,10 @@ def __init__( self.provisioning_state = None -class FqdnListGlobalRulestackResourceListResult(_serialization.Model): +class FqdnListGlobalRulestackResourceListResult(_serialization.Model): # pylint: disable=name-too-long """The response of a FqdnListGlobalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource] @@ -1638,10 +1706,10 @@ class FqdnListLocalRulestackResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1716,7 +1784,7 @@ def __init__( class FqdnListLocalRulestackResourceListResult(_serialization.Model): """The response of a FqdnListLocalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource] @@ -1750,7 +1818,7 @@ def __init__( class FrontendSetting(_serialization.Model): """Frontend setting for Firewall. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: Settings name. Required. :vartype name: str @@ -1806,7 +1874,7 @@ def __init__( class GlobalRulestackInfo(_serialization.Model): """PAN Rulestack Describe Object. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar azure_id: rulestack description. Required. :vartype azure_id: str @@ -1829,15 +1897,15 @@ def __init__(self, *, azure_id: str, **kwargs: Any) -> None: self.azure_id = azure_id -class GlobalRulestackResource(ProxyResource): # pylint: disable=too-many-instance-attributes +class GlobalRulestackResource(ProxyResource): """PaloAltoNetworks GlobalRulestack. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1959,7 +2027,7 @@ def __init__( class GlobalRulestackResourceListResult(_serialization.Model): """The response of a GlobalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource] @@ -2167,7 +2235,7 @@ def __init__( class ListAppIdResponse(_serialization.Model): """ListAppIdResponse. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: List of AppIds. Required. :vartype value: list[str] @@ -2199,7 +2267,7 @@ def __init__(self, *, value: List[str], next_link: Optional[str] = None, **kwarg class ListFirewallsResponse(_serialization.Model): """List firewalls response. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: firewalls list. Required. :vartype value: list[str] @@ -2228,15 +2296,15 @@ def __init__(self, *, value: List[str], next_link: Optional[str] = None, **kwarg self.next_link = next_link -class LocalRulesResource(ProxyResource): # pylint: disable=too-many-instance-attributes +class LocalRulesResource(ProxyResource): """LocalRulestack rule list. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2420,7 +2488,7 @@ def __init__( # pylint: disable=too-many-locals class LocalRulesResourceListResult(_serialization.Model): """The response of a LocalRulesResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] @@ -2451,15 +2519,15 @@ def __init__( self.next_link = next_link -class LocalRulestackResource(TrackedResource): # pylint: disable=too-many-instance-attributes +class LocalRulestackResource(TrackedResource): """PaloAltoNetworks LocalRulestack. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2586,7 +2654,7 @@ def __init__( class LocalRulestackResourceListResult(_serialization.Model): """The response of a LocalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource] @@ -2852,7 +2920,7 @@ class MarketplaceDetails(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar marketplace_subscription_id: Marketplace Subscription Id. :vartype marketplace_subscription_id: str @@ -2962,7 +3030,7 @@ def __init__( class NameDescriptionObject(_serialization.Model): """object type info. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: name value. Required. :vartype name: str @@ -2994,7 +3062,7 @@ def __init__(self, *, name: str, description: Optional[str] = None, **kwargs: An class NetworkProfile(_serialization.Model): """Network settings for Firewall. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar vnet_configuration: Vnet configurations. :vartype vnet_configuration: ~azure.mgmt.paloaltonetworksngfw.models.VnetConfiguration @@ -3012,6 +3080,9 @@ class NetworkProfile(_serialization.Model): :vartype egress_nat_ip: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] :ivar trusted_ranges: Non-RFC 1918 address. :vartype trusted_ranges: list[str] + :ivar private_source_nat_rules_destination: Array of ipv4 destination address for which source + NAT is to be performed. + :vartype private_source_nat_rules_destination: list[str] """ _validation = { @@ -3028,6 +3099,7 @@ class NetworkProfile(_serialization.Model): "enable_egress_nat": {"key": "enableEgressNat", "type": "str"}, "egress_nat_ip": {"key": "egressNatIp", "type": "[IPAddress]"}, "trusted_ranges": {"key": "trustedRanges", "type": "[str]"}, + "private_source_nat_rules_destination": {"key": "privateSourceNatRulesDestination", "type": "[str]"}, } def __init__( @@ -3040,6 +3112,7 @@ def __init__( vwan_configuration: Optional["_models.VwanConfiguration"] = None, egress_nat_ip: Optional[List["_models.IPAddress"]] = None, trusted_ranges: Optional[List[str]] = None, + private_source_nat_rules_destination: Optional[List[str]] = None, **kwargs: Any ) -> None: """ @@ -3059,6 +3132,9 @@ def __init__( :paramtype egress_nat_ip: list[~azure.mgmt.paloaltonetworksngfw.models.IPAddress] :keyword trusted_ranges: Non-RFC 1918 address. :paramtype trusted_ranges: list[str] + :keyword private_source_nat_rules_destination: Array of ipv4 destination address for which + source NAT is to be performed. + :paramtype private_source_nat_rules_destination: list[str] """ super().__init__(**kwargs) self.vnet_configuration = vnet_configuration @@ -3068,6 +3144,7 @@ def __init__( self.enable_egress_nat = enable_egress_nat self.egress_nat_ip = egress_nat_ip self.trusted_ranges = trusted_ranges + self.private_source_nat_rules_destination = private_source_nat_rules_destination class Operation(_serialization.Model): @@ -3196,7 +3273,7 @@ class PanoramaConfig(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar config_string: Base64 encoded string representing Panorama parameters to be used by Firewall to connect to Panorama. This string is generated via azure plugin in Panorama. @@ -3293,7 +3370,7 @@ class PlanData(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar usage_type: different usage type like PAYG/COMMITTED. Known values are: "PAYG" and "COMMITTED". @@ -3345,15 +3422,15 @@ def __init__( self.effective_date = None -class PostRulesResource(ProxyResource): # pylint: disable=too-many-instance-attributes +class PostRulesResource(ProxyResource): """PostRulestack rule list. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3537,7 +3614,7 @@ def __init__( # pylint: disable=too-many-locals class PostRulesResourceListResult(_serialization.Model): """The response of a PostRulesResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] @@ -3571,7 +3648,7 @@ def __init__( class PredefinedUrlCategoriesResponse(_serialization.Model): """predefined url categories response. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: predefined url categories. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategory] @@ -3605,7 +3682,7 @@ def __init__( class PredefinedUrlCategory(_serialization.Model): """Predefined URL category object. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar action: Required. :vartype action: str @@ -3640,10 +3717,10 @@ class PrefixListGlobalRulestackResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3715,10 +3792,10 @@ def __init__( self.provisioning_state = None -class PrefixListGlobalRulestackResourceListResult(_serialization.Model): +class PrefixListGlobalRulestackResourceListResult(_serialization.Model): # pylint: disable=name-too-long """The response of a PrefixListGlobalRulestackResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource] @@ -3759,10 +3836,10 @@ class PrefixListResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3837,7 +3914,7 @@ def __init__( class PrefixListResourceListResult(_serialization.Model): """The response of a PrefixListResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] @@ -3868,15 +3945,15 @@ def __init__( self.next_link = next_link -class PreRulesResource(ProxyResource): # pylint: disable=too-many-instance-attributes +class PreRulesResource(ProxyResource): """PreRulestack rule list. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4060,7 +4137,7 @@ def __init__( # pylint: disable=too-many-locals class PreRulesResourceListResult(_serialization.Model): """The response of a PreRulesResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The items on this page. Required. :vartype value: list[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] @@ -4091,10 +4168,76 @@ def __init__( self.next_link = next_link +class ProductSerialNumberRequestStatus(_serialization.Model): + """Create Product Serial Number Request status. + + All required parameters must be populated in order to send to server. + + :ivar status: allocation status of the product serial number. Required. + :vartype status: str + """ + + _validation = { + "status": {"required": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, *, status: str, **kwargs: Any) -> None: + """ + :keyword status: allocation status of the product serial number. Required. + :paramtype status: str + """ + super().__init__(**kwargs) + self.status = status + + +class ProductSerialNumberStatus(_serialization.Model): + """Product serial and status for the service. + + All required parameters must be populated in order to send to server. + + :ivar serial_number: product Serial associated with given resource. + :vartype serial_number: str + :ivar status: allocation status of the product serial number. Required. Known values are: + "Allocated" and "InProgress". + :vartype status: str or ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialStatusValues + """ + + _validation = { + "status": {"required": True}, + } + + _attribute_map = { + "serial_number": {"key": "serialNumber", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, + *, + status: Union[str, "_models.ProductSerialStatusValues"], + serial_number: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword serial_number: product Serial associated with given resource. + :paramtype serial_number: str + :keyword status: allocation status of the product serial number. Required. Known values are: + "Allocated" and "InProgress". + :paramtype status: str or ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialStatusValues + """ + super().__init__(**kwargs) + self.serial_number = serial_number + self.status = status + + class RuleCounter(_serialization.Model): """Rule counter. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar priority: priority number. Required. :vartype priority: str @@ -4358,7 +4501,7 @@ def __init__( class SecurityServicesResponse(_serialization.Model): """Security services list response. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: response value. Required. :vartype value: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesTypeList @@ -4392,7 +4535,7 @@ def __init__( class SecurityServicesTypeList(_serialization.Model): """Security services type list. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: security services type. :vartype type: str @@ -4508,7 +4651,61 @@ def __init__( self.account_name = account_name -class SupportInfo(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StrataCloudManagerConfig(_serialization.Model): + """This field is only present if Strata Cloud Manager is managing the policy for this firewall. + + All required parameters must be populated in order to send to server. + + :ivar cloud_manager_name: Strata Cloud Manager name which is intended to manage the policy for + this firewall. Required. + :vartype cloud_manager_name: str + """ + + _validation = { + "cloud_manager_name": {"required": True}, + } + + _attribute_map = { + "cloud_manager_name": {"key": "cloudManagerName", "type": "str"}, + } + + def __init__(self, *, cloud_manager_name: str, **kwargs: Any) -> None: + """ + :keyword cloud_manager_name: Strata Cloud Manager name which is intended to manage the policy + for this firewall. Required. + :paramtype cloud_manager_name: str + """ + super().__init__(**kwargs) + self.cloud_manager_name = cloud_manager_name + + +class StrataCloudManagerInfo(_serialization.Model): + """Strata Cloud Manager Info. + + :ivar folder_name: Strata Cloud Manager folder in which this firewall has been placed. + :vartype folder_name: str + :ivar hub_url: URL for Strata Cloud Manager. + :vartype hub_url: str + """ + + _attribute_map = { + "folder_name": {"key": "folderName", "type": "str"}, + "hub_url": {"key": "hubUrl", "type": "str"}, + } + + def __init__(self, *, folder_name: Optional[str] = None, hub_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword folder_name: Strata Cloud Manager folder in which this firewall has been placed. + :paramtype folder_name: str + :keyword hub_url: URL for Strata Cloud Manager. + :paramtype hub_url: str + """ + super().__init__(**kwargs) + self.folder_name = folder_name + self.hub_url = hub_url + + +class SupportInfo(_serialization.Model): """Support information for the resource. :ivar product_sku: product SKU associated with given resource. @@ -4518,8 +4715,14 @@ class SupportInfo(_serialization.Model): # pylint: disable=too-many-instance-at :ivar account_registered: account registered in Customer Support Portal. Known values are: "TRUE" and "FALSE". :vartype account_registered: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :ivar account_id: Support account associated with given resource. + :ivar account_id: Support account associated with given resource when association type is + tenant. :vartype account_id: str + :ivar account_id_for_billing: Support account associated with given resource when association + type is billing. + :vartype account_id_for_billing: str + :ivar association_type: Association Type. + :vartype association_type: str :ivar user_domain_supported: user domain is supported in Customer Support Portal. Known values are: "TRUE" and "FALSE". :vartype user_domain_supported: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum @@ -4545,6 +4748,8 @@ class SupportInfo(_serialization.Model): # pylint: disable=too-many-instance-at "product_serial": {"key": "productSerial", "type": "str"}, "account_registered": {"key": "accountRegistered", "type": "str"}, "account_id": {"key": "accountId", "type": "str"}, + "account_id_for_billing": {"key": "accountIdForBilling", "type": "str"}, + "association_type": {"key": "associationType", "type": "str"}, "user_domain_supported": {"key": "userDomainSupported", "type": "str"}, "user_registered": {"key": "userRegistered", "type": "str"}, "free_trial": {"key": "freeTrial", "type": "str"}, @@ -4562,6 +4767,8 @@ def __init__( product_serial: Optional[str] = None, account_registered: Optional[Union[str, "_models.BooleanEnum"]] = None, account_id: Optional[str] = None, + account_id_for_billing: Optional[str] = None, + association_type: Optional[str] = None, user_domain_supported: Optional[Union[str, "_models.BooleanEnum"]] = None, user_registered: Optional[Union[str, "_models.BooleanEnum"]] = None, free_trial: Optional[Union[str, "_models.BooleanEnum"]] = None, @@ -4580,8 +4787,14 @@ def __init__( :keyword account_registered: account registered in Customer Support Portal. Known values are: "TRUE" and "FALSE". :paramtype account_registered: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum - :keyword account_id: Support account associated with given resource. + :keyword account_id: Support account associated with given resource when association type is + tenant. :paramtype account_id: str + :keyword account_id_for_billing: Support account associated with given resource when + association type is billing. + :paramtype account_id_for_billing: str + :keyword association_type: Association Type. + :paramtype association_type: str :keyword user_domain_supported: user domain is supported in Customer Support Portal. Known values are: "TRUE" and "FALSE". :paramtype user_domain_supported: str or ~azure.mgmt.paloaltonetworksngfw.models.BooleanEnum @@ -4607,6 +4820,8 @@ def __init__( self.product_serial = product_serial self.account_registered = account_registered self.account_id = account_id + self.account_id_for_billing = account_id_for_billing + self.association_type = association_type self.user_domain_supported = user_domain_supported self.user_registered = user_registered self.free_trial = free_trial @@ -4617,6 +4832,153 @@ def __init__( self.register_url = register_url +class SupportInfoModel(_serialization.Model): + """Support information for the service. + + :ivar product_sku: product SKU associated with given resource. + :vartype product_sku: str + :ivar product_serial: product Serial associated with given resource. + :vartype product_serial: str + :ivar account_registration_status: account registered in Customer Support Portal. Known values + are: "Registered" and "Not Registered". + :vartype account_registration_status: str or + ~azure.mgmt.paloaltonetworksngfw.models.RegistrationStatus + :ivar account_id: Support account associated with given resource when association type is + tenant. + :vartype account_id: str + :ivar account_id_for_billing: Support account associated with given resource when association + type is billing. + :vartype account_id_for_billing: str + :ivar association_type: Association Type. + :vartype association_type: str + :ivar free_trial: Product usage is in free trial period. Known values are: "Enabled" and + "Disabled". + :vartype free_trial: str or ~azure.mgmt.paloaltonetworksngfw.models.EnableStatus + :ivar free_trial_days_left: Free trial days remaining. + :vartype free_trial_days_left: int + :ivar free_trial_credit_left: Free trial credit remaining. + :vartype free_trial_credit_left: int + :ivar help_url: URL for paloaltonetworks live community. + :vartype help_url: str + :ivar support_url: URL for paloaltonetworks Customer Service Portal. + :vartype support_url: str + :ivar register_url: URL for registering product in paloaltonetworks Customer Service Portal. + :vartype register_url: str + :ivar hub_url: URL for Strata Cloud Manager. + :vartype hub_url: str + :ivar credits: credits purchased, unit per hour. + :vartype credits: int + :ivar monthly_credit_left: monthly credit is computed as credits * days in calendar month. + :vartype monthly_credit_left: int + :ivar start_date_for_credits: date in format yyyy-mm-dd. + :vartype start_date_for_credits: str + :ivar end_date_for_credits: date in format yyyy-mm-dd. + :vartype end_date_for_credits: str + """ + + _attribute_map = { + "product_sku": {"key": "productSku", "type": "str"}, + "product_serial": {"key": "productSerial", "type": "str"}, + "account_registration_status": {"key": "accountRegistrationStatus", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "account_id_for_billing": {"key": "accountIdForBilling", "type": "str"}, + "association_type": {"key": "associationType", "type": "str"}, + "free_trial": {"key": "freeTrial", "type": "str"}, + "free_trial_days_left": {"key": "freeTrialDaysLeft", "type": "int"}, + "free_trial_credit_left": {"key": "freeTrialCreditLeft", "type": "int"}, + "help_url": {"key": "helpURL", "type": "str"}, + "support_url": {"key": "supportURL", "type": "str"}, + "register_url": {"key": "registerURL", "type": "str"}, + "hub_url": {"key": "hubUrl", "type": "str"}, + "credits": {"key": "credits", "type": "int"}, + "monthly_credit_left": {"key": "monthlyCreditLeft", "type": "int"}, + "start_date_for_credits": {"key": "startDateForCredits", "type": "str"}, + "end_date_for_credits": {"key": "endDateForCredits", "type": "str"}, + } + + def __init__( + self, + *, + product_sku: Optional[str] = None, + product_serial: Optional[str] = None, + account_registration_status: Optional[Union[str, "_models.RegistrationStatus"]] = None, + account_id: Optional[str] = None, + account_id_for_billing: Optional[str] = None, + association_type: Optional[str] = None, + free_trial: Optional[Union[str, "_models.EnableStatus"]] = None, + free_trial_days_left: Optional[int] = None, + free_trial_credit_left: Optional[int] = None, + help_url: Optional[str] = None, + support_url: Optional[str] = None, + register_url: Optional[str] = None, + hub_url: Optional[str] = None, + credits: Optional[int] = None, + monthly_credit_left: Optional[int] = None, + start_date_for_credits: Optional[str] = None, + end_date_for_credits: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword product_sku: product SKU associated with given resource. + :paramtype product_sku: str + :keyword product_serial: product Serial associated with given resource. + :paramtype product_serial: str + :keyword account_registration_status: account registered in Customer Support Portal. Known + values are: "Registered" and "Not Registered". + :paramtype account_registration_status: str or + ~azure.mgmt.paloaltonetworksngfw.models.RegistrationStatus + :keyword account_id: Support account associated with given resource when association type is + tenant. + :paramtype account_id: str + :keyword account_id_for_billing: Support account associated with given resource when + association type is billing. + :paramtype account_id_for_billing: str + :keyword association_type: Association Type. + :paramtype association_type: str + :keyword free_trial: Product usage is in free trial period. Known values are: "Enabled" and + "Disabled". + :paramtype free_trial: str or ~azure.mgmt.paloaltonetworksngfw.models.EnableStatus + :keyword free_trial_days_left: Free trial days remaining. + :paramtype free_trial_days_left: int + :keyword free_trial_credit_left: Free trial credit remaining. + :paramtype free_trial_credit_left: int + :keyword help_url: URL for paloaltonetworks live community. + :paramtype help_url: str + :keyword support_url: URL for paloaltonetworks Customer Service Portal. + :paramtype support_url: str + :keyword register_url: URL for registering product in paloaltonetworks Customer Service Portal. + :paramtype register_url: str + :keyword hub_url: URL for Strata Cloud Manager. + :paramtype hub_url: str + :keyword credits: credits purchased, unit per hour. + :paramtype credits: int + :keyword monthly_credit_left: monthly credit is computed as credits * days in calendar month. + :paramtype monthly_credit_left: int + :keyword start_date_for_credits: date in format yyyy-mm-dd. + :paramtype start_date_for_credits: str + :keyword end_date_for_credits: date in format yyyy-mm-dd. + :paramtype end_date_for_credits: str + """ + super().__init__(**kwargs) + self.product_sku = product_sku + self.product_serial = product_serial + self.account_registration_status = account_registration_status + self.account_id = account_id + self.account_id_for_billing = account_id_for_billing + self.association_type = association_type + self.free_trial = free_trial + self.free_trial_days_left = free_trial_days_left + self.free_trial_credit_left = free_trial_credit_left + self.help_url = help_url + self.support_url = support_url + self.register_url = register_url + self.hub_url = hub_url + self.credits = credits + self.monthly_credit_left = monthly_credit_left + self.start_date_for_credits = start_date_for_credits + self.end_date_for_credits = end_date_for_credits + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -4684,7 +5046,7 @@ def __init__( class TagInfo(_serialization.Model): """Tag. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar key: tag name. Required. :vartype key: str @@ -4717,7 +5079,7 @@ def __init__(self, *, key: str, value: str, **kwargs: Any) -> None: class VnetConfiguration(_serialization.Model): """VnetInfo for Firewall Networking. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar vnet: Azure Virtual Network. Required. :vartype vnet: ~azure.mgmt.paloaltonetworksngfw.models.IPAddressSpace @@ -4771,7 +5133,7 @@ def __init__( class VwanConfiguration(_serialization.Model): """VwanInfo for Firewall Networking. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar network_virtual_appliance_id: Network Virtual Appliance resource ID. :vartype network_virtual_appliance_id: str diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_palo_alto_networks_ngfw_mgmt_client_enums.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_palo_alto_networks_ngfw_mgmt_client_enums.py index 58c50e2a512c..6ab85dbde444 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_palo_alto_networks_ngfw_mgmt_client_enums.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/models/_palo_alto_networks_ngfw_mgmt_client_enums.py @@ -92,6 +92,13 @@ class EnabledDNSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE = "AZURE" +class EnableStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enable status.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class HealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status Codes for the Firewall.""" @@ -156,6 +163,13 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_SYSTEM = "user,system" +class ProductSerialStatusValues(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """allocation status of the product serial number.""" + + ALLOCATED = "Allocated" + IN_PROGRESS = "InProgress" + + class ProtocolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Protocol Enum.""" @@ -185,6 +199,13 @@ class ReadOnlyProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETED = "Deleted" +class RegistrationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Registration status.""" + + REGISTERED = "Registered" + NOT_REGISTERED = "Not Registered" + + class ScopeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Rulestack Type.""" diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/__init__.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/__init__.py index 72bdc9199a7f..3875b679c3ed 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/__init__.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/__init__.py @@ -5,24 +5,31 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._global_rulestack_operations import GlobalRulestackOperations -from ._certificate_object_global_rulestack_operations import CertificateObjectGlobalRulestackOperations -from ._fqdn_list_global_rulestack_operations import FqdnListGlobalRulestackOperations -from ._post_rules_operations import PostRulesOperations -from ._prefix_list_global_rulestack_operations import PrefixListGlobalRulestackOperations -from ._pre_rules_operations import PreRulesOperations -from ._operations import Operations -from ._firewalls_operations import FirewallsOperations -from ._local_rulestacks_operations import LocalRulestacksOperations -from ._firewall_status_operations import FirewallStatusOperations -from ._certificate_object_local_rulestack_operations import CertificateObjectLocalRulestackOperations -from ._fqdn_list_local_rulestack_operations import FqdnListLocalRulestackOperations -from ._local_rules_operations import LocalRulesOperations -from ._prefix_list_local_rulestack_operations import PrefixListLocalRulestackOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._global_rulestack_operations import GlobalRulestackOperations # type: ignore +from ._certificate_object_global_rulestack_operations import CertificateObjectGlobalRulestackOperations # type: ignore +from ._fqdn_list_global_rulestack_operations import FqdnListGlobalRulestackOperations # type: ignore +from ._post_rules_operations import PostRulesOperations # type: ignore +from ._prefix_list_global_rulestack_operations import PrefixListGlobalRulestackOperations # type: ignore +from ._pre_rules_operations import PreRulesOperations # type: ignore +from ._operations import Operations # type: ignore +from ._palo_alto_networks_cloudngfw_operations import PaloAltoNetworksCloudngfwOperations # type: ignore +from ._firewalls_operations import FirewallsOperations # type: ignore +from ._local_rulestacks_operations import LocalRulestacksOperations # type: ignore +from ._firewall_status_operations import FirewallStatusOperations # type: ignore +from ._certificate_object_local_rulestack_operations import CertificateObjectLocalRulestackOperations # type: ignore +from ._fqdn_list_local_rulestack_operations import FqdnListLocalRulestackOperations # type: ignore +from ._local_rules_operations import LocalRulesOperations # type: ignore +from ._prefix_list_local_rulestack_operations import PrefixListLocalRulestackOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -33,6 +40,7 @@ "PrefixListGlobalRulestackOperations", "PreRulesOperations", "Operations", + "PaloAltoNetworksCloudngfwOperations", "FirewallsOperations", "LocalRulestacksOperations", "FirewallStatusOperations", @@ -41,5 +49,5 @@ "LocalRulesOperations", "PrefixListLocalRulestackOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_global_rulestack_operations.py index 037b6f643848..57957765beee 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_global_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request(global_rulestack_name: str, **kwargs: Any) -> HttpRequest _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +73,7 @@ def build_get_request(global_rulestack_name: str, name: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +101,7 @@ def build_create_or_update_request(global_rulestack_name: str, name: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +132,7 @@ def build_delete_request(global_rulestack_name: str, name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +156,7 @@ def build_delete_request(global_rulestack_name: str, name: str, **kwargs: Any) - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -class CertificateObjectGlobalRulestackOperations: +class CertificateObjectGlobalRulestackOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -179,7 +183,6 @@ def list( :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -192,7 +195,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -203,15 +206,13 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -223,13 +224,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CertificateObjectGlobalRulestackResourceListResult", pipeline_response) @@ -239,11 +239,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -256,8 +256,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates"} - @distributed_trace def get( self, global_rulestack_name: str, name: str, **kwargs: Any @@ -268,12 +266,11 @@ def get( :type global_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -287,20 +284,18 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -310,25 +305,21 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( self, global_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectGlobalRulestackResource, IO], + resource: Union[_models.CertificateObjectGlobalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.CertificateObjectGlobalRulestackResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +332,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateObjectGlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -351,47 +342,42 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "CertificateObjectGlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } - @overload def begin_create_or_update( self, @@ -414,14 +400,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -434,7 +412,7 @@ def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -446,18 +424,10 @@ def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -470,7 +440,7 @@ def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectGlobalRulestackResource, IO], + resource: Union[_models.CertificateObjectGlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.CertificateObjectGlobalRulestackResource]: """Create a CertificateObjectGlobalRulestackResource. @@ -480,20 +450,9 @@ def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Is either a - CertificateObjectGlobalRulestackResource type or a IO type. Required. + CertificateObjectGlobalRulestackResource type or a IO[bytes] type. Required. :type resource: - ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectGlobalRulestackResource or IO[bytes] :return: An instance of LROPoller that returns either CertificateObjectGlobalRulestackResource or the result of cls(response) :rtype: @@ -521,12 +480,15 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateObjectGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize( + "CertificateObjectGlobalRulestackResource", pipeline_response.http_response + ) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -538,22 +500,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.CertificateObjectGlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return LROPoller[_models.CertificateObjectGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -565,37 +523,40 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -605,14 +566,6 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> :type global_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -626,7 +579,7 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, @@ -635,11 +588,12 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -650,14 +604,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_local_rulestack_operations.py index b911c687fa3d..c4708610b454 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_certificate_object_local_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +49,7 @@ def build_list_by_local_rulestacks_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +116,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +153,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +181,7 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -class CertificateObjectLocalRulestackOperations: +class CertificateObjectLocalRulestackOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -207,7 +211,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -220,7 +223,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectLocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,17 +234,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -253,13 +254,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CertificateObjectLocalRulestackResourceListResult", pipeline_response) @@ -269,11 +269,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -286,10 +286,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates" - } - @distributed_trace def get( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any @@ -303,12 +299,11 @@ def get( :type local_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,22 +317,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CertificateObjectLocalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -347,26 +340,22 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectLocalRulestackResource, IO], + resource: Union[_models.CertificateObjectLocalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.CertificateObjectLocalRulestackResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -379,7 +368,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CertificateObjectLocalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -389,7 +378,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "CertificateObjectLocalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -398,40 +387,35 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } - @overload def begin_create_or_update( self, @@ -457,14 +441,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -478,7 +454,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -493,18 +469,10 @@ def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -518,7 +486,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.CertificateObjectLocalRulestackResource, IO], + resource: Union[_models.CertificateObjectLocalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.CertificateObjectLocalRulestackResource]: """Create a CertificateObjectLocalRulestackResource. @@ -531,20 +499,9 @@ def begin_create_or_update( :param name: certificate name. Required. :type name: str :param resource: Resource create parameters. Is either a - CertificateObjectLocalRulestackResource type or a IO type. Required. + CertificateObjectLocalRulestackResource type or a IO[bytes] type. Required. :type resource: ~azure.mgmt.paloaltonetworksngfw.models.CertificateObjectLocalRulestackResource - 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. + or IO[bytes] :return: An instance of LROPoller that returns either CertificateObjectLocalRulestackResource or the result of cls(response) :rtype: @@ -573,12 +530,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("CertificateObjectLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -590,22 +548,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.CertificateObjectLocalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return LROPoller[_models.CertificateObjectLocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -617,39 +573,42 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -664,14 +623,6 @@ def begin_delete( :type local_rulestack_name: str :param name: certificate name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -685,7 +636,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -695,11 +646,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -710,14 +662,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewall_status_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewall_status_operations.py index 606fad16f2a0..a1148061049c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewall_status_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewall_status_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +44,7 @@ def build_list_by_firewalls_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +75,7 @@ def build_get_request(resource_group_name: str, firewall_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +132,6 @@ def list_by_firewalls( :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallStatusResource or the result of cls(response) :rtype: @@ -143,7 +144,7 @@ def list_by_firewalls( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallStatusResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -154,17 +155,15 @@ def list_by_firewalls( def prepare_request(next_link=None): if not next_link: - request = build_list_by_firewalls_request( + _request = build_list_by_firewalls_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_firewalls.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -176,13 +175,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FirewallStatusResourceListResult", pipeline_response) @@ -192,11 +190,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -209,10 +207,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_firewalls.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses" - } - @distributed_trace def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.FirewallStatusResource: """Get a FirewallStatusResource. @@ -222,12 +216,11 @@ def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _m :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallStatusResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallStatusResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -241,21 +234,19 @@ def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _m api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallStatusResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -265,13 +256,9 @@ def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallStatusResource", pipeline_response) + deserialized = self._deserialize("FirewallStatusResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses/default" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewalls_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewalls_operations.py index adf8749a7356..33e4e0b39414 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewalls_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_firewalls_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +72,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +102,7 @@ def build_get_request(resource_group_name: str, firewall_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +135,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -166,7 +171,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -202,7 +207,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -235,7 +240,7 @@ def build_get_global_rulestack_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -268,7 +273,7 @@ def build_get_log_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -301,7 +306,7 @@ def build_get_support_info_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -336,7 +341,7 @@ def build_save_log_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -389,7 +394,6 @@ def __init__(self, *args, **kwargs): def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.FirewallResource"]: """List FirewallResource resources by subscription ID. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -400,7 +404,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.FirewallResou api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,15 +415,13 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.FirewallResou def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -431,13 +433,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FirewallResourceListResult", pipeline_response) @@ -447,11 +448,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -464,10 +465,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/firewalls" - } - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.FirewallResource"]: """List FirewallResource resources by resource group. @@ -475,7 +472,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -486,7 +482,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -497,16 +493,14 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -518,13 +512,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FirewallResourceListResult", pipeline_response) @@ -534,11 +527,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -551,10 +544,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls" - } - @distributed_trace def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.FirewallResource: """Get a FirewallResource. @@ -564,12 +553,11 @@ def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _m :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -583,21 +571,19 @@ def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _m api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -607,21 +593,21 @@ def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallResource", pipeline_response) + deserialized = self._deserialize("FirewallResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return deserialized # type: ignore def _create_or_update_initial( - self, resource_group_name: str, firewall_name: str, resource: Union[_models.FirewallResource, IO], **kwargs: Any - ) -> _models.FirewallResource: - error_map = { + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.FirewallResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -634,7 +620,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -644,7 +630,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "FirewallResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, @@ -652,40 +638,35 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FirewallResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FirewallResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } - @overload def begin_create_or_update( self, @@ -708,14 +689,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FirewallResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] @@ -727,7 +700,7 @@ def begin_create_or_update( self, resource_group_name: str, firewall_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -740,18 +713,10 @@ def begin_create_or_update( :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FirewallResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] @@ -760,7 +725,11 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, firewall_name: str, resource: Union[_models.FirewallResource, IO], **kwargs: Any + self, + resource_group_name: str, + firewall_name: str, + resource: Union[_models.FirewallResource, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.FirewallResource]: """Create a FirewallResource. @@ -769,20 +738,9 @@ def begin_create_or_update( :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :param resource: Resource create parameters. Is either a FirewallResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource 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. + :param resource: Resource create parameters. Is either a FirewallResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource or IO[bytes] :return: An instance of LROPoller that returns either FirewallResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] @@ -809,12 +767,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallResource", pipeline_response) + deserialized = self._deserialize("FirewallResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -826,17 +785,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.FirewallResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return LROPoller[_models.FirewallResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update( @@ -860,7 +817,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: @@ -871,7 +827,7 @@ def update( self, resource_group_name: str, firewall_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -884,11 +840,10 @@ def update( :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: @@ -899,7 +854,7 @@ def update( self, resource_group_name: str, firewall_name: str, - properties: Union[_models.FirewallResourceUpdate, IO], + properties: Union[_models.FirewallResourceUpdate, IO[bytes]], **kwargs: Any ) -> _models.FirewallResource: """Update a FirewallResource. @@ -910,17 +865,13 @@ def update( :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param properties: The resource properties to be updated. Is either a FirewallResourceUpdate - type or a IO type. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate or IO[bytes] :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -943,7 +894,7 @@ def update( else: _json = self._serialize.body(properties, "FirewallResourceUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, @@ -951,16 +902,14 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -970,21 +919,15 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FirewallResource", pipeline_response) + deserialized = self._deserialize("FirewallResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, firewall_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -996,38 +939,41 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1038,14 +984,6 @@ def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: A :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1059,7 +997,7 @@ def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: A lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, firewall_name=firewall_name, api_version=api_version, @@ -1068,11 +1006,12 @@ def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: A params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1083,17 +1022,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_global_rulestack( @@ -1106,12 +1041,11 @@ def get_global_rulestack( :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1125,21 +1059,19 @@ def get_global_rulestack( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalRulestackInfo] = kwargs.pop("cls", None) - request = build_get_global_rulestack_request( + _request = build_get_global_rulestack_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_global_rulestack.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1149,16 +1081,12 @@ def get_global_rulestack( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalRulestackInfo", pipeline_response) + deserialized = self._deserialize("GlobalRulestackInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_global_rulestack.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getGlobalRulestack" - } + return deserialized # type: ignore @distributed_trace def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.LogSettings: @@ -1169,12 +1097,11 @@ def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LogSettings or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1188,21 +1115,19 @@ def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LogSettings] = kwargs.pop("cls", None) - request = build_get_log_profile_request( + _request = build_get_log_profile_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_log_profile.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1212,16 +1137,12 @@ def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LogSettings", pipeline_response) + deserialized = self._deserialize("LogSettings", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_log_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getLogProfile" - } + return deserialized # type: ignore @distributed_trace def get_support_info( @@ -1236,12 +1157,11 @@ def get_support_info( :type firewall_name: str :param email: email address on behalf of which this API called. Default value is None. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1255,22 +1175,20 @@ def get_support_info( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportInfo] = kwargs.pop("cls", None) - request = build_get_support_info_request( + _request = build_get_support_info_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, email=email, api_version=api_version, - template_url=self.get_support_info.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1280,19 +1198,15 @@ def get_support_info( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportInfo", pipeline_response) + deserialized = self._deserialize("SupportInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_support_info.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getSupportInfo" - } + return deserialized # type: ignore @overload - def save_log_profile( # pylint: disable=inconsistent-return-statements + def save_log_profile( self, resource_group_name: str, firewall_name: str, @@ -1313,18 +1227,17 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def save_log_profile( # pylint: disable=inconsistent-return-statements + def save_log_profile( self, resource_group_name: str, firewall_name: str, - log_settings: Optional[IO] = None, + log_settings: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1337,11 +1250,10 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param log_settings: Default value is None. - :type log_settings: IO + :type log_settings: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1352,7 +1264,7 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, firewall_name: str, - log_settings: Optional[Union[_models.LogSettings, IO]] = None, + log_settings: Optional[Union[_models.LogSettings, IO[bytes]]] = None, **kwargs: Any ) -> None: """Log Profile for Firewall. @@ -1362,17 +1274,13 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str - :param log_settings: Is either a LogSettings type or a IO type. Default value is None. - :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings 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 + :param log_settings: Is either a LogSettings type or a IO[bytes] type. Default value is None. + :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1398,7 +1306,7 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements else: _json = None - request = build_save_log_profile_request( + _request = build_save_log_profile_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, @@ -1406,16 +1314,14 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.save_log_profile.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1426,8 +1332,4 @@ def save_log_profile( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - save_log_profile.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/saveLogProfile" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_global_rulestack_operations.py index 80ba3005d964..aefc3f5191ef 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_global_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request(global_rulestack_name: str, **kwargs: Any) -> HttpRequest _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +73,7 @@ def build_get_request(global_rulestack_name: str, name: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +100,7 @@ def build_create_or_update_request(global_rulestack_name: str, name: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -126,7 +130,7 @@ def build_delete_request(global_rulestack_name: str, name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +178,6 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.F :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -187,7 +190,7 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.F api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -198,15 +201,13 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.F def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -218,13 +219,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FqdnListGlobalRulestackResourceListResult", pipeline_response) @@ -234,11 +234,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,8 +251,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists"} - @distributed_trace def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.FqdnListGlobalRulestackResource: """Get a FqdnListGlobalRulestackResource. @@ -261,12 +259,11 @@ def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.F :type global_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FqdnListGlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -280,20 +277,18 @@ def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.F api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListGlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -303,25 +298,21 @@ def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.F error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( self, global_rulestack_name: str, name: str, - resource: Union[_models.FqdnListGlobalRulestackResource, IO], + resource: Union[_models.FqdnListGlobalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.FqdnListGlobalRulestackResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -334,7 +325,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FqdnListGlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -344,47 +335,42 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "FqdnListGlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } - @overload def begin_create_or_update( self, @@ -406,14 +392,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -426,7 +404,7 @@ def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -438,18 +416,10 @@ def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -462,7 +432,7 @@ def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: Union[_models.FqdnListGlobalRulestackResource, IO], + resource: Union[_models.FqdnListGlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.FqdnListGlobalRulestackResource]: """Create a FqdnListGlobalRulestackResource. @@ -472,19 +442,9 @@ def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Is either a FqdnListGlobalRulestackResource type - or a IO type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource 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. + or a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListGlobalRulestackResource or + IO[bytes] :return: An instance of LROPoller that returns either FqdnListGlobalRulestackResource or the result of cls(response) :rtype: @@ -512,12 +472,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -529,22 +490,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.FqdnListGlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return LROPoller[_models.FqdnListGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -556,37 +513,40 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -596,14 +556,6 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> :type global_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -617,7 +569,7 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, @@ -626,11 +578,12 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -641,14 +594,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_local_rulestack_operations.py index d44277f52f8b..daa2e978e9a1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_fqdn_list_local_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +49,7 @@ def build_list_by_local_rulestacks_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +116,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +153,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +211,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -220,7 +223,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListLocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,17 +234,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -253,13 +254,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FqdnListLocalRulestackResourceListResult", pipeline_response) @@ -269,11 +269,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -286,10 +286,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists" - } - @distributed_trace def get( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any @@ -303,12 +299,11 @@ def get( :type local_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FqdnListLocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,22 +317,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FqdnListLocalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -347,26 +340,22 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.FqdnListLocalRulestackResource, IO], + resource: Union[_models.FqdnListLocalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.FqdnListLocalRulestackResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -379,7 +368,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FqdnListLocalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -389,7 +378,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "FqdnListLocalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -398,40 +387,35 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } - @overload def begin_create_or_update( self, @@ -457,14 +441,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -478,7 +454,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -493,18 +469,10 @@ def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -518,7 +486,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.FqdnListLocalRulestackResource, IO], + resource: Union[_models.FqdnListLocalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.FqdnListLocalRulestackResource]: """Create a FqdnListLocalRulestackResource. @@ -531,19 +499,9 @@ def begin_create_or_update( :param name: fqdn list name. Required. :type name: str :param resource: Resource create parameters. Is either a FqdnListLocalRulestackResource type or - a IO type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FqdnListLocalRulestackResource or + IO[bytes] :return: An instance of LROPoller that returns either FqdnListLocalRulestackResource or the result of cls(response) :rtype: @@ -572,12 +530,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response) + deserialized = self._deserialize("FqdnListLocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -589,22 +548,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.FqdnListLocalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return LROPoller[_models.FqdnListLocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -616,39 +573,42 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -663,14 +623,6 @@ def begin_delete( :type local_rulestack_name: str :param name: fqdn list name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -684,7 +636,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -694,11 +646,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -709,14 +662,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_global_rulestack_operations.py index 005c272705f0..73de05bbb372 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_global_rulestack_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +67,7 @@ def build_get_request(global_rulestack_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +91,7 @@ def build_create_or_update_request(global_rulestack_name: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -113,7 +118,7 @@ def build_update_request(global_rulestack_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -140,7 +145,7 @@ def build_delete_request(global_rulestack_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +169,7 @@ def build_commit_request(global_rulestack_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +195,7 @@ def build_get_change_log_request(global_rulestack_name: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -212,7 +217,7 @@ def build_get_change_log_request(global_rulestack_name: str, **kwargs: Any) -> H return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_advanced_security_objects_request( +def build_list_advanced_security_objects_request( # pylint: disable=name-too-long global_rulestack_name: str, *, type: Union[str, _models.AdvSecurityObjectTypeEnum], @@ -223,7 +228,7 @@ def build_list_advanced_security_objects_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -263,7 +268,7 @@ def build_list_app_ids_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -299,7 +304,7 @@ def build_list_countries_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -329,7 +334,7 @@ def build_list_firewalls_request(global_rulestack_name: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -351,13 +356,13 @@ def build_list_firewalls_request(global_rulestack_name: str, **kwargs: Any) -> H return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_predefined_url_categories_request( +def build_list_predefined_url_categories_request( # pylint: disable=name-too-long global_rulestack_name: str, *, skip: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -395,7 +400,7 @@ def build_list_security_services_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -427,7 +432,7 @@ def build_revert_request(global_rulestack_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -472,7 +477,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.GlobalRulestackResource"]: """List GlobalRulestackResource resources by Tenant. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GlobalRulestackResource or the result of cls(response) :rtype: @@ -485,7 +489,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.GlobalRulestackResource"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -496,14 +500,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.GlobalRulestackResource"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -515,13 +517,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("GlobalRulestackResourceListResult", pipeline_response) @@ -531,11 +532,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,20 +549,17 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks"} - @distributed_trace def get(self, global_rulestack_name: str, **kwargs: Any) -> _models.GlobalRulestackResource: """Get a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,19 +573,17 @@ def get(self, global_rulestack_name: str, **kwargs: Any) -> _models.GlobalRulest api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -597,19 +593,17 @@ def get(self, global_rulestack_name: str, **kwargs: Any) -> _models.GlobalRulest error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("GlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} + return deserialized # type: ignore def _create_or_update_initial( - self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO], **kwargs: Any - ) -> _models.GlobalRulestackResource: - error_map = { + self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +616,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -632,46 +626,41 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "GlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" - } - @overload def begin_create_or_update( self, @@ -690,14 +679,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either GlobalRulestackResource or the result of cls(response) :rtype: @@ -707,25 +688,17 @@ def begin_create_or_update( @overload def begin_create_or_update( - self, global_rulestack_name: str, resource: IO, *, content_type: str = "application/json", **kwargs: Any + self, global_rulestack_name: str, resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GlobalRulestackResource]: """Create a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either GlobalRulestackResource or the result of cls(response) :rtype: @@ -735,26 +708,15 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO], **kwargs: Any + self, global_rulestack_name: str, resource: Union[_models.GlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GlobalRulestackResource]: """Create a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :param resource: Resource create parameters. Is either a GlobalRulestackResource type or a IO - type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource 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. + :param resource: Resource create parameters. Is either a GlobalRulestackResource type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource or IO[bytes] :return: An instance of LROPoller that returns either GlobalRulestackResource or the result of cls(response) :rtype: @@ -781,12 +743,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("GlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -798,17 +761,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.GlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" - } + return LROPoller[_models.GlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update( @@ -828,7 +789,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -836,18 +796,22 @@ def update( @overload def update( - self, global_rulestack_name: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any + self, + global_rulestack_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.GlobalRulestackResource: """Update a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -855,24 +819,24 @@ def update( @distributed_trace def update( - self, global_rulestack_name: str, properties: Union[_models.GlobalRulestackResourceUpdate, IO], **kwargs: Any + self, + global_rulestack_name: str, + properties: Union[_models.GlobalRulestackResourceUpdate, IO[bytes]], + **kwargs: Any ) -> _models.GlobalRulestackResource: """Update a GlobalRulestackResource. :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str :param properties: The resource properties to be updated. Is either a - GlobalRulestackResourceUpdate type or a IO type. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate 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 + GlobalRulestackResourceUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResourceUpdate or + IO[bytes] :return: GlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -895,22 +859,20 @@ def update( else: _json = self._serialize.body(properties, "GlobalRulestackResourceUpdate") - request = build_update_request( + _request = build_update_request( global_rulestack_name=global_rulestack_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -920,19 +882,15 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("GlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} + return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, global_rulestack_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -944,34 +902,39 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} + return deserialized # type: ignore @distributed_trace def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: @@ -979,14 +942,6 @@ def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[N :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1000,7 +955,7 @@ def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[N lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( global_rulestack_name=global_rulestack_name, api_version=api_version, cls=lambda x, y, z: x, @@ -1008,11 +963,12 @@ def begin_delete(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[N params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1023,20 +979,16 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}"} - - def _commit_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + def _commit_initial(self, global_rulestack_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1048,36 +1000,39 @@ def _commit_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_commit_request( + _request = build_commit_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self._commit_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _commit_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/commit" - } + return deserialized # type: ignore @distributed_trace def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1085,14 +1040,6 @@ def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[N :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1106,7 +1053,7 @@ def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[N 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._commit_initial( # type: ignore + raw_result = self._commit_initial( global_rulestack_name=global_rulestack_name, api_version=api_version, cls=lambda x, y, z: x, @@ -1114,11 +1061,12 @@ def begin_commit(self, global_rulestack_name: str, **kwargs: Any) -> LROPoller[N params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1129,17 +1077,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_commit.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/commit" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _models.Changelog: @@ -1147,12 +1091,11 @@ def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _models.C :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Changelog or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.Changelog :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1166,19 +1109,17 @@ def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _models.C api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Changelog] = kwargs.pop("cls", None) - request = build_get_change_log_request( + _request = build_get_change_log_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.get_change_log.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1188,16 +1129,12 @@ def get_change_log(self, global_rulestack_name: str, **kwargs: Any) -> _models.C error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Changelog", pipeline_response) + deserialized = self._deserialize("Changelog", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_change_log.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/getChangeLog" - } + return deserialized # type: ignore @distributed_trace def list_advanced_security_objects( @@ -1218,12 +1155,11 @@ def list_advanced_security_objects( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: AdvSecurityObjectListResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1237,22 +1173,20 @@ def list_advanced_security_objects( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) - request = build_list_advanced_security_objects_request( + _request = build_list_advanced_security_objects_request( global_rulestack_name=global_rulestack_name, type=type, skip=skip, top=top, api_version=api_version, - template_url=self.list_advanced_security_objects.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1262,16 +1196,12 @@ def list_advanced_security_objects( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response) + deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_advanced_security_objects.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAdvancedSecurityObjects" - } + return deserialized # type: ignore @distributed_trace def list_app_ids( @@ -1295,12 +1225,11 @@ def list_app_ids( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListAppIdResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListAppIdResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1314,23 +1243,21 @@ def list_app_ids( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListAppIdResponse] = kwargs.pop("cls", None) - request = build_list_app_ids_request( + _request = build_list_app_ids_request( global_rulestack_name=global_rulestack_name, app_id_version=app_id_version, app_prefix=app_prefix, skip=skip, top=top, api_version=api_version, - template_url=self.list_app_ids.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1340,16 +1267,12 @@ def list_app_ids( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAppIdResponse", pipeline_response) + deserialized = self._deserialize("ListAppIdResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_app_ids.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAppIds" - } + return deserialized # type: ignore @distributed_trace def list_countries( @@ -1363,12 +1286,11 @@ def list_countries( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: CountriesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CountriesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1382,21 +1304,19 @@ def list_countries( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CountriesResponse] = kwargs.pop("cls", None) - request = build_list_countries_request( + _request = build_list_countries_request( global_rulestack_name=global_rulestack_name, skip=skip, top=top, api_version=api_version, - template_url=self.list_countries.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1406,16 +1326,12 @@ def list_countries( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CountriesResponse", pipeline_response) + deserialized = self._deserialize("CountriesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_countries.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listCountries" - } + return deserialized # type: ignore @distributed_trace def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _models.ListFirewallsResponse: @@ -1423,12 +1339,11 @@ def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _models.L :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListFirewallsResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1442,19 +1357,17 @@ def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _models.L api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListFirewallsResponse] = kwargs.pop("cls", None) - request = build_list_firewalls_request( + _request = build_list_firewalls_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list_firewalls.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1464,16 +1377,12 @@ def list_firewalls(self, global_rulestack_name: str, **kwargs: Any) -> _models.L error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListFirewallsResponse", pipeline_response) + deserialized = self._deserialize("ListFirewallsResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_firewalls.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listFirewalls" - } + return deserialized # type: ignore @distributed_trace def list_predefined_url_categories( @@ -1487,12 +1396,11 @@ def list_predefined_url_categories( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: PredefinedUrlCategoriesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PredefinedUrlCategoriesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1506,21 +1414,19 @@ def list_predefined_url_categories( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PredefinedUrlCategoriesResponse] = kwargs.pop("cls", None) - request = build_list_predefined_url_categories_request( + _request = build_list_predefined_url_categories_request( global_rulestack_name=global_rulestack_name, skip=skip, top=top, api_version=api_version, - template_url=self.list_predefined_url_categories.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1530,16 +1436,12 @@ def list_predefined_url_categories( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PredefinedUrlCategoriesResponse", pipeline_response) + deserialized = self._deserialize("PredefinedUrlCategoriesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_predefined_url_categories.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listPredefinedUrlCategories" - } + return deserialized # type: ignore @distributed_trace def list_security_services( @@ -1561,12 +1463,11 @@ def list_security_services( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityServicesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1580,22 +1481,20 @@ def list_security_services( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecurityServicesResponse] = kwargs.pop("cls", None) - request = build_list_security_services_request( + _request = build_list_security_services_request( global_rulestack_name=global_rulestack_name, type=type, skip=skip, top=top, api_version=api_version, - template_url=self.list_security_services.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1605,16 +1504,12 @@ def list_security_services( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityServicesResponse", pipeline_response) + deserialized = self._deserialize("SecurityServicesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_security_services.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listSecurityServices" - } + return deserialized # type: ignore @distributed_trace def revert( # pylint: disable=inconsistent-return-statements @@ -1624,12 +1519,11 @@ def revert( # pylint: disable=inconsistent-return-statements :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1643,19 +1537,17 @@ def revert( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( + _request = build_revert_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1666,6 +1558,4 @@ def revert( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - revert.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/revert"} + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rules_operations.py index 66ce2c4250d2..4d30cb27e296 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rules_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +49,7 @@ def build_list_by_local_rulestacks_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +116,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +153,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +193,7 @@ def build_get_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +235,7 @@ def build_refresh_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -273,7 +277,7 @@ def build_reset_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -333,7 +337,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocalRulesResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource] @@ -345,7 +348,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulesResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -356,17 +359,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -378,13 +379,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("LocalRulesResourceListResult", pipeline_response) @@ -394,11 +394,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -411,10 +411,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules" - } - @distributed_trace def get( self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any @@ -428,12 +424,11 @@ def get( :type local_rulestack_name: str :param priority: Local Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulesResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,22 +442,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulesResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -472,26 +465,22 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalRulesResource", pipeline_response) + deserialized = self._deserialize("LocalRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, priority: str, - resource: Union[_models.LocalRulesResource, IO], + resource: Union[_models.LocalRulesResource, IO[bytes]], **kwargs: Any - ) -> _models.LocalRulesResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +493,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulesResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -514,7 +503,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "LocalRulesResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, @@ -523,40 +512,35 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("LocalRulesResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LocalRulesResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } - @overload def begin_create_or_update( self, @@ -582,14 +566,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LocalRulesResource or the result of cls(response) :rtype: @@ -603,7 +579,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, priority: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -618,18 +594,10 @@ def begin_create_or_update( :param priority: Local Rule priority. Required. :type priority: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LocalRulesResource or the result of cls(response) :rtype: @@ -643,7 +611,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, priority: str, - resource: Union[_models.LocalRulesResource, IO], + resource: Union[_models.LocalRulesResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.LocalRulesResource]: """Create a LocalRulesResource. @@ -655,20 +623,9 @@ def begin_create_or_update( :type local_rulestack_name: str :param priority: Local Rule priority. Required. :type priority: str - :param resource: Resource create parameters. Is either a LocalRulesResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource 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. + :param resource: Resource create parameters. Is either a LocalRulesResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulesResource or IO[bytes] :return: An instance of LROPoller that returns either LocalRulesResource or the result of cls(response) :rtype: @@ -697,12 +654,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LocalRulesResource", pipeline_response) + deserialized = self._deserialize("LocalRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -714,22 +672,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.LocalRulesResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return LROPoller[_models.LocalRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -741,39 +697,42 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -788,14 +747,6 @@ def begin_delete( :type local_rulestack_name: str :param priority: Local Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -809,7 +760,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, @@ -819,11 +770,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -834,17 +786,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_counters( @@ -866,12 +814,11 @@ def get_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounter or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -885,23 +832,21 @@ def get_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) - request = build_get_counters_request( + _request = build_get_counters_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, firewall_name=firewall_name, api_version=api_version, - template_url=self.get_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -911,16 +856,12 @@ def get_counters( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounter", pipeline_response) + deserialized = self._deserialize("RuleCounter", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/getCounters" - } + return deserialized # type: ignore @distributed_trace def refresh_counters( # pylint: disable=inconsistent-return-statements @@ -942,12 +883,11 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -961,23 +901,21 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_refresh_counters_request( + _request = build_refresh_counters_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, firewall_name=firewall_name, api_version=api_version, - template_url=self.refresh_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -988,11 +926,7 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - refresh_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/refreshCounters" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def reset_counters( @@ -1014,12 +948,11 @@ def reset_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounterReset or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1033,23 +966,21 @@ def reset_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) - request = build_reset_counters_request( + _request = build_reset_counters_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, priority=priority, subscription_id=self._config.subscription_id, firewall_name=firewall_name, api_version=api_version, - template_url=self.reset_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1059,13 +990,9 @@ def reset_counters( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounterReset", pipeline_response) + deserialized = self._deserialize("RuleCounterReset", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_counters.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/resetCounters" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rulestacks_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rulestacks_operations.py index 465af4ad9ac9..b1e91428698e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rulestacks_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_local_rulestacks_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +74,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +106,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +139,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,7 +175,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -206,7 +211,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -239,7 +244,7 @@ def build_commit_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -272,7 +277,7 @@ def build_get_change_log_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +315,7 @@ def build_get_support_info_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -339,7 +344,7 @@ def build_get_support_info_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_advanced_security_objects_request( +def build_list_advanced_security_objects_request( # pylint: disable=name-too-long resource_group_name: str, local_rulestack_name: str, subscription_id: str, @@ -352,7 +357,7 @@ def build_list_advanced_security_objects_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -390,7 +395,7 @@ def build_list_firewalls_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -430,7 +435,7 @@ def build_list_security_services_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -468,7 +473,7 @@ def build_revert_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -518,7 +523,6 @@ def __init__(self, *args, **kwargs): def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.LocalRulestackResource"]: """List LocalRulestackResource resources by subscription ID. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocalRulestackResource or the result of cls(response) :rtype: @@ -531,7 +535,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.LocalRulestac api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,15 +546,13 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.LocalRulestac def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -562,13 +564,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("LocalRulestackResourceListResult", pipeline_response) @@ -578,11 +579,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -595,10 +596,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks" - } - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any @@ -608,7 +605,6 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocalRulestackResource or the result of cls(response) :rtype: @@ -621,7 +617,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -632,16 +628,14 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -653,13 +647,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("LocalRulestackResourceListResult", pipeline_response) @@ -669,11 +662,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -686,10 +679,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks" - } - @distributed_trace def get(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> _models.LocalRulestackResource: """Get a LocalRulestackResource. @@ -699,12 +688,11 @@ def get(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,21 +706,19 @@ def get(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -742,25 +728,21 @@ def get(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + deserialized = self._deserialize("LocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, - resource: Union[_models.LocalRulestackResource, IO], + resource: Union[_models.LocalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.LocalRulestackResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -773,7 +755,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LocalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -783,7 +765,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "LocalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -791,40 +773,35 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } - @overload def begin_create_or_update( self, @@ -847,14 +824,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LocalRulestackResource or the result of cls(response) :rtype: @@ -867,7 +836,7 @@ def begin_create_or_update( self, resource_group_name: str, local_rulestack_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -880,18 +849,10 @@ def begin_create_or_update( :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either LocalRulestackResource or the result of cls(response) :rtype: @@ -904,7 +865,7 @@ def begin_create_or_update( self, resource_group_name: str, local_rulestack_name: str, - resource: Union[_models.LocalRulestackResource, IO], + resource: Union[_models.LocalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.LocalRulestackResource]: """Create a LocalRulestackResource. @@ -914,20 +875,9 @@ def begin_create_or_update( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :param resource: Resource create parameters. Is either a LocalRulestackResource type or a IO - type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource 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. + :param resource: Resource create parameters. Is either a LocalRulestackResource type or a + IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource or IO[bytes] :return: An instance of LROPoller that returns either LocalRulestackResource or the result of cls(response) :rtype: @@ -955,12 +905,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + deserialized = self._deserialize("LocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -972,17 +923,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.LocalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return LROPoller[_models.LocalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update( @@ -1006,7 +955,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -1017,7 +965,7 @@ def update( self, resource_group_name: str, local_rulestack_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1030,11 +978,10 @@ def update( :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: @@ -1045,7 +992,7 @@ def update( self, resource_group_name: str, local_rulestack_name: str, - properties: Union[_models.LocalRulestackResourceUpdate, IO], + properties: Union[_models.LocalRulestackResourceUpdate, IO[bytes]], **kwargs: Any ) -> _models.LocalRulestackResource: """Update a LocalRulestackResource. @@ -1056,17 +1003,14 @@ def update( :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str :param properties: The resource properties to be updated. Is either a - LocalRulestackResourceUpdate type or a IO type. Required. - :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate 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 + LocalRulestackResourceUpdate type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResourceUpdate or + IO[bytes] :return: LocalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LocalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1089,7 +1033,7 @@ def update( else: _json = self._serialize.body(properties, "LocalRulestackResourceUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -1097,16 +1041,14 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1116,21 +1058,15 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalRulestackResource", pipeline_response) + deserialized = self._deserialize("LocalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1142,38 +1078,41 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1184,14 +1123,6 @@ def begin_delete(self, resource_group_name: str, local_rulestack_name: str, **kw :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1205,7 +1136,7 @@ def begin_delete(self, resource_group_name: str, local_rulestack_name: str, **kw lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, api_version=api_version, @@ -1214,11 +1145,12 @@ def begin_delete(self, resource_group_name: str, local_rulestack_name: str, **kw params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1229,22 +1161,16 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _commit_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any - ) -> None: - error_map = { + def _commit_initial(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1256,38 +1182,41 @@ def _commit_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_commit_request( + _request = build_commit_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._commit_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _commit_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/commit" - } + return deserialized # type: ignore @distributed_trace def begin_commit(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1298,14 +1227,6 @@ def begin_commit(self, resource_group_name: str, local_rulestack_name: str, **kw :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1319,7 +1240,7 @@ def begin_commit(self, resource_group_name: str, local_rulestack_name: str, **kw 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._commit_initial( # type: ignore + raw_result = self._commit_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, api_version=api_version, @@ -1328,11 +1249,12 @@ def begin_commit(self, resource_group_name: str, local_rulestack_name: str, **kw params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1343,17 +1265,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_commit.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/commit" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_change_log(self, resource_group_name: str, local_rulestack_name: str, **kwargs: Any) -> _models.Changelog: @@ -1364,12 +1282,11 @@ def get_change_log(self, resource_group_name: str, local_rulestack_name: str, ** :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Changelog or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.Changelog :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1383,21 +1300,19 @@ def get_change_log(self, resource_group_name: str, local_rulestack_name: str, ** api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Changelog] = kwargs.pop("cls", None) - request = build_get_change_log_request( + _request = build_get_change_log_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_change_log.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1407,16 +1322,12 @@ def get_change_log(self, resource_group_name: str, local_rulestack_name: str, ** error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Changelog", pipeline_response) + deserialized = self._deserialize("Changelog", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_change_log.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getChangeLog" - } + return deserialized # type: ignore @distributed_trace def get_support_info( @@ -1431,12 +1342,11 @@ def get_support_info( :type local_rulestack_name: str :param email: email address on behalf of which this API called. Default value is None. :type email: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1450,22 +1360,20 @@ def get_support_info( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportInfo] = kwargs.pop("cls", None) - request = build_get_support_info_request( + _request = build_get_support_info_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, email=email, api_version=api_version, - template_url=self.get_support_info.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1475,16 +1383,12 @@ def get_support_info( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportInfo", pipeline_response) + deserialized = self._deserialize("SupportInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_support_info.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getSupportInfo" - } + return deserialized # type: ignore @distributed_trace def list_advanced_security_objects( @@ -1509,12 +1413,11 @@ def list_advanced_security_objects( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: AdvSecurityObjectListResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.AdvSecurityObjectListResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1528,7 +1431,7 @@ def list_advanced_security_objects( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdvSecurityObjectListResponse] = kwargs.pop("cls", None) - request = build_list_advanced_security_objects_request( + _request = build_list_advanced_security_objects_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -1536,16 +1439,14 @@ def list_advanced_security_objects( skip=skip, top=top, api_version=api_version, - template_url=self.list_advanced_security_objects.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1555,16 +1456,12 @@ def list_advanced_security_objects( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response) + deserialized = self._deserialize("AdvSecurityObjectListResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_advanced_security_objects.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listAdvancedSecurityObjects" - } + return deserialized # type: ignore @distributed_trace def list_firewalls( @@ -1577,12 +1474,11 @@ def list_firewalls( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListFirewallsResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ListFirewallsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1596,21 +1492,19 @@ def list_firewalls( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListFirewallsResponse] = kwargs.pop("cls", None) - request = build_list_firewalls_request( + _request = build_list_firewalls_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_firewalls.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1620,16 +1514,12 @@ def list_firewalls( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListFirewallsResponse", pipeline_response) + deserialized = self._deserialize("ListFirewallsResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_firewalls.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listFirewalls" - } + return deserialized # type: ignore @distributed_trace def list_security_services( @@ -1655,12 +1545,11 @@ def list_security_services( :type skip: str :param top: Default value is None. :type top: int - :keyword callable cls: A custom type or function that will be passed the direct response :return: SecurityServicesResponse or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SecurityServicesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1674,7 +1563,7 @@ def list_security_services( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecurityServicesResponse] = kwargs.pop("cls", None) - request = build_list_security_services_request( + _request = build_list_security_services_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, @@ -1682,16 +1571,14 @@ def list_security_services( skip=skip, top=top, api_version=api_version, - template_url=self.list_security_services.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1701,16 +1588,12 @@ def list_security_services( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityServicesResponse", pipeline_response) + deserialized = self._deserialize("SecurityServicesResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_security_services.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listSecurityServices" - } + return deserialized # type: ignore @distributed_trace def revert( # pylint: disable=inconsistent-return-statements @@ -1723,12 +1606,11 @@ def revert( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1742,21 +1624,19 @@ def revert( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_revert_request( + _request = build_revert_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.revert.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1767,8 +1647,4 @@ def revert( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - revert.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/revert" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_operations.py index f169399f6005..fc6958a39663 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -19,16 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +42,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +80,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """List the operations for the provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -89,7 +90,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,14 +101,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +118,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -135,11 +133,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +149,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/operations"} diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_palo_alto_networks_cloudngfw_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_palo_alto_networks_cloudngfw_operations.py new file mode 100644 index 000000000000..a3889b8ff026 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_palo_alto_networks_cloudngfw_operations.py @@ -0,0 +1,363 @@ +# 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, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_product_serial_number_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/createProductSerialNumber" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_cloud_manager_tenants_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listCloudManagerTenants" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_product_serial_number_status_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listProductSerialNumberStatus", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_support_info_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/listSupportInfo" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class PaloAltoNetworksCloudngfwOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.paloaltonetworksngfw.PaloAltoNetworksNgfwMgmtClient`'s + :attr:`palo_alto_networks_cloudngfw` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def create_product_serial_number(self, **kwargs: Any) -> _models.ProductSerialNumberRequestStatus: + """create_product_serial_number. + + :return: ProductSerialNumberRequestStatus or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberRequestStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProductSerialNumberRequestStatus] = kwargs.pop("cls", None) + + _request = build_create_product_serial_number_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ProductSerialNumberRequestStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_cloud_manager_tenants(self, **kwargs: Any) -> _models.CloudManagerTenantList: + """list_cloud_manager_tenants. + + :return: CloudManagerTenantList or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.CloudManagerTenantList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CloudManagerTenantList] = kwargs.pop("cls", None) + + _request = build_list_cloud_manager_tenants_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CloudManagerTenantList", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_product_serial_number_status(self, **kwargs: Any) -> Optional[_models.ProductSerialNumberStatus]: + """list_product_serial_number_status. + + :return: ProductSerialNumberStatus or None or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.ProductSerialNumberStatus or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.ProductSerialNumberStatus]] = kwargs.pop("cls", None) + + _request = build_list_product_serial_number_status_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + 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("ProductSerialNumberStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_support_info(self, **kwargs: Any) -> _models.SupportInfoModel: + """list_support_info. + + :return: SupportInfoModel or the result of cls(response) + :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfoModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SupportInfoModel] = kwargs.pop("cls", None) + + _request = build_list_support_info_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SupportInfoModel", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_post_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_post_rules_operations.py index 9fb02c01406a..5e4e80d2cd9f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_post_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_post_rules_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request(global_rulestack_name: str, **kwargs: Any) -> HttpRequest _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +73,7 @@ def build_get_request(global_rulestack_name: str, priority: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +101,7 @@ def build_create_or_update_request(global_rulestack_name: str, priority: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +132,7 @@ def build_delete_request(global_rulestack_name: str, priority: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +162,7 @@ def build_get_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +194,7 @@ def build_refresh_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -222,7 +226,7 @@ def build_reset_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -273,7 +277,6 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PostRulesResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -284,7 +287,7 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostRulesResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,15 +298,13 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -315,13 +316,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PostRulesResourceListResult", pipeline_response) @@ -331,11 +331,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -348,8 +348,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules"} - @distributed_trace def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _models.PostRulesResource: """Get a PostRulesResource. @@ -358,12 +356,11 @@ def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _mode :type global_rulestack_name: str :param priority: Post Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PostRulesResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,20 +374,18 @@ def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostRulesResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,21 +395,21 @@ def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PostRulesResource", pipeline_response) + deserialized = self._deserialize("PostRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return deserialized # type: ignore def _create_or_update_initial( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PostRulesResource, IO], **kwargs: Any - ) -> _models.PostRulesResource: - error_map = { + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PostRulesResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +422,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PostRulesResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -437,47 +432,42 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "PostRulesResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PostRulesResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PostRulesResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } - @overload def begin_create_or_update( self, @@ -499,14 +489,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PostRulesResource or the result of cls(response) :rtype: @@ -519,7 +501,7 @@ def begin_create_or_update( self, global_rulestack_name: str, priority: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -531,18 +513,10 @@ def begin_create_or_update( :param priority: Post Rule priority. Required. :type priority: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PostRulesResource or the result of cls(response) :rtype: @@ -552,7 +526,11 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PostRulesResource, IO], **kwargs: Any + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PostRulesResource, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.PostRulesResource]: """Create a PostRulesResource. @@ -560,20 +538,9 @@ def begin_create_or_update( :type global_rulestack_name: str :param priority: Post Rule priority. Required. :type priority: str - :param resource: Resource create parameters. Is either a PostRulesResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource 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. + :param resource: Resource create parameters. Is either a PostRulesResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PostRulesResource or IO[bytes] :return: An instance of LROPoller that returns either PostRulesResource or the result of cls(response) :rtype: @@ -601,12 +568,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PostRulesResource", pipeline_response) + deserialized = self._deserialize("PostRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -618,22 +586,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PostRulesResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return LROPoller[_models.PostRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -645,37 +609,40 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> LROPoller[None]: @@ -685,14 +652,6 @@ def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) :type global_rulestack_name: str :param priority: Post Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -706,7 +665,7 @@ def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, @@ -715,11 +674,12 @@ def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -730,17 +690,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_counters( @@ -754,12 +710,11 @@ def get_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounter or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -773,21 +728,19 @@ def get_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) - request = build_get_counters_request( + _request = build_get_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.get_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -797,16 +750,12 @@ def get_counters( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounter", pipeline_response) + deserialized = self._deserialize("RuleCounter", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/getCounters" - } + return deserialized # type: ignore @distributed_trace def refresh_counters( # pylint: disable=inconsistent-return-statements @@ -820,12 +769,11 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -839,21 +787,19 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_refresh_counters_request( + _request = build_refresh_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.refresh_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -864,11 +810,7 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - refresh_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/refreshCounters" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def reset_counters( @@ -882,12 +824,11 @@ def reset_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounterReset or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -901,21 +842,19 @@ def reset_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) - request = build_reset_counters_request( + _request = build_reset_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.reset_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -925,13 +864,9 @@ def reset_counters( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounterReset", pipeline_response) + deserialized = self._deserialize("RuleCounterReset", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/resetCounters" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_pre_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_pre_rules_operations.py index d272deda4bc9..9cce445a4d9e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_pre_rules_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_pre_rules_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request(global_rulestack_name: str, **kwargs: Any) -> HttpRequest _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +73,7 @@ def build_get_request(global_rulestack_name: str, priority: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +101,7 @@ def build_create_or_update_request(global_rulestack_name: str, priority: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +132,7 @@ def build_delete_request(global_rulestack_name: str, priority: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +162,7 @@ def build_get_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +194,7 @@ def build_refresh_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -222,7 +226,7 @@ def build_reset_counters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -273,7 +277,6 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PreRulesResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -284,7 +287,7 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PreRulesResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,15 +298,13 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -315,13 +316,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PreRulesResourceListResult", pipeline_response) @@ -331,11 +331,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -348,8 +348,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules"} - @distributed_trace def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _models.PreRulesResource: """Get a PreRulesResource. @@ -358,12 +356,11 @@ def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _mode :type global_rulestack_name: str :param priority: Pre Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PreRulesResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,20 +374,18 @@ def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PreRulesResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,21 +395,21 @@ def get(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PreRulesResource", pipeline_response) + deserialized = self._deserialize("PreRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return deserialized # type: ignore def _create_or_update_initial( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PreRulesResource, IO], **kwargs: Any - ) -> _models.PreRulesResource: - error_map = { + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PreRulesResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +422,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PreRulesResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -437,47 +432,42 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "PreRulesResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PreRulesResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PreRulesResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } - @overload def begin_create_or_update( self, @@ -499,14 +489,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PreRulesResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] @@ -518,7 +500,7 @@ def begin_create_or_update( self, global_rulestack_name: str, priority: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -530,18 +512,10 @@ def begin_create_or_update( :param priority: Pre Rule priority. Required. :type priority: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PreRulesResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] @@ -550,7 +524,11 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, global_rulestack_name: str, priority: str, resource: Union[_models.PreRulesResource, IO], **kwargs: Any + self, + global_rulestack_name: str, + priority: str, + resource: Union[_models.PreRulesResource, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.PreRulesResource]: """Create a PreRulesResource. @@ -558,20 +536,9 @@ def begin_create_or_update( :type global_rulestack_name: str :param priority: Pre Rule priority. Required. :type priority: str - :param resource: Resource create parameters. Is either a PreRulesResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource 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. + :param resource: Resource create parameters. Is either a PreRulesResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource or IO[bytes] :return: An instance of LROPoller that returns either PreRulesResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.paloaltonetworksngfw.models.PreRulesResource] @@ -598,12 +565,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PreRulesResource", pipeline_response) + deserialized = self._deserialize("PreRulesResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -615,22 +583,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PreRulesResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return LROPoller[_models.PreRulesResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, priority: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -642,37 +606,40 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) -> LROPoller[None]: @@ -682,14 +649,6 @@ def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) :type global_rulestack_name: str :param priority: Pre Rule priority. Required. :type priority: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -703,7 +662,7 @@ def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( global_rulestack_name=global_rulestack_name, priority=priority, api_version=api_version, @@ -712,11 +671,12 @@ def begin_delete(self, global_rulestack_name: str, priority: str, **kwargs: Any) params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -727,17 +687,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_counters( @@ -751,12 +707,11 @@ def get_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounter or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -770,21 +725,19 @@ def get_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounter] = kwargs.pop("cls", None) - request = build_get_counters_request( + _request = build_get_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.get_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -794,16 +747,12 @@ def get_counters( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounter", pipeline_response) + deserialized = self._deserialize("RuleCounter", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/getCounters" - } + return deserialized # type: ignore @distributed_trace def refresh_counters( # pylint: disable=inconsistent-return-statements @@ -817,12 +766,11 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -836,21 +784,19 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_refresh_counters_request( + _request = build_refresh_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.refresh_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -861,11 +807,7 @@ def refresh_counters( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - refresh_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/refreshCounters" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def reset_counters( @@ -879,12 +821,11 @@ def reset_counters( :type priority: str :param firewall_name: Default value is None. :type firewall_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RuleCounterReset or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.RuleCounterReset :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -898,21 +839,19 @@ def reset_counters( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RuleCounterReset] = kwargs.pop("cls", None) - request = build_reset_counters_request( + _request = build_reset_counters_request( global_rulestack_name=global_rulestack_name, priority=priority, firewall_name=firewall_name, api_version=api_version, - template_url=self.reset_counters.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -922,13 +861,9 @@ def reset_counters( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleCounterReset", pipeline_response) + deserialized = self._deserialize("RuleCounterReset", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - reset_counters.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/resetCounters" - } + return deserialized # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_global_rulestack_operations.py index 983965edf4db..675ca4c06a53 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_global_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_global_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +47,7 @@ def build_list_request(global_rulestack_name: str, **kwargs: Any) -> HttpRequest _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +73,7 @@ def build_get_request(global_rulestack_name: str, name: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +101,7 @@ def build_create_or_update_request(global_rulestack_name: str, name: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +132,7 @@ def build_delete_request(global_rulestack_name: str, name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +181,6 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P :param global_rulestack_name: GlobalRulestack resource name. Required. :type global_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -190,7 +193,7 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListGlobalRulestackResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,15 +204,13 @@ def list(self, global_rulestack_name: str, **kwargs: Any) -> Iterable["_models.P def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( global_rulestack_name=global_rulestack_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -221,13 +222,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrefixListGlobalRulestackResourceListResult", pipeline_response) @@ -237,11 +237,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -254,8 +254,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists"} - @distributed_trace def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.PrefixListGlobalRulestackResource: """Get a PrefixListGlobalRulestackResource. @@ -264,12 +262,11 @@ def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.P :type global_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrefixListGlobalRulestackResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -283,20 +280,18 @@ def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.P api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListGlobalRulestackResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -306,25 +301,21 @@ def get(self, global_rulestack_name: str, name: str, **kwargs: Any) -> _models.P error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( self, global_rulestack_name: str, name: str, - resource: Union[_models.PrefixListGlobalRulestackResource, IO], + resource: Union[_models.PrefixListGlobalRulestackResource, IO[bytes]], **kwargs: Any - ) -> _models.PrefixListGlobalRulestackResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +328,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrefixListGlobalRulestackResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -347,47 +338,42 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "PrefixListGlobalRulestackResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } - @overload def begin_create_or_update( self, @@ -409,14 +395,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -429,7 +407,7 @@ def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -441,18 +419,10 @@ def begin_create_or_update( :param name: Local Rule priority. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -465,7 +435,7 @@ def begin_create_or_update( self, global_rulestack_name: str, name: str, - resource: Union[_models.PrefixListGlobalRulestackResource, IO], + resource: Union[_models.PrefixListGlobalRulestackResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrefixListGlobalRulestackResource]: """Create a PrefixListGlobalRulestackResource. @@ -475,19 +445,9 @@ def begin_create_or_update( :param name: Local Rule priority. Required. :type name: str :param resource: Resource create parameters. Is either a PrefixListGlobalRulestackResource type - or a IO type. Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource 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. + or a IO[bytes] type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListGlobalRulestackResource or + IO[bytes] :return: An instance of LROPoller that returns either PrefixListGlobalRulestackResource or the result of cls(response) :rtype: @@ -515,12 +475,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response) + deserialized = self._deserialize("PrefixListGlobalRulestackResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -532,22 +493,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrefixListGlobalRulestackResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return LROPoller[_models.PrefixListGlobalRulestackResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, global_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, global_rulestack_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -559,37 +516,40 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -599,14 +559,6 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> :type global_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -620,7 +572,7 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( global_rulestack_name=global_rulestack_name, name=name, api_version=api_version, @@ -629,11 +581,12 @@ def begin_delete(self, global_rulestack_name: str, name: str, **kwargs: Any) -> params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -644,14 +597,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_local_rulestack_operations.py index 06fdd5142ac4..922e3e093d85 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_local_rulestack_operations.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/operations/_prefix_list_local_rulestack_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +49,7 @@ def build_list_by_local_rulestacks_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +116,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +153,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-06-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +211,6 @@ def list_by_local_rulestacks( :type resource_group_name: str :param local_rulestack_name: LocalRulestack resource name. Required. :type local_rulestack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrefixListResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource] @@ -219,7 +222,7 @@ def list_by_local_rulestacks( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -230,17 +233,15 @@ def list_by_local_rulestacks( def prepare_request(next_link=None): if not next_link: - request = build_list_by_local_rulestacks_request( + _request = build_list_by_local_rulestacks_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_local_rulestacks.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -252,13 +253,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrefixListResourceListResult", pipeline_response) @@ -268,11 +268,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -285,10 +285,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_local_rulestacks.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists" - } - @distributed_trace def get( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any @@ -302,12 +298,11 @@ def get( :type local_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrefixListResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,22 +316,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrefixListResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -346,26 +339,22 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrefixListResource", pipeline_response) + deserialized = self._deserialize("PrefixListResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.PrefixListResource, IO], + resource: Union[_models.PrefixListResource, IO[bytes]], **kwargs: Any - ) -> _models.PrefixListResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +367,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrefixListResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -388,7 +377,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(resource, "PrefixListResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -397,40 +386,35 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("PrefixListResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("PrefixListResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } - @overload def begin_create_or_update( self, @@ -456,14 +440,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrefixListResource or the result of cls(response) :rtype: @@ -477,7 +453,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -492,18 +468,10 @@ def begin_create_or_update( :param name: Local Rule priority. Required. :type name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrefixListResource or the result of cls(response) :rtype: @@ -517,7 +485,7 @@ def begin_create_or_update( resource_group_name: str, local_rulestack_name: str, name: str, - resource: Union[_models.PrefixListResource, IO], + resource: Union[_models.PrefixListResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrefixListResource]: """Create a PrefixListResource. @@ -529,20 +497,9 @@ def begin_create_or_update( :type local_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :param resource: Resource create parameters. Is either a PrefixListResource type or a IO type. - Required. - :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource 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. + :param resource: Resource create parameters. Is either a PrefixListResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.paloaltonetworksngfw.models.PrefixListResource or IO[bytes] :return: An instance of LROPoller that returns either PrefixListResource or the result of cls(response) :rtype: @@ -571,12 +528,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrefixListResource", pipeline_response) + deserialized = self._deserialize("PrefixListResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -588,22 +546,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrefixListResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return LROPoller[_models.PrefixListResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, local_rulestack_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -615,39 +571,42 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -662,14 +621,6 @@ def begin_delete( :type local_rulestack_name: str :param name: Local Rule priority. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -683,7 +634,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, local_rulestack_name=local_rulestack_name, name=name, @@ -693,11 +644,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -708,14 +660,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_maximum_set_gen.py index 23819e971747..8050f7c1ed95 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -46,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_minimum_set_gen.py index d6b52a02301b..69d9f24d655c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_create_or_update_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_maximum_set_gen.py index 23c9a4923db9..c3463adba7d2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectGlobalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_minimum_set_gen.py index 93b98d14b3b6..b246b84a0c9c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_delete_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectGlobalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_maximum_set_gen.py index 823c7d7ab63c..ef35c3923bba 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectGlobalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_minimum_set_gen.py index 638d55431086..5c7d750bb621 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectGlobalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_maximum_set_gen.py index 1a2dddaa4693..9fe16f4dc9d2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectGlobalRulestack_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_minimum_set_gen.py index 8b3ad0d56e4f..094635943b6f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_global_rulestack_list_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectGlobalRulestack_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectGlobalRulestack_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_maximum_set_gen.py index 79094c46195a..6ef5b0c68c5f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -47,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_minimum_set_gen.py index bdad14463402..cbcf2a4ded21 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_create_or_update_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_maximum_set_gen.py index 81bb32451e7c..90c2c4a153aa 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectLocalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_minimum_set_gen.py index 753229a822c7..af525c2d7877 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_delete_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectLocalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_maximum_set_gen.py index 5c07521f4537..c7fa96d0c1bb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectLocalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_minimum_set_gen.py index f3cdfcb764e5..4429a72266ae 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectLocalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py index 86e38ce4ef6f..82a7c08c03f7 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py index 19a0e9f1e245..919587286d11 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/certificate_object_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_maximum_set_gen.py index cafeab689658..516739b7b599 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FirewallStatus_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FirewallStatus_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_minimum_set_gen.py index 47f0eb3d91e4..4684de0edff3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FirewallStatus_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FirewallStatus_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_maximum_set_gen.py index e2fb41099ee0..f4e44f53bf7b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FirewallStatus_ListByFirewalls_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FirewallStatus_ListByFirewalls_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_minimum_set_gen.py index edb9daa09def..996f48e41728 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewall_status_list_by_firewalls_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FirewallStatus_ListByFirewalls_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FirewallStatus_ListByFirewalls_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_maximum_set_gen.py index 0d47ac446a7a..29191b8623c4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -85,6 +86,7 @@ def main(): ], "enableEgressNat": "ENABLED", "networkType": "VNET", + "privateSourceNatRulesDestination": ["20.22.92.11"], "publicIps": [ { "address": "20.22.92.11", @@ -141,6 +143,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_minimum_set_gen.py index 907b6a555063..fe17bf8e3157 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_create_or_update_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -54,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_maximum_set_gen.py index 90323214cd3d..172e202c4260 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_minimum_set_gen.py index 3c88823d3656..4ce03c962fe6 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_delete_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_maximum_set_gen.py index c263d4c6f1de..c73130fb6795 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getGlobalRulestack_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_getGlobalRulestack_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_minimum_set_gen.py index 42e0870b8e43..4b3e6daca8d3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_global_rulestack_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getGlobalRulestack_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_getGlobalRulestack_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_maximum_set_gen.py index f7fb33b4d8e5..38e121745330 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getLogProfile_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_getLogProfile_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_minimum_set_gen.py index 9590498132b1..70e07955aef0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_log_profile_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getLogProfile_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_getLogProfile_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_maximum_set_gen.py index d4e973378f41..d6038f7d5d66 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_minimum_set_gen.py index aaa50b05781a..a4a2bf988cf6 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_maximum_set_gen.py index a6dcbacb0933..9ea791e5dcdf 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getSupportInfo_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_getSupportInfo_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_minimum_set_gen.py index f062b94c73d8..35e7c75a8c8c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_get_support_info_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_getSupportInfo_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_getSupportInfo_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_maximum_set_gen.py index ee6960a2cfaf..378875dbe5da 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_minimum_set_gen.py index 3fbdfc83485f..39891235df2a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_resource_group_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_maximum_set_gen.py index d0327773108b..a1312f12b0be 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_minimum_set_gen.py index 6034893d5594..f147cda83c1c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_list_by_subscription_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_maximum_set_gen.py index cae3c4800078..411b6e0e814c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_saveLogProfile_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_saveLogProfile_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_minimum_set_gen.py index 31576fc2f57b..1d2e9e2e340d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_save_log_profile_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_saveLogProfile_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_saveLogProfile_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_update_maximum_set_gen.py index 41587d1bbde5..3060dac62d55 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/firewalls_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -88,6 +89,7 @@ def main(): ], "enableEgressNat": "ENABLED", "networkType": "VNET", + "privateSourceNatRulesDestination": ["20.22.92.11"], "publicIps": [ { "address": "20.22.92.11", @@ -147,6 +149,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Firewalls_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Firewalls_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_maximum_set_gen.py index ee8096ff89e5..e8d12f7b4c6e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -45,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_minimum_set_gen.py index 99e27224e06f..b0868201a93b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_create_or_update_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_maximum_set_gen.py index 8f7c21b94dfe..b95fcb8ab5a1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListGlobalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_minimum_set_gen.py index 3643d4608173..ef55f444e541 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_delete_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListGlobalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_maximum_set_gen.py index fa1307d59269..db39fbf83460 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListGlobalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_minimum_set_gen.py index ed45e1ecdc90..4e72144a2bd3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListGlobalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_maximum_set_gen.py index 03e9523e332c..24995fb28f21 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListGlobalRulestack_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_minimum_set_gen.py index c80a43412c5a..618f981d603f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_global_rulestack_list_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListGlobalRulestack_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListGlobalRulestack_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_maximum_set_gen.py index 55740bd17197..1406181a8be9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -46,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_minimum_set_gen.py index 690f350b1e35..acbb45ee011c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_create_or_update_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_maximum_set_gen.py index d72776834fc5..08522a632347 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListLocalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_minimum_set_gen.py index 951ac8fdb7d3..0b7619357ff5 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_delete_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListLocalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_maximum_set_gen.py index 6b838068cd6a..d4224ed2b8ff 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListLocalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_minimum_set_gen.py index a6eadc6e6c31..f9e1c80c86a8 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListLocalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py index 684515bd8577..4806b2789fe7 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py index 2278c005100c..10298f60a7cd 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/fqdn_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_maximum_set_gen.py index c3dc1685bd91..9d759e7ebb22 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_commit_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_commit_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_minimum_set_gen.py index cde18a8c7386..1d6ff6325a9b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_commit_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_commit_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_commit_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_maximum_set_gen.py index 8d2cfacd8f9d..9468156f59fa 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -62,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_minimum_set_gen.py index 07e2a6a96ce7..6ee5471dd601 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_create_or_update_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_maximum_set_gen.py index 5ce5cf03b477..fcacb33ae2bb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_minimum_set_gen.py index 8808d17fa9a1..6c4d03828334 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_delete_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_maximum_set_gen.py index a9248ed2fac5..9f63fc9ab8ef 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_getChangeLog_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_getChangeLog_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_minimum_set_gen.py index aa88e2e44575..76df7e8ed696 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_change_log_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_getChangeLog_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_getChangeLog_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_maximum_set_gen.py index ef67bf85b3bf..e6f03daaa031 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_minimum_set_gen.py index 9b8c0f48edf3..e2b84e6a7c5a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_maximum_set_gen.py index 2a5ca1085f3c..bf0a4ef13f9a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listAdvancedSecurityObjects_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_listAdvancedSecurityObjects_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_minimum_set_gen.py index ed6b7fe582c6..d857b227bd26 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_advanced_security_objects_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listAdvancedSecurityObjects_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_listAdvancedSecurityObjects_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_maximum_set_gen.py index b3877f042802..55112fe300bc 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listAppIds_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_listAppIds_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_minimum_set_gen.py index 685eae22ac86..c775433fc9c3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_app_ids_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listAppIds_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_listAppIds_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_maximum_set_gen.py index 252542846687..479e2bdfc95d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listCountries_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_listCountries_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_minimum_set_gen.py index 8eb0ca1b9d03..222b4e103d75 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_countries_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listCountries_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_listCountries_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_maximum_set_gen.py index 9029ffa38317..fb54c55d7c0a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listFirewalls_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_listFirewalls_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_minimum_set_gen.py index 7a9557a32825..9944da2224e8 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_firewalls_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listFirewalls_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_listFirewalls_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_maximum_set_gen.py index 5aad8ed63ed0..936e0929abc5 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_minimum_set_gen.py index 58065bcc5716..ee867f264ca8 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_maximum_set_gen.py index 964d901d20fa..50be0aa08a8a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listPredefinedUrlCategories_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_listPredefinedUrlCategories_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_minimum_set_gen.py index bdd4cd37986b..72a0d77534ca 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_predefined_url_categories_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listPredefinedUrlCategories_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_listPredefinedUrlCategories_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_maximum_set_gen.py index 397aac6e4a65..f8d96bf2839f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listSecurityServices_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_listSecurityServices_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_minimum_set_gen.py index 7ca7fd602342..7940dc06bd92 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_list_security_services_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_listSecurityServices_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_listSecurityServices_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_maximum_set_gen.py index 0320c011c77c..37b3e7fce9ac 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_revert_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_revert_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_minimum_set_gen.py index 9d2ca31088fb..ace0bc4308fd 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_revert_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_revert_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_revert_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_update_maximum_set_gen.py index c2d9decb49aa..52f555dbafdb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/global_rulestack_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -61,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/GlobalRulestack_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/GlobalRulestack_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_maximum_set_gen.py index 89b1eddf363f..16cc468b213b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -66,6 +67,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_minimum_set_gen.py index 88a2fdcd6c91..3815ba31260c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_create_or_update_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_maximum_set_gen.py index f54c39aac8a1..177729baa4fb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_minimum_set_gen.py index d5327972133c..2ee57a48ff90 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_delete_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_maximum_set_gen.py index cc3edf26f4c2..f1438ba95562 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_getCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_getCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_minimum_set_gen.py index f61cdf92e5e2..110d1f538173 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_counters_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_getCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_getCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_maximum_set_gen.py index 8ce51d148c76..cb94ae0af2ce 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_minimum_set_gen.py index e807fb6846a6..dc8f21ed5eb1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_maximum_set_gen.py index 4b255afc184b..1f8dc1fa019a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_ListByLocalRulestacks_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_ListByLocalRulestacks_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_minimum_set_gen.py index 493878857f31..02dcb01e97e9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_list_by_local_rulestacks_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_ListByLocalRulestacks_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_ListByLocalRulestacks_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_maximum_set_gen.py index 022b9d627e94..d3b9ce361269 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_refreshCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_refreshCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_minimum_set_gen.py index 961e44655cdc..ec66edd057e3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_refresh_counters_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_refreshCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_refreshCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_maximum_set_gen.py index 67739b720b2e..b10c0d0779f0 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_resetCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_resetCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_minimum_set_gen.py index 58ab9f6ba27a..8776d1466c5e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rules_reset_counters_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRules_resetCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRules_resetCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_maximum_set_gen.py index c2137adf3102..3b587a77e54a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_commit_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_commit_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_minimum_set_gen.py index 7cbe940a6ed9..cf58d4acf32d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_commit_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_commit_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_commit_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_maximum_set_gen.py index 1423c45e1e7f..b45ecf53a423 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -64,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_minimum_set_gen.py index 35f90a7c46bf..a5548a7bdb41 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_create_or_update_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_maximum_set_gen.py index 52618393949c..8f6326886768 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_minimum_set_gen.py index 703b2b9dfbe4..bf71f59344d7 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_delete_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_maximum_set_gen.py index 84c8f8a1b78e..d6a64f31dc34 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_getChangeLog_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_getChangeLog_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_minimum_set_gen.py index 1177a44ef2bd..d87aaa4d031b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_change_log_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_getChangeLog_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_getChangeLog_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_maximum_set_gen.py index 93e934f87de0..72d122955f9b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_minimum_set_gen.py index f044e21f08a6..da0faee83096 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_maximum_set_gen.py index 4a8048ba38dc..2c38bd93bd32 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_getSupportInfo_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_getSupportInfo_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_minimum_set_gen.py index 7a1b3ce20340..03b26ee3aa97 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_get_support_info_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_getSupportInfo_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_getSupportInfo_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_maximum_set_gen.py index e3d8274539c9..61fb6ec49614 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listAdvancedSecurityObjects_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_listAdvancedSecurityObjects_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_minimum_set_gen.py index 4270bf6bda34..b6ed1d6d9137 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_advanced_security_objects_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listAdvancedSecurityObjects_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_listAdvancedSecurityObjects_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_maximum_set_gen.py index 55c424674922..863395a1a9a9 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_minimum_set_gen.py index ea91a51a4830..6fe8b67b571a 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_resource_group_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_maximum_set_gen.py index 995720ac3fda..20403368361d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_minimum_set_gen.py index ef350a40c51f..cc5f3ee6f823 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_by_subscription_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_maximum_set_gen.py index 8b856d4daa04..e0d29b793337 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listFirewalls_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_listFirewalls_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_minimum_set_gen.py index 9b48a105e88b..44b0740dbd9e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_firewalls_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listFirewalls_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_listFirewalls_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_maximum_set_gen.py index 417fd7decb11..3b3c405cf6bb 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listSecurityServices_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_listSecurityServices_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_minimum_set_gen.py index c163e2920674..f0419abdcb45 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_list_security_services_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_listSecurityServices_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_listSecurityServices_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_maximum_set_gen.py index 0b9ae2cffb0a..33da788539fa 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_revert_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_revert_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_minimum_set_gen.py index aa91454ec5c5..9b61baa83063 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_revert_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_revert_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_revert_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_update_maximum_set_gen.py index de8c33521830..2c2e46caa149 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/local_rulestacks_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -62,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/LocalRulestacks_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/LocalRulestacks_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_maximum_set_gen.py index cfaf85c2bda0..387ec7ca43af 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Operations_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Operations_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_minimum_set_gen.py index 62ea229587fe..62a092cd4b83 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/operations_list_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/Operations_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/Operations_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_maximum_set_gen.py new file mode 100644 index 000000000000..0d7c1fcc6221 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_maximum_set_gen.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_create_product_serial_number_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.create_product_serial_number() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PaloAltoNetworksCloudngfw_createProductSerialNumber_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_minimum_set_gen.py new file mode 100644 index 000000000000..5948ba6d179e --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_create_product_serial_number_minimum_set_gen.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_create_product_serial_number_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.create_product_serial_number() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PaloAltoNetworksCloudngfw_createProductSerialNumber_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_maximum_set_gen.py new file mode 100644 index 000000000000..3d994cc429a6 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_maximum_set_gen.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_list_cloud_manager_tenants_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.list_cloud_manager_tenants() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PaloAltoNetworksCloudngfw_listCloudManagerTenants_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_minimum_set_gen.py new file mode 100644 index 000000000000..6f379511b67f --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_cloud_manager_tenants_minimum_set_gen.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_list_cloud_manager_tenants_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.list_cloud_manager_tenants() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PaloAltoNetworksCloudngfw_listCloudManagerTenants_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_maximum_set_gen.py new file mode 100644 index 000000000000..724fb2165e6e --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_maximum_set_gen.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_list_product_serial_number_status_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.list_product_serial_number_status() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PaloAltoNetworksCloudngfw_listProductSerialNumberStatus_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_minimum_set_gen.py new file mode 100644 index 000000000000..16dbc41ccff0 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_product_serial_number_status_minimum_set_gen.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_list_product_serial_number_status_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.list_product_serial_number_status() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PaloAltoNetworksCloudngfw_listProductSerialNumberStatus_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_maximum_set_gen.py new file mode 100644 index 000000000000..1f550e294fbc --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_maximum_set_gen.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_list_support_info_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.list_support_info() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PaloAltoNetworksCloudngfw_listSupportInfo_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_minimum_set_gen.py new file mode 100644 index 000000000000..ca893f2e2d29 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/palo_alto_networks_cloudngfw_list_support_info_minimum_set_gen.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-paloaltonetworksngfw +# USAGE + python palo_alto_networks_cloudngfw_list_support_info_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PaloAltoNetworksNgfwMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="2bf4a339-294d-4c25-b0b2-ef649e9f5c27", + ) + + response = client.palo_alto_networks_cloudngfw.list_support_info() + print(response) + + +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PaloAltoNetworksCloudngfw_listSupportInfo_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_maximum_set_gen.py index cd0b9a52e039..6fbc7d69451c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -65,6 +66,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_minimum_set_gen.py index 64f622b2e1c8..513a23e01eda 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_create_or_update_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_maximum_set_gen.py index c29eebf1a30f..7185d1a2d68d 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_minimum_set_gen.py index 09af61799237..8710517589ba 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_delete_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_maximum_set_gen.py index c77c59c9e4eb..0a4e2802cc0f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_getCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_getCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_minimum_set_gen.py index 5ea03e8594e3..0a6482ee75d4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_counters_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_getCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_getCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_maximum_set_gen.py index 78f456080d43..827ec61ab0d1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_minimum_set_gen.py index 1958c19ed55b..5d39669bff09 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_maximum_set_gen.py index 96693c160426..3f68862759c5 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_minimum_set_gen.py index d745503854ce..1c539a7863b3 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_list_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_maximum_set_gen.py index 78ced62854e2..5b2c5e19e76f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_refreshCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_refreshCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_minimum_set_gen.py index 598d7686bec3..5e1ebbbe6bf2 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_refresh_counters_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_refreshCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_refreshCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_maximum_set_gen.py index 64dd83e52a49..0acd4c137fae 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_resetCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_resetCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_minimum_set_gen.py index f0a41a386e4f..639472c4fc37 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/post_rules_reset_counters_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PostRules_resetCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PostRules_resetCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_maximum_set_gen.py index fc6918e926a3..2e066d408812 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -65,6 +66,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_minimum_set_gen.py index f02e7bc83b1c..d425f671be54 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_create_or_update_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_maximum_set_gen.py index 12d5c623f679..c333a7f3be64 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_minimum_set_gen.py index 8d680018ef5d..bbfbc49de049 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_delete_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_maximum_set_gen.py index c31471107029..a490a2ad77ab 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_getCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_getCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_minimum_set_gen.py index 9ca7c2a5a464..3636bce1e34c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_counters_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_getCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_getCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_maximum_set_gen.py index cee729320321..cfcd06bdf78b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_minimum_set_gen.py index db38c3564330..d8dfcf6fa563 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_maximum_set_gen.py index bdd4727cf04e..3186675011d8 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_minimum_set_gen.py index f4b34d445f20..b3754176f8c4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_list_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_maximum_set_gen.py index 6869b39ea93f..519a82011e0f 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_refreshCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_refreshCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_minimum_set_gen.py index 4997bf81f87c..d0c560126520 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_refresh_counters_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_refreshCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_refreshCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_maximum_set_gen.py index 94f64b4ad95e..b36f28d5df2b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_resetCounters_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_resetCounters_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_minimum_set_gen.py index 3782366f3270..a375ecd9ea3c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/pre_rules_reset_counters_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PreRules_resetCounters_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PreRules_resetCounters_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_maximum_set_gen.py index 857d5b5c95fe..505b0a2ec916 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -45,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_minimum_set_gen.py index 96356fd59da4..e587b4bace3e 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_create_or_update_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_maximum_set_gen.py index 9e7cec848ccc..ebb3e074fa77 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListGlobalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_minimum_set_gen.py index 432985ee899b..bb588266d920 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_delete_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListGlobalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_maximum_set_gen.py index 8ba7421844a2..6e23dded5b0c 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListGlobalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_minimum_set_gen.py index 1197c371bde9..092bca5f4e66 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListGlobalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_maximum_set_gen.py index 11666ccb8b85..550db3dd24b4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_List_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListGlobalRulestack_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_minimum_set_gen.py index 157c1a3628c1..424593fe0337 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_global_rulestack_list_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListGlobalRulestack_List_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListGlobalRulestack_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_maximum_set_gen.py index 7e79667026b0..25a86b6b0366 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -46,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_minimum_set_gen.py index 7c75fb9895d3..2ea7b3043de4 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_create_or_update_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_maximum_set_gen.py index cf8241f8b4cb..d26497a74ed1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListLocalRulestack_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_minimum_set_gen.py index 550041be8fde..ec657717e851 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_delete_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListLocalRulestack_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_maximum_set_gen.py index 705081bdfe20..362fcf3c7dcd 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListLocalRulestack_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_minimum_set_gen.py index 97e5b4032c03..e4f20763f35b 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListLocalRulestack_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py index 8222e318c811..7a03b04a07db 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py index 0963ee87e98d..1b3a7f46c0e1 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_samples/prefix_list_local_rulestack_list_by_local_rulestacks_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/stable/2023-09-01/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json +# x-ms-original-file: specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2025-02-06-preview/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/conftest.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/conftest.py new file mode 100644 index 000000000000..2d9975133ae3 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/conftest.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + paloaltonetworksngfwmgmt_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + paloaltonetworksngfwmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + paloaltonetworksngfwmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + paloaltonetworksngfwmgmt_client_secret = os.environ.get( + "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=paloaltonetworksngfwmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=paloaltonetworksngfwmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=paloaltonetworksngfwmgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=paloaltonetworksngfwmgmt_client_secret, value="00000000-0000-0000-0000-000000000000" + ) + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_global_rulestack_operations.py new file mode 100644 index 000000000000..43d017fe4117 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_global_rulestack_operations.py @@ -0,0 +1,85 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtCertificateObjectGlobalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_global_rulestack_list(self, resource_group): + response = self.client.certificate_object_global_rulestack.list( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_global_rulestack_get(self, resource_group): + response = self.client.certificate_object_global_rulestack.get( + global_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_global_rulestack_begin_create_or_update(self, resource_group): + response = self.client.certificate_object_global_rulestack.begin_create_or_update( + global_rulestack_name="str", + name="str", + resource={ + "certificateSelfSigned": "str", + "auditComment": "str", + "certificateSignerResourceId": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_global_rulestack_begin_delete(self, resource_group): + response = self.client.certificate_object_global_rulestack.begin_delete( + global_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_global_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_global_rulestack_operations_async.py new file mode 100644 index 000000000000..bf1b9ca22210 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_global_rulestack_operations_async.py @@ -0,0 +1,90 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtCertificateObjectGlobalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_certificate_object_global_rulestack_list(self, resource_group): + response = self.client.certificate_object_global_rulestack.list( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_certificate_object_global_rulestack_get(self, resource_group): + response = await self.client.certificate_object_global_rulestack.get( + global_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_certificate_object_global_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.certificate_object_global_rulestack.begin_create_or_update( + global_rulestack_name="str", + name="str", + resource={ + "certificateSelfSigned": "str", + "auditComment": "str", + "certificateSignerResourceId": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_certificate_object_global_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.certificate_object_global_rulestack.begin_delete( + global_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_local_rulestack_operations.py new file mode 100644 index 000000000000..039c49f605ff --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_local_rulestack_operations.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtCertificateObjectLocalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_local_rulestack_list_by_local_rulestacks(self, resource_group): + response = self.client.certificate_object_local_rulestack.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_local_rulestack_get(self, resource_group): + response = self.client.certificate_object_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_local_rulestack_begin_create_or_update(self, resource_group): + response = self.client.certificate_object_local_rulestack.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + resource={ + "certificateSelfSigned": "str", + "auditComment": "str", + "certificateSignerResourceId": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_certificate_object_local_rulestack_begin_delete(self, resource_group): + response = self.client.certificate_object_local_rulestack.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_local_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_local_rulestack_operations_async.py new file mode 100644 index 000000000000..45612ba5253c --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_certificate_object_local_rulestack_operations_async.py @@ -0,0 +1,94 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtCertificateObjectLocalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_certificate_object_local_rulestack_list_by_local_rulestacks(self, resource_group): + response = self.client.certificate_object_local_rulestack.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_certificate_object_local_rulestack_get(self, resource_group): + response = await self.client.certificate_object_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_certificate_object_local_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.certificate_object_local_rulestack.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + resource={ + "certificateSelfSigned": "str", + "auditComment": "str", + "certificateSignerResourceId": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_certificate_object_local_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.certificate_object_local_rulestack.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations.py new file mode 100644 index 000000000000..8644a4117bee --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtFirewallStatusOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewall_status_list_by_firewalls(self, resource_group): + response = self.client.firewall_status.list_by_firewalls( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewall_status_get(self, resource_group): + response = self.client.firewall_status.get( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations_async.py new file mode 100644 index 000000000000..9f1af3cfa27c --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewall_status_operations_async.py @@ -0,0 +1,44 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtFirewallStatusOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewall_status_list_by_firewalls(self, resource_group): + response = self.client.firewall_status.list_by_firewalls( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewall_status_get(self, resource_group): + response = await self.client.firewall_status.get( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations.py new file mode 100644 index 000000000000..e5b25dcfcfab --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations.py @@ -0,0 +1,294 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtFirewallsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_list_by_subscription(self, resource_group): + response = self.client.firewalls.list_by_subscription( + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_list_by_resource_group(self, resource_group): + response = self.client.firewalls.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_get(self, resource_group): + response = self.client.firewalls.get( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_begin_create_or_update(self, resource_group): + response = self.client.firewalls.begin_create_or_update( + resource_group_name=resource_group.name, + firewall_name="str", + resource={ + "dnsSettings": { + "dnsServers": [{"address": "str", "resourceId": "str"}], + "enableDnsProxy": "str", + "enabledDnsType": "str", + }, + "location": "str", + "marketplaceDetails": { + "offerId": "str", + "publisherId": "str", + "marketplaceSubscriptionId": "str", + "marketplaceSubscriptionStatus": "str", + }, + "networkProfile": { + "enableEgressNat": "str", + "networkType": "str", + "publicIps": [{"address": "str", "resourceId": "str"}], + "egressNatIp": [{"address": "str", "resourceId": "str"}], + "privateSourceNatRulesDestination": ["str"], + "trustedRanges": ["str"], + "vnetConfiguration": { + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "vnet": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + }, + "vwanConfiguration": { + "vHub": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + "networkVirtualApplianceId": "str", + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + }, + }, + "planData": { + "billingCycle": "str", + "planId": "str", + "effectiveDate": "2020-02-20 00:00:00", + "usageType": "str", + }, + "associatedRulestack": {"location": "str", "resourceId": "str", "rulestackId": "str"}, + "frontEndSettings": [ + { + "backendConfiguration": {"address": {"address": "str", "resourceId": "str"}, "port": "str"}, + "frontendConfiguration": {"address": {"address": "str", "resourceId": "str"}, "port": "str"}, + "name": "str", + "protocol": "str", + } + ], + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "isPanoramaManaged": "str", + "isStrataCloudManaged": "str", + "name": "str", + "panEtag": "str", + "panoramaConfig": { + "configString": "str", + "cgName": "str", + "dgName": "str", + "hostName": "str", + "panoramaServer": "str", + "panoramaServer2": "str", + "tplName": "str", + "vmAuthKey": "str", + }, + "provisioningState": "str", + "strataCloudManagerConfig": {"cloudManagerName": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_update(self, resource_group): + response = self.client.firewalls.update( + resource_group_name=resource_group.name, + firewall_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "associatedRulestack": {"location": "str", "resourceId": "str", "rulestackId": "str"}, + "dnsSettings": { + "dnsServers": [{"address": "str", "resourceId": "str"}], + "enableDnsProxy": "str", + "enabledDnsType": "str", + }, + "frontEndSettings": [ + { + "backendConfiguration": {"address": {"address": "str", "resourceId": "str"}, "port": "str"}, + "frontendConfiguration": { + "address": {"address": "str", "resourceId": "str"}, + "port": "str", + }, + "name": "str", + "protocol": "str", + } + ], + "isPanoramaManaged": "str", + "isStrataCloudManaged": "str", + "marketplaceDetails": { + "offerId": "str", + "publisherId": "str", + "marketplaceSubscriptionId": "str", + "marketplaceSubscriptionStatus": "str", + }, + "networkProfile": { + "enableEgressNat": "str", + "networkType": "str", + "publicIps": [{"address": "str", "resourceId": "str"}], + "egressNatIp": [{"address": "str", "resourceId": "str"}], + "privateSourceNatRulesDestination": ["str"], + "trustedRanges": ["str"], + "vnetConfiguration": { + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "vnet": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + }, + "vwanConfiguration": { + "vHub": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + "networkVirtualApplianceId": "str", + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + }, + }, + "panEtag": "str", + "panoramaConfig": { + "configString": "str", + "cgName": "str", + "dgName": "str", + "hostName": "str", + "panoramaServer": "str", + "panoramaServer2": "str", + "tplName": "str", + "vmAuthKey": "str", + }, + "planData": { + "billingCycle": "str", + "planId": "str", + "effectiveDate": "2020-02-20 00:00:00", + "usageType": "str", + }, + "strataCloudManagerConfig": {"cloudManagerName": "str"}, + }, + "tags": {"str": "str"}, + }, + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_begin_delete(self, resource_group): + response = self.client.firewalls.begin_delete( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_get_global_rulestack(self, resource_group): + response = self.client.firewalls.get_global_rulestack( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_get_log_profile(self, resource_group): + response = self.client.firewalls.get_log_profile( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_get_support_info(self, resource_group): + response = self.client.firewalls.get_support_info( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_firewalls_save_log_profile(self, resource_group): + response = self.client.firewalls.save_log_profile( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations_async.py new file mode 100644 index 000000000000..1ca5450fbd57 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_firewalls_operations_async.py @@ -0,0 +1,302 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtFirewallsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_list_by_subscription(self, resource_group): + response = self.client.firewalls.list_by_subscription( + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_list_by_resource_group(self, resource_group): + response = self.client.firewalls.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_get(self, resource_group): + response = await self.client.firewalls.get( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_begin_create_or_update(self, resource_group): + response = await ( + await self.client.firewalls.begin_create_or_update( + resource_group_name=resource_group.name, + firewall_name="str", + resource={ + "dnsSettings": { + "dnsServers": [{"address": "str", "resourceId": "str"}], + "enableDnsProxy": "str", + "enabledDnsType": "str", + }, + "location": "str", + "marketplaceDetails": { + "offerId": "str", + "publisherId": "str", + "marketplaceSubscriptionId": "str", + "marketplaceSubscriptionStatus": "str", + }, + "networkProfile": { + "enableEgressNat": "str", + "networkType": "str", + "publicIps": [{"address": "str", "resourceId": "str"}], + "egressNatIp": [{"address": "str", "resourceId": "str"}], + "privateSourceNatRulesDestination": ["str"], + "trustedRanges": ["str"], + "vnetConfiguration": { + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "vnet": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + }, + "vwanConfiguration": { + "vHub": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + "networkVirtualApplianceId": "str", + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + }, + }, + "planData": { + "billingCycle": "str", + "planId": "str", + "effectiveDate": "2020-02-20 00:00:00", + "usageType": "str", + }, + "associatedRulestack": {"location": "str", "resourceId": "str", "rulestackId": "str"}, + "frontEndSettings": [ + { + "backendConfiguration": {"address": {"address": "str", "resourceId": "str"}, "port": "str"}, + "frontendConfiguration": { + "address": {"address": "str", "resourceId": "str"}, + "port": "str", + }, + "name": "str", + "protocol": "str", + } + ], + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "isPanoramaManaged": "str", + "isStrataCloudManaged": "str", + "name": "str", + "panEtag": "str", + "panoramaConfig": { + "configString": "str", + "cgName": "str", + "dgName": "str", + "hostName": "str", + "panoramaServer": "str", + "panoramaServer2": "str", + "tplName": "str", + "vmAuthKey": "str", + }, + "provisioningState": "str", + "strataCloudManagerConfig": {"cloudManagerName": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_update(self, resource_group): + response = await self.client.firewalls.update( + resource_group_name=resource_group.name, + firewall_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "associatedRulestack": {"location": "str", "resourceId": "str", "rulestackId": "str"}, + "dnsSettings": { + "dnsServers": [{"address": "str", "resourceId": "str"}], + "enableDnsProxy": "str", + "enabledDnsType": "str", + }, + "frontEndSettings": [ + { + "backendConfiguration": {"address": {"address": "str", "resourceId": "str"}, "port": "str"}, + "frontendConfiguration": { + "address": {"address": "str", "resourceId": "str"}, + "port": "str", + }, + "name": "str", + "protocol": "str", + } + ], + "isPanoramaManaged": "str", + "isStrataCloudManaged": "str", + "marketplaceDetails": { + "offerId": "str", + "publisherId": "str", + "marketplaceSubscriptionId": "str", + "marketplaceSubscriptionStatus": "str", + }, + "networkProfile": { + "enableEgressNat": "str", + "networkType": "str", + "publicIps": [{"address": "str", "resourceId": "str"}], + "egressNatIp": [{"address": "str", "resourceId": "str"}], + "privateSourceNatRulesDestination": ["str"], + "trustedRanges": ["str"], + "vnetConfiguration": { + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "vnet": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + }, + "vwanConfiguration": { + "vHub": {"addressSpace": "str", "resourceId": "str"}, + "ipOfTrustSubnetForUdr": {"address": "str", "resourceId": "str"}, + "networkVirtualApplianceId": "str", + "trustSubnet": {"addressSpace": "str", "resourceId": "str"}, + "unTrustSubnet": {"addressSpace": "str", "resourceId": "str"}, + }, + }, + "panEtag": "str", + "panoramaConfig": { + "configString": "str", + "cgName": "str", + "dgName": "str", + "hostName": "str", + "panoramaServer": "str", + "panoramaServer2": "str", + "tplName": "str", + "vmAuthKey": "str", + }, + "planData": { + "billingCycle": "str", + "planId": "str", + "effectiveDate": "2020-02-20 00:00:00", + "usageType": "str", + }, + "strataCloudManagerConfig": {"cloudManagerName": "str"}, + }, + "tags": {"str": "str"}, + }, + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_begin_delete(self, resource_group): + response = await ( + await self.client.firewalls.begin_delete( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_get_global_rulestack(self, resource_group): + response = await self.client.firewalls.get_global_rulestack( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_get_log_profile(self, resource_group): + response = await self.client.firewalls.get_log_profile( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_get_support_info(self, resource_group): + response = await self.client.firewalls.get_support_info( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_firewalls_save_log_profile(self, resource_group): + response = await self.client.firewalls.save_log_profile( + resource_group_name=resource_group.name, + firewall_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_global_rulestack_operations.py new file mode 100644 index 000000000000..8bf93e691624 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_global_rulestack_operations.py @@ -0,0 +1,84 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtFqdnListGlobalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_global_rulestack_list(self, resource_group): + response = self.client.fqdn_list_global_rulestack.list( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_global_rulestack_get(self, resource_group): + response = self.client.fqdn_list_global_rulestack.get( + global_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_global_rulestack_begin_create_or_update(self, resource_group): + response = self.client.fqdn_list_global_rulestack.begin_create_or_update( + global_rulestack_name="str", + name="str", + resource={ + "fqdnList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_global_rulestack_begin_delete(self, resource_group): + response = self.client.fqdn_list_global_rulestack.begin_delete( + global_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_global_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_global_rulestack_operations_async.py new file mode 100644 index 000000000000..bfe7ac038af4 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_global_rulestack_operations_async.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtFqdnListGlobalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fqdn_list_global_rulestack_list(self, resource_group): + response = self.client.fqdn_list_global_rulestack.list( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fqdn_list_global_rulestack_get(self, resource_group): + response = await self.client.fqdn_list_global_rulestack.get( + global_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fqdn_list_global_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.fqdn_list_global_rulestack.begin_create_or_update( + global_rulestack_name="str", + name="str", + resource={ + "fqdnList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fqdn_list_global_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.fqdn_list_global_rulestack.begin_delete( + global_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_local_rulestack_operations.py new file mode 100644 index 000000000000..7003df692b66 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_local_rulestack_operations.py @@ -0,0 +1,88 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtFqdnListLocalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_local_rulestack_list_by_local_rulestacks(self, resource_group): + response = self.client.fqdn_list_local_rulestack.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_local_rulestack_get(self, resource_group): + response = self.client.fqdn_list_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_local_rulestack_begin_create_or_update(self, resource_group): + response = self.client.fqdn_list_local_rulestack.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + resource={ + "fqdnList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fqdn_list_local_rulestack_begin_delete(self, resource_group): + response = self.client.fqdn_list_local_rulestack.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_local_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_local_rulestack_operations_async.py new file mode 100644 index 000000000000..25cd19fdd452 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_fqdn_list_local_rulestack_operations_async.py @@ -0,0 +1,93 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtFqdnListLocalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fqdn_list_local_rulestack_list_by_local_rulestacks(self, resource_group): + response = self.client.fqdn_list_local_rulestack.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fqdn_list_local_rulestack_get(self, resource_group): + response = await self.client.fqdn_list_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fqdn_list_local_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.fqdn_list_local_rulestack.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + resource={ + "fqdnList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fqdn_list_local_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.fqdn_list_local_rulestack.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations.py new file mode 100644 index 000000000000..8f840440955a --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations.py @@ -0,0 +1,240 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtGlobalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list(self, resource_group): + response = self.client.global_rulestack.list( + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_get(self, resource_group): + response = self.client.global_rulestack.get( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_begin_create_or_update(self, resource_group): + response = self.client.global_rulestack.begin_create_or_update( + global_rulestack_name="str", + resource={ + "location": "str", + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "minAppIdVersion": "str", + "name": "str", + "panEtag": "str", + "panLocation": "str", + "provisioningState": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_update(self, resource_group): + response = self.client.global_rulestack.update( + global_rulestack_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "properties": { + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "minAppIdVersion": "str", + "panEtag": "str", + "panLocation": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + }, + }, + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_begin_delete(self, resource_group): + response = self.client.global_rulestack.begin_delete( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_begin_commit(self, resource_group): + response = self.client.global_rulestack.begin_commit( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_get_change_log(self, resource_group): + response = self.client.global_rulestack.get_change_log( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list_advanced_security_objects(self, resource_group): + response = self.client.global_rulestack.list_advanced_security_objects( + global_rulestack_name="str", + type="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list_app_ids(self, resource_group): + response = self.client.global_rulestack.list_app_ids( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list_countries(self, resource_group): + response = self.client.global_rulestack.list_countries( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list_firewalls(self, resource_group): + response = self.client.global_rulestack.list_firewalls( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list_predefined_url_categories(self, resource_group): + response = self.client.global_rulestack.list_predefined_url_categories( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_list_security_services(self, resource_group): + response = self.client.global_rulestack.list_security_services( + global_rulestack_name="str", + type="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_global_rulestack_revert(self, resource_group): + response = self.client.global_rulestack.revert( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations_async.py new file mode 100644 index 000000000000..864e376308b8 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_global_rulestack_operations_async.py @@ -0,0 +1,247 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtGlobalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list(self, resource_group): + response = self.client.global_rulestack.list( + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_get(self, resource_group): + response = await self.client.global_rulestack.get( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.global_rulestack.begin_create_or_update( + global_rulestack_name="str", + resource={ + "location": "str", + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "minAppIdVersion": "str", + "name": "str", + "panEtag": "str", + "panLocation": "str", + "provisioningState": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_update(self, resource_group): + response = await self.client.global_rulestack.update( + global_rulestack_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "properties": { + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "minAppIdVersion": "str", + "panEtag": "str", + "panLocation": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + }, + }, + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.global_rulestack.begin_delete( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_begin_commit(self, resource_group): + response = await ( + await self.client.global_rulestack.begin_commit( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_get_change_log(self, resource_group): + response = await self.client.global_rulestack.get_change_log( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list_advanced_security_objects(self, resource_group): + response = await self.client.global_rulestack.list_advanced_security_objects( + global_rulestack_name="str", + type="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list_app_ids(self, resource_group): + response = await self.client.global_rulestack.list_app_ids( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list_countries(self, resource_group): + response = await self.client.global_rulestack.list_countries( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list_firewalls(self, resource_group): + response = await self.client.global_rulestack.list_firewalls( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list_predefined_url_categories(self, resource_group): + response = await self.client.global_rulestack.list_predefined_url_categories( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_list_security_services(self, resource_group): + response = await self.client.global_rulestack.list_security_services( + global_rulestack_name="str", + type="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_global_rulestack_revert(self, resource_group): + response = await self.client.global_rulestack.revert( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations.py new file mode 100644 index 000000000000..603b63222018 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations.py @@ -0,0 +1,148 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtLocalRulesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rules_list_by_local_rulestacks(self, resource_group): + response = self.client.local_rules.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rules_get(self, resource_group): + response = self.client.local_rules.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rules_begin_create_or_update(self, resource_group): + response = self.client.local_rules.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + resource={ + "ruleName": "str", + "actionType": "str", + "applications": ["str"], + "auditComment": "str", + "category": {"feeds": ["str"], "urlCustom": ["str"]}, + "decryptionRuleType": "str", + "description": "str", + "destination": { + "cidrs": ["str"], + "countries": ["str"], + "feeds": ["str"], + "fqdnLists": ["str"], + "prefixLists": ["str"], + }, + "enableLogging": "str", + "etag": "str", + "id": "str", + "inboundInspectionCertificate": "str", + "name": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "application-default", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": [{"key": "str", "value": "str"}], + "type": "str", + }, + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rules_begin_delete(self, resource_group): + response = self.client.local_rules.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rules_get_counters(self, resource_group): + response = self.client.local_rules.get_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rules_refresh_counters(self, resource_group): + response = self.client.local_rules.refresh_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rules_reset_counters(self, resource_group): + response = self.client.local_rules.reset_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations_async.py new file mode 100644 index 000000000000..907770ed9e2c --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rules_operations_async.py @@ -0,0 +1,153 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtLocalRulesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rules_list_by_local_rulestacks(self, resource_group): + response = self.client.local_rules.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rules_get(self, resource_group): + response = await self.client.local_rules.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rules_begin_create_or_update(self, resource_group): + response = await ( + await self.client.local_rules.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + resource={ + "ruleName": "str", + "actionType": "str", + "applications": ["str"], + "auditComment": "str", + "category": {"feeds": ["str"], "urlCustom": ["str"]}, + "decryptionRuleType": "str", + "description": "str", + "destination": { + "cidrs": ["str"], + "countries": ["str"], + "feeds": ["str"], + "fqdnLists": ["str"], + "prefixLists": ["str"], + }, + "enableLogging": "str", + "etag": "str", + "id": "str", + "inboundInspectionCertificate": "str", + "name": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "application-default", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": [{"key": "str", "value": "str"}], + "type": "str", + }, + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rules_begin_delete(self, resource_group): + response = await ( + await self.client.local_rules.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rules_get_counters(self, resource_group): + response = await self.client.local_rules.get_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rules_refresh_counters(self, resource_group): + response = await self.client.local_rules.refresh_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rules_reset_counters(self, resource_group): + response = await self.client.local_rules.reset_counters( + resource_group_name=resource_group.name, + local_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations.py new file mode 100644 index 000000000000..a617b35c2bbd --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations.py @@ -0,0 +1,241 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtLocalRulestacksOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_by_subscription(self, resource_group): + response = self.client.local_rulestacks.list_by_subscription( + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_by_resource_group(self, resource_group): + response = self.client.local_rulestacks.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_get(self, resource_group): + response = self.client.local_rulestacks.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_begin_create_or_update(self, resource_group): + response = self.client.local_rulestacks.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + resource={ + "location": "str", + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "minAppIdVersion": "str", + "name": "str", + "panEtag": "str", + "panLocation": "str", + "provisioningState": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_update(self, resource_group): + response = self.client.local_rulestacks.update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "minAppIdVersion": "str", + "panEtag": "str", + "panLocation": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + }, + "tags": {"str": "str"}, + }, + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_begin_delete(self, resource_group): + response = self.client.local_rulestacks.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_begin_commit(self, resource_group): + response = self.client.local_rulestacks.begin_commit( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_get_change_log(self, resource_group): + response = self.client.local_rulestacks.get_change_log( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_get_support_info(self, resource_group): + response = self.client.local_rulestacks.get_support_info( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_advanced_security_objects(self, resource_group): + response = self.client.local_rulestacks.list_advanced_security_objects( + resource_group_name=resource_group.name, + local_rulestack_name="str", + type="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_firewalls(self, resource_group): + response = self.client.local_rulestacks.list_firewalls( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_list_security_services(self, resource_group): + response = self.client.local_rulestacks.list_security_services( + resource_group_name=resource_group.name, + local_rulestack_name="str", + type="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_rulestacks_revert(self, resource_group): + response = self.client.local_rulestacks.revert( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations_async.py new file mode 100644 index 000000000000..41d8eebc5243 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_local_rulestacks_operations_async.py @@ -0,0 +1,248 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtLocalRulestacksOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_list_by_subscription(self, resource_group): + response = self.client.local_rulestacks.list_by_subscription( + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_list_by_resource_group(self, resource_group): + response = self.client.local_rulestacks.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_get(self, resource_group): + response = await self.client.local_rulestacks.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_begin_create_or_update(self, resource_group): + response = await ( + await self.client.local_rulestacks.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + resource={ + "location": "str", + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "minAppIdVersion": "str", + "name": "str", + "panEtag": "str", + "panLocation": "str", + "provisioningState": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_update(self, resource_group): + response = await self.client.local_rulestacks.update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "associatedSubscriptions": ["str"], + "defaultMode": "str", + "description": "str", + "minAppIdVersion": "str", + "panEtag": "str", + "panLocation": "str", + "scope": "str", + "securityServices": { + "antiSpywareProfile": "str", + "antiVirusProfile": "str", + "dnsSubscription": "str", + "fileBlockingProfile": "str", + "outboundTrustCertificate": "str", + "outboundUnTrustCertificate": "str", + "urlFilteringProfile": "str", + "vulnerabilityProfile": "str", + }, + }, + "tags": {"str": "str"}, + }, + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_begin_delete(self, resource_group): + response = await ( + await self.client.local_rulestacks.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_begin_commit(self, resource_group): + response = await ( + await self.client.local_rulestacks.begin_commit( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_get_change_log(self, resource_group): + response = await self.client.local_rulestacks.get_change_log( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_get_support_info(self, resource_group): + response = await self.client.local_rulestacks.get_support_info( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_list_advanced_security_objects(self, resource_group): + response = await self.client.local_rulestacks.list_advanced_security_objects( + resource_group_name=resource_group.name, + local_rulestack_name="str", + type="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_list_firewalls(self, resource_group): + response = await self.client.local_rulestacks.list_firewalls( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_list_security_services(self, resource_group): + response = await self.client.local_rulestacks.list_security_services( + resource_group_name=resource_group.name, + local_rulestack_name="str", + type="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_rulestacks_revert(self, resource_group): + response = await self.client.local_rulestacks.revert( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations.py new file mode 100644 index 000000000000..de17048e4615 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations.py @@ -0,0 +1,29 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations_async.py new file mode 100644 index 000000000000..84db89bb0472 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_operations_async.py @@ -0,0 +1,30 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_palo_alto_networks_cloudngfw_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_palo_alto_networks_cloudngfw_operations.py new file mode 100644 index 000000000000..fc3991703d73 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_palo_alto_networks_cloudngfw_operations.py @@ -0,0 +1,59 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtPaloAltoNetworksCloudngfwOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_palo_alto_networks_cloudngfw_create_product_serial_number(self, resource_group): + response = self.client.palo_alto_networks_cloudngfw.create_product_serial_number( + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_palo_alto_networks_cloudngfw_list_cloud_manager_tenants(self, resource_group): + response = self.client.palo_alto_networks_cloudngfw.list_cloud_manager_tenants( + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_palo_alto_networks_cloudngfw_list_product_serial_number_status(self, resource_group): + response = self.client.palo_alto_networks_cloudngfw.list_product_serial_number_status( + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_palo_alto_networks_cloudngfw_list_support_info(self, resource_group): + response = self.client.palo_alto_networks_cloudngfw.list_support_info( + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_palo_alto_networks_cloudngfw_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_palo_alto_networks_cloudngfw_operations_async.py new file mode 100644 index 000000000000..c2792a8f2124 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_palo_alto_networks_cloudngfw_operations_async.py @@ -0,0 +1,60 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtPaloAltoNetworksCloudngfwOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_palo_alto_networks_cloudngfw_create_product_serial_number(self, resource_group): + response = await self.client.palo_alto_networks_cloudngfw.create_product_serial_number( + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_palo_alto_networks_cloudngfw_list_cloud_manager_tenants(self, resource_group): + response = await self.client.palo_alto_networks_cloudngfw.list_cloud_manager_tenants( + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_palo_alto_networks_cloudngfw_list_product_serial_number_status(self, resource_group): + response = await self.client.palo_alto_networks_cloudngfw.list_product_serial_number_status( + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_palo_alto_networks_cloudngfw_list_support_info(self, resource_group): + response = await self.client.palo_alto_networks_cloudngfw.list_support_info( + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations.py new file mode 100644 index 000000000000..e51bda298ae9 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations.py @@ -0,0 +1,141 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtPostRulesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post_rules_list(self, resource_group): + response = self.client.post_rules.list( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post_rules_get(self, resource_group): + response = self.client.post_rules.get( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post_rules_begin_create_or_update(self, resource_group): + response = self.client.post_rules.begin_create_or_update( + global_rulestack_name="str", + priority="str", + resource={ + "ruleName": "str", + "actionType": "str", + "applications": ["str"], + "auditComment": "str", + "category": {"feeds": ["str"], "urlCustom": ["str"]}, + "decryptionRuleType": "str", + "description": "str", + "destination": { + "cidrs": ["str"], + "countries": ["str"], + "feeds": ["str"], + "fqdnLists": ["str"], + "prefixLists": ["str"], + }, + "enableLogging": "str", + "etag": "str", + "id": "str", + "inboundInspectionCertificate": "str", + "name": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "application-default", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": [{"key": "str", "value": "str"}], + "type": "str", + }, + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post_rules_begin_delete(self, resource_group): + response = self.client.post_rules.begin_delete( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post_rules_get_counters(self, resource_group): + response = self.client.post_rules.get_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post_rules_refresh_counters(self, resource_group): + response = self.client.post_rules.refresh_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post_rules_reset_counters(self, resource_group): + response = self.client.post_rules.reset_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations_async.py new file mode 100644 index 000000000000..e385557b76d4 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_post_rules_operations_async.py @@ -0,0 +1,146 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtPostRulesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post_rules_list(self, resource_group): + response = self.client.post_rules.list( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post_rules_get(self, resource_group): + response = await self.client.post_rules.get( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post_rules_begin_create_or_update(self, resource_group): + response = await ( + await self.client.post_rules.begin_create_or_update( + global_rulestack_name="str", + priority="str", + resource={ + "ruleName": "str", + "actionType": "str", + "applications": ["str"], + "auditComment": "str", + "category": {"feeds": ["str"], "urlCustom": ["str"]}, + "decryptionRuleType": "str", + "description": "str", + "destination": { + "cidrs": ["str"], + "countries": ["str"], + "feeds": ["str"], + "fqdnLists": ["str"], + "prefixLists": ["str"], + }, + "enableLogging": "str", + "etag": "str", + "id": "str", + "inboundInspectionCertificate": "str", + "name": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "application-default", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": [{"key": "str", "value": "str"}], + "type": "str", + }, + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post_rules_begin_delete(self, resource_group): + response = await ( + await self.client.post_rules.begin_delete( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post_rules_get_counters(self, resource_group): + response = await self.client.post_rules.get_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post_rules_refresh_counters(self, resource_group): + response = await self.client.post_rules.refresh_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post_rules_reset_counters(self, resource_group): + response = await self.client.post_rules.reset_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations.py new file mode 100644 index 000000000000..acacf2c2c3a0 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations.py @@ -0,0 +1,141 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtPreRulesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pre_rules_list(self, resource_group): + response = self.client.pre_rules.list( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pre_rules_get(self, resource_group): + response = self.client.pre_rules.get( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pre_rules_begin_create_or_update(self, resource_group): + response = self.client.pre_rules.begin_create_or_update( + global_rulestack_name="str", + priority="str", + resource={ + "ruleName": "str", + "actionType": "str", + "applications": ["str"], + "auditComment": "str", + "category": {"feeds": ["str"], "urlCustom": ["str"]}, + "decryptionRuleType": "str", + "description": "str", + "destination": { + "cidrs": ["str"], + "countries": ["str"], + "feeds": ["str"], + "fqdnLists": ["str"], + "prefixLists": ["str"], + }, + "enableLogging": "str", + "etag": "str", + "id": "str", + "inboundInspectionCertificate": "str", + "name": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "application-default", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": [{"key": "str", "value": "str"}], + "type": "str", + }, + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pre_rules_begin_delete(self, resource_group): + response = self.client.pre_rules.begin_delete( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pre_rules_get_counters(self, resource_group): + response = self.client.pre_rules.get_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pre_rules_refresh_counters(self, resource_group): + response = self.client.pre_rules.refresh_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pre_rules_reset_counters(self, resource_group): + response = self.client.pre_rules.reset_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations_async.py new file mode 100644 index 000000000000..63ff79451e60 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_pre_rules_operations_async.py @@ -0,0 +1,146 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtPreRulesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pre_rules_list(self, resource_group): + response = self.client.pre_rules.list( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pre_rules_get(self, resource_group): + response = await self.client.pre_rules.get( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pre_rules_begin_create_or_update(self, resource_group): + response = await ( + await self.client.pre_rules.begin_create_or_update( + global_rulestack_name="str", + priority="str", + resource={ + "ruleName": "str", + "actionType": "str", + "applications": ["str"], + "auditComment": "str", + "category": {"feeds": ["str"], "urlCustom": ["str"]}, + "decryptionRuleType": "str", + "description": "str", + "destination": { + "cidrs": ["str"], + "countries": ["str"], + "feeds": ["str"], + "fqdnLists": ["str"], + "prefixLists": ["str"], + }, + "enableLogging": "str", + "etag": "str", + "id": "str", + "inboundInspectionCertificate": "str", + "name": "str", + "negateDestination": "str", + "negateSource": "str", + "priority": 0, + "protocol": "application-default", + "protocolPortList": ["str"], + "provisioningState": "str", + "ruleState": "str", + "source": {"cidrs": ["str"], "countries": ["str"], "feeds": ["str"], "prefixLists": ["str"]}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": [{"key": "str", "value": "str"}], + "type": "str", + }, + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pre_rules_begin_delete(self, resource_group): + response = await ( + await self.client.pre_rules.begin_delete( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pre_rules_get_counters(self, resource_group): + response = await self.client.pre_rules.get_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pre_rules_refresh_counters(self, resource_group): + response = await self.client.pre_rules.refresh_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pre_rules_reset_counters(self, resource_group): + response = await self.client.pre_rules.reset_counters( + global_rulestack_name="str", + priority="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_global_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_global_rulestack_operations.py new file mode 100644 index 000000000000..b9199ec583d6 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_global_rulestack_operations.py @@ -0,0 +1,84 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtPrefixListGlobalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_global_rulestack_list(self, resource_group): + response = self.client.prefix_list_global_rulestack.list( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_global_rulestack_get(self, resource_group): + response = self.client.prefix_list_global_rulestack.get( + global_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_global_rulestack_begin_create_or_update(self, resource_group): + response = self.client.prefix_list_global_rulestack.begin_create_or_update( + global_rulestack_name="str", + name="str", + resource={ + "prefixList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_global_rulestack_begin_delete(self, resource_group): + response = self.client.prefix_list_global_rulestack.begin_delete( + global_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_global_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_global_rulestack_operations_async.py new file mode 100644 index 000000000000..67b428bb865c --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_global_rulestack_operations_async.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtPrefixListGlobalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_prefix_list_global_rulestack_list(self, resource_group): + response = self.client.prefix_list_global_rulestack.list( + global_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_prefix_list_global_rulestack_get(self, resource_group): + response = await self.client.prefix_list_global_rulestack.get( + global_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_prefix_list_global_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.prefix_list_global_rulestack.begin_create_or_update( + global_rulestack_name="str", + name="str", + resource={ + "prefixList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_prefix_list_global_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.prefix_list_global_rulestack.begin_delete( + global_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_local_rulestack_operations.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_local_rulestack_operations.py new file mode 100644 index 000000000000..c208815e1d9d --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_local_rulestack_operations.py @@ -0,0 +1,88 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtPrefixListLocalRulestackOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_local_rulestack_list_by_local_rulestacks(self, resource_group): + response = self.client.prefix_list_local_rulestack.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_local_rulestack_get(self, resource_group): + response = self.client.prefix_list_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_local_rulestack_begin_create_or_update(self, resource_group): + response = self.client.prefix_list_local_rulestack.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + resource={ + "prefixList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_prefix_list_local_rulestack_begin_delete(self, resource_group): + response = self.client.prefix_list_local_rulestack.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_local_rulestack_operations_async.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_local_rulestack_operations_async.py new file mode 100644 index 000000000000..365e7c5c9443 --- /dev/null +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/generated_tests/test_palo_alto_networks_ngfw_mgmt_prefix_list_local_rulestack_operations_async.py @@ -0,0 +1,93 @@ +# 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 pytest +from azure.mgmt.paloaltonetworksngfw.aio import PaloAltoNetworksNgfwMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestPaloAltoNetworksNgfwMgmtPrefixListLocalRulestackOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(PaloAltoNetworksNgfwMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_prefix_list_local_rulestack_list_by_local_rulestacks(self, resource_group): + response = self.client.prefix_list_local_rulestack.list_by_local_rulestacks( + resource_group_name=resource_group.name, + local_rulestack_name="str", + api_version="2025-02-06-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_prefix_list_local_rulestack_get(self, resource_group): + response = await self.client.prefix_list_local_rulestack.get( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_prefix_list_local_rulestack_begin_create_or_update(self, resource_group): + response = await ( + await self.client.prefix_list_local_rulestack.begin_create_or_update( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + resource={ + "prefixList": ["str"], + "auditComment": "str", + "description": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_prefix_list_local_rulestack_begin_delete(self, resource_group): + response = await ( + await self.client.prefix_list_local_rulestack.begin_delete( + resource_group_name=resource_group.name, + local_rulestack_name="str", + name="str", + api_version="2025-02-06-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/setup.py b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/setup.py index 11c58a5e8888..f5c72233ef11 100644 --- a/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/setup.py +++ b/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/setup.py @@ -53,11 +53,11 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -74,10 +74,10 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "typing-extensions>=4.6.0", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7", + python_requires=">=3.8", )