diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/README.md b/sdk/appconfiguration/azure-mgmt-appconfiguration/README.md
index 0ff31ab2d85c..ee37c278a415 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/README.md
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/README.md
@@ -1,7 +1,7 @@
# Microsoft Azure SDK for Python
This is the Microsoft Azure App Configuration 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
@@ -59,6 +59,3 @@ Code samples for this package can be found at:
If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.
-
-
-
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/_meta.json b/sdk/appconfiguration/azure-mgmt-appconfiguration/_meta.json
index 52401bab879f..d6e14d4ccd99 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/_meta.json
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/_meta.json
@@ -1,11 +1,14 @@
{
- "commit": "396209531039d3e211cb1ec0982606dbbdf64ac2",
+ "commit": "4ecaf104897f0d3d06aa9f67c13fa98829efec82",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
- "autorest": "3.9.2",
+ "autorest": "3.10.2",
"use": [
- "@autorest/python@6.4.3",
- "@autorest/modelerfour@4.24.3"
+ "@autorest/python@6.19.0",
+ "@autorest/modelerfour@4.27.0"
],
- "autorest_command": "autorest specification/appconfiguration/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.4.3 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
- "readme": "specification/appconfiguration/resource-manager/readme.md"
+ "autorest_command": "autorest specification/appconfiguration/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.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
+ "readme": "specification/appconfiguration/resource-manager/readme.md",
+ "package-2023-03-01": "2023-05-03 21:13:49 -0700 32e5ec18ee2125c2638de8d48d63053fa5e4af93 Microsoft.AppConfiguration/stable/2023-03-01/appconfiguration.json",
+ "package-2022-05-01": "2023-02-02 21:00:54 -0500 2c4244e5bcb8939167b79f633cdc17a1f0eae9be Microsoft.AppConfiguration/stable/2022-05-01/appconfiguration.json",
+ "package-2022-03-01-preview": "2022-07-19 19:54:15 -0700 0e1a9820941badc06e99bda9d1efa59de777efbf Microsoft.AppConfiguration/preview/2022-03-01-preview/appconfiguration.json"
}
\ No newline at end of file
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/__init__.py
index 858738cf88a1..9b210796291b 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/__init__.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/__init__.py
@@ -7,12 +7,10 @@
# --------------------------------------------------------------------------
from ._app_configuration_management_client import AppConfigurationManagementClient
-
-__all__ = ["AppConfigurationManagementClient"]
+__all__ = ['AppConfigurationManagementClient']
try:
from ._patch import patch_sdk # type: ignore
-
patch_sdk()
except ImportError:
pass
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py
index 5c24bbd33423..785e1447376d 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_app_configuration_management_client.py
@@ -10,8 +10,11 @@
# --------------------------------------------------------------------------
from typing import Any, Optional, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.mgmt.core import ARMPipelineClient
+from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
@@ -22,7 +25,6 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-
class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
@@ -30,7 +32,6 @@ def __init__(self, *args, **kwargs):
"""
pass
-
class AppConfigurationManagementClient(MultiApiClientMixin, _SDKClient):
"""AppConfigurationManagementClient.
@@ -55,29 +56,50 @@ class AppConfigurationManagementClient(MultiApiClientMixin, _SDKClient):
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""
- DEFAULT_API_VERSION = "2023-03-01"
+ DEFAULT_API_VERSION = '2023-03-01'
_PROFILE_TAG = "azure.mgmt.appconfiguration.AppConfigurationManagementClient"
- LATEST_PROFILE = ProfileDefinition(
- {
- _PROFILE_TAG: {
- None: DEFAULT_API_VERSION,
- }
- },
- _PROFILE_TAG + " latest",
+ LATEST_PROFILE = ProfileDefinition({
+ _PROFILE_TAG: {
+ None: DEFAULT_API_VERSION,
+ }},
+ _PROFILE_TAG + " latest"
)
def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
- api_version: Optional[str] = None,
+ api_version: Optional[str]=None,
base_url: str = "https://management.azure.com",
- profile: KnownProfiles = KnownProfiles.default,
+ profile: KnownProfiles=KnownProfiles.default,
**kwargs: Any
):
+ if api_version:
+ kwargs.setdefault('api_version', api_version)
self._config = AppConfigurationManagementClientConfiguration(credential, subscription_id, **kwargs)
- self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
- super(AppConfigurationManagementClient, self).__init__(api_version=api_version, profile=profile)
+ _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(base_url=base_url, policies=_policies, **kwargs)
+ super(AppConfigurationManagementClient, self).__init__(
+ api_version=api_version,
+ profile=profile
+ )
@classmethod
def _models_dict(cls, api_version):
@@ -87,21 +109,18 @@ def _models_dict(cls, api_version):
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
- * 2022-03-01-preview: :mod:`v2022_03_01_preview.models`
- * 2022-05-01: :mod:`v2022_05_01.models`
- * 2023-03-01: :mod:`v2023_03_01.models`
+ * 2022-03-01-preview: :mod:`v2022_03_01_preview.models`
+ * 2022-05-01: :mod:`v2022_05_01.models`
+ * 2023-03-01: :mod:`v2023_03_01.models`
"""
- if api_version == "2022-03-01-preview":
+ if api_version == '2022-03-01-preview':
from .v2022_03_01_preview import models
-
return models
- elif api_version == "2022-05-01":
+ elif api_version == '2022-05-01':
from .v2022_05_01 import models
-
return models
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from .v2023_03_01 import models
-
return models
raise ValueError("API version {} is not available".format(api_version))
@@ -109,159 +128,123 @@ def models(cls, api_version=DEFAULT_API_VERSION):
def configuration_stores(self):
"""Instance depends on the API version:
- * 2022-03-01-preview: :class:`ConfigurationStoresOperations`
- * 2022-05-01: :class:`ConfigurationStoresOperations`
- * 2023-03-01: :class:`ConfigurationStoresOperations`
+ * 2022-03-01-preview: :class:`ConfigurationStoresOperations`
+ * 2022-05-01: :class:`ConfigurationStoresOperations`
+ * 2023-03-01: :class:`ConfigurationStoresOperations`
"""
- api_version = self._get_api_version("configuration_stores")
- if api_version == "2022-03-01-preview":
+ api_version = self._get_api_version('configuration_stores')
+ if api_version == '2022-03-01-preview':
from .v2022_03_01_preview.operations import ConfigurationStoresOperations as OperationClass
- elif api_version == "2022-05-01":
+ elif api_version == '2022-05-01':
from .v2022_05_01.operations import ConfigurationStoresOperations as OperationClass
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from .v2023_03_01.operations import ConfigurationStoresOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'configuration_stores'".format(api_version))
self._config.api_version = api_version
- return OperationClass(
- self._client,
- self._config,
- Serializer(self._models_dict(api_version)),
- Deserializer(self._models_dict(api_version)),
- )
+ return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
@property
def key_values(self):
"""Instance depends on the API version:
- * 2022-03-01-preview: :class:`KeyValuesOperations`
- * 2022-05-01: :class:`KeyValuesOperations`
- * 2023-03-01: :class:`KeyValuesOperations`
+ * 2022-03-01-preview: :class:`KeyValuesOperations`
+ * 2022-05-01: :class:`KeyValuesOperations`
+ * 2023-03-01: :class:`KeyValuesOperations`
"""
- api_version = self._get_api_version("key_values")
- if api_version == "2022-03-01-preview":
+ api_version = self._get_api_version('key_values')
+ if api_version == '2022-03-01-preview':
from .v2022_03_01_preview.operations import KeyValuesOperations as OperationClass
- elif api_version == "2022-05-01":
+ elif api_version == '2022-05-01':
from .v2022_05_01.operations import KeyValuesOperations as OperationClass
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from .v2023_03_01.operations import KeyValuesOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'key_values'".format(api_version))
self._config.api_version = api_version
- return OperationClass(
- self._client,
- self._config,
- Serializer(self._models_dict(api_version)),
- Deserializer(self._models_dict(api_version)),
- )
+ return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
@property
def operations(self):
"""Instance depends on the API version:
- * 2022-03-01-preview: :class:`Operations`
- * 2022-05-01: :class:`Operations`
- * 2023-03-01: :class:`Operations`
+ * 2022-03-01-preview: :class:`Operations`
+ * 2022-05-01: :class:`Operations`
+ * 2023-03-01: :class:`Operations`
"""
- api_version = self._get_api_version("operations")
- if api_version == "2022-03-01-preview":
+ api_version = self._get_api_version('operations')
+ if api_version == '2022-03-01-preview':
from .v2022_03_01_preview.operations import Operations as OperationClass
- elif api_version == "2022-05-01":
+ elif api_version == '2022-05-01':
from .v2022_05_01.operations import Operations as OperationClass
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from .v2023_03_01.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
self._config.api_version = api_version
- return OperationClass(
- self._client,
- self._config,
- Serializer(self._models_dict(api_version)),
- Deserializer(self._models_dict(api_version)),
- )
+ return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
@property
def private_endpoint_connections(self):
"""Instance depends on the API version:
- * 2022-03-01-preview: :class:`PrivateEndpointConnectionsOperations`
- * 2022-05-01: :class:`PrivateEndpointConnectionsOperations`
- * 2023-03-01: :class:`PrivateEndpointConnectionsOperations`
+ * 2022-03-01-preview: :class:`PrivateEndpointConnectionsOperations`
+ * 2022-05-01: :class:`PrivateEndpointConnectionsOperations`
+ * 2023-03-01: :class:`PrivateEndpointConnectionsOperations`
"""
- api_version = self._get_api_version("private_endpoint_connections")
- if api_version == "2022-03-01-preview":
+ api_version = self._get_api_version('private_endpoint_connections')
+ if api_version == '2022-03-01-preview':
from .v2022_03_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass
- elif api_version == "2022-05-01":
+ elif api_version == '2022-05-01':
from .v2022_05_01.operations import PrivateEndpointConnectionsOperations as OperationClass
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from .v2023_03_01.operations import PrivateEndpointConnectionsOperations as OperationClass
else:
- raise ValueError(
- "API version {} does not have operation group 'private_endpoint_connections'".format(api_version)
- )
+ raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version))
self._config.api_version = api_version
- return OperationClass(
- self._client,
- self._config,
- Serializer(self._models_dict(api_version)),
- Deserializer(self._models_dict(api_version)),
- )
+ return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
@property
def private_link_resources(self):
"""Instance depends on the API version:
- * 2022-03-01-preview: :class:`PrivateLinkResourcesOperations`
- * 2022-05-01: :class:`PrivateLinkResourcesOperations`
- * 2023-03-01: :class:`PrivateLinkResourcesOperations`
+ * 2022-03-01-preview: :class:`PrivateLinkResourcesOperations`
+ * 2022-05-01: :class:`PrivateLinkResourcesOperations`
+ * 2023-03-01: :class:`PrivateLinkResourcesOperations`
"""
- api_version = self._get_api_version("private_link_resources")
- if api_version == "2022-03-01-preview":
+ api_version = self._get_api_version('private_link_resources')
+ if api_version == '2022-03-01-preview':
from .v2022_03_01_preview.operations import PrivateLinkResourcesOperations as OperationClass
- elif api_version == "2022-05-01":
+ elif api_version == '2022-05-01':
from .v2022_05_01.operations import PrivateLinkResourcesOperations as OperationClass
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from .v2023_03_01.operations import PrivateLinkResourcesOperations as OperationClass
else:
- raise ValueError(
- "API version {} does not have operation group 'private_link_resources'".format(api_version)
- )
+ raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version))
self._config.api_version = api_version
- return OperationClass(
- self._client,
- self._config,
- Serializer(self._models_dict(api_version)),
- Deserializer(self._models_dict(api_version)),
- )
+ return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
@property
def replicas(self):
"""Instance depends on the API version:
- * 2022-03-01-preview: :class:`ReplicasOperations`
- * 2023-03-01: :class:`ReplicasOperations`
+ * 2022-03-01-preview: :class:`ReplicasOperations`
+ * 2023-03-01: :class:`ReplicasOperations`
"""
- api_version = self._get_api_version("replicas")
- if api_version == "2022-03-01-preview":
+ api_version = self._get_api_version('replicas')
+ if api_version == '2022-03-01-preview':
from .v2022_03_01_preview.operations import ReplicasOperations as OperationClass
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from .v2023_03_01.operations import ReplicasOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'replicas'".format(api_version))
self._config.api_version = api_version
- return OperationClass(
- self._client,
- self._config,
- Serializer(self._models_dict(api_version)),
- Deserializer(self._models_dict(api_version)),
- )
+ return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
def close(self):
self._client.close()
-
def __enter__(self):
self._client.__enter__()
return self
-
def __exit__(self, *exc_details):
self._client.__exit__(*exc_details)
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_configuration.py
index 4408a9bd06cf..e5d665773601 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_configuration.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_configuration.py
@@ -10,7 +10,6 @@
# --------------------------------------------------------------------------
from typing import Any, TYPE_CHECKING
-from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
@@ -20,8 +19,7 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-
-class AppConfigurationManagementClientConfiguration(Configuration):
+class AppConfigurationManagementClientConfiguration:
"""Configuration for AppConfigurationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -33,30 +31,36 @@ class AppConfigurationManagementClientConfiguration(Configuration):
:type subscription_id: str
"""
- def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any):
+ def __init__(
+ self,
+ credential: "TokenCredential",
+ subscription_id: str,
+ **kwargs: Any
+ ):
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
- super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs)
self.credential = credential
self.subscription_id = subscription_id
- self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
- kwargs.setdefault("sdk_moniker", "azure-mgmt-appconfiguration/{}".format(VERSION))
+ self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
+ kwargs.setdefault('sdk_moniker', 'azure-mgmt-appconfiguration/{}'.format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
- def _configure(self, **kwargs: Any):
- self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
- self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
- self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
- self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
- self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
- self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
- self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
- self.authentication_policy = kwargs.get("authentication_policy")
+ def _configure(
+ self,
+ **kwargs: Any
+ ):
+ self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
+ self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
+ self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
+ self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
+ self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
+ self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
+ self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
+ self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
+ self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
- self.authentication_policy = ARMChallengeAuthenticationPolicy(
- self.credential, *self.credential_scopes, **kwargs
- )
+ self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_serialization.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_serialization.py
index f17c068e833e..59f1fcf71bc9 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_serialization.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/_serialization.py
@@ -63,8 +63,8 @@
import isodate # type: ignore
-from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback
-from azure.core.serialization import NULL as AzureCoreNull
+from azure.core.exceptions import DeserializationError, SerializationError
+from azure.core.serialization import NULL as CoreNull
_BOM = codecs.BOM_UTF8.decode(encoding="utf-8")
@@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type:
pass
return ET.fromstring(data_as_str) # nosec
- except ET.ParseError:
+ except ET.ParseError as err:
# It might be because the server has an issue, and returned JSON with
# content-type XML....
# So let's try a JSON load, and if it's still broken
@@ -143,7 +143,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
@@ -170,13 +172,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]],
return None
-try:
- basestring # type: ignore
- unicode_str = unicode # type: ignore
-except NameError:
- basestring = str
- unicode_str = str
-
_LOGGER = logging.getLogger(__name__)
try:
@@ -295,7 +290,7 @@ class Model(object):
_validation: Dict[str, Dict[str, Any]] = {}
def __init__(self, **kwargs: Any) -> None:
- self.additional_properties: Dict[str, Any] = {}
+ self.additional_properties: Optional[Dict[str, Any]] = {}
for k in kwargs:
if k not in self._attribute_map:
_LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__)
@@ -340,7 +335,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,12 +346,14 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON:
:rtype: dict
"""
serializer = Serializer(self._infer_class_models())
- return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs)
+ return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore
def as_dict(
self,
keep_readonly: bool = True,
- key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer,
+ key_transformer: Callable[
+ [str, Dict[str, Any], Any], Any
+ ] = attribute_transformer,
**kwargs: Any
) -> JSON:
"""Return a dict that can be serialized using json.dump.
@@ -390,7 +387,7 @@ def my_key_transformer(key, attr_desc, value):
:rtype: dict
"""
serializer = Serializer(self._infer_class_models())
- return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs)
+ return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore
@classmethod
def _infer_class_models(cls):
@@ -415,7 +412,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N
:raises: DeserializationError if something went wrong
"""
deserializer = Deserializer(cls._infer_class_models())
- return deserializer(cls.__name__, data, content_type=content_type)
+ return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
@classmethod
def from_dict(
@@ -445,7 +442,7 @@ def from_dict(
if key_extractors is None
else key_extractors
)
- return deserializer(cls.__name__, data, content_type=content_type)
+ return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
@classmethod
def _flatten_subtype(cls, key, objects):
@@ -545,7 +542,7 @@ class Serializer(object):
"multiple": lambda x, y: x % y != 0,
}
- def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
+ def __init__(self, classes: Optional[Mapping[str, type]]=None):
self.serialize_type = {
"iso-8601": Serializer.serialize_iso,
"rfc-1123": Serializer.serialize_rfc,
@@ -561,7 +558,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
"[]": self.serialize_iter,
"{}": self.serialize_dict,
}
- self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
+ self.dependencies: Dict[str, type] = dict(classes) if classes else {}
self.key_transformer = full_restapi_key_transformer
self.client_side_validation = True
@@ -629,7 +626,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
if xml_desc.get("attr", False):
if xml_ns:
ET.register_namespace(xml_prefix, xml_ns)
- xml_name = "{}{}".format(xml_ns, xml_name)
+ xml_name = "{{{}}}{}".format(xml_ns, xml_name)
serialized.set(xml_name, new_attr) # type: ignore
continue
if xml_desc.get("text", False):
@@ -649,7 +646,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
@@ -662,12 +659,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
_serialized.update(_new_attr) # type: ignore
_new_attr = _new_attr[k] # type: ignore
_serialized = _serialized[k]
- except ValueError:
- continue
+ except ValueError as err:
+ if isinstance(err, SerializationError):
+ raise
except (AttributeError, KeyError, TypeError) as err:
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
- raise_with_traceback(SerializationError, msg, err)
+ raise SerializationError(msg) from err
else:
return serialized
@@ -709,7 +707,7 @@ def body(self, data, data_type, **kwargs):
]
data = deserializer._deserialize(data_type, data)
except DeserializationError as err:
- raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err)
+ raise SerializationError("Unable to build a model: " + str(err)) from err
return self._serialize(data, data_type, **kwargs)
@@ -729,6 +727,7 @@ def url(self, name, data, data_type, **kwargs):
if kwargs.get("skip_quote") is True:
output = str(output)
+ output = output.replace("{", quote("{")).replace("}", quote("}"))
else:
output = quote(str(output), safe="")
except SerializationError:
@@ -741,7 +740,9 @@ def query(self, name, data, data_type, **kwargs):
:param data: The data to be serialized.
:param str data_type: The type to be serialized from.
- :rtype: str
+ :keyword bool skip_quote: Whether to skip quote the serialized result.
+ Defaults to False.
+ :rtype: str, list
:raises: TypeError if serialization fails.
:raises: ValueError if data is None
"""
@@ -749,10 +750,8 @@ def query(self, name, data, data_type, **kwargs):
# Treat the list aside, since we don't want to encode the div separator
if data_type.startswith("["):
internal_data_type = data_type[1:-1]
- data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
- if not kwargs.get("skip_quote", False):
- data = [quote(str(d), safe="") for d in data]
- return str(self.serialize_iter(data, internal_data_type, **kwargs))
+ do_quote = not kwargs.get('skip_quote', False)
+ return 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)
@@ -803,7 +802,7 @@ def serialize_data(self, data, data_type, **kwargs):
raise ValueError("No value for given attribute")
try:
- if data is AzureCoreNull:
+ if data is CoreNull:
return None
if data_type in self.basic_types.values():
return self.serialize_basic(data, data_type, **kwargs)
@@ -823,7 +822,7 @@ def serialize_data(self, data, data_type, **kwargs):
except (ValueError, TypeError) as err:
msg = "Unable to serialize value: {!r} as type: {!r}."
- raise_with_traceback(SerializationError, msg.format(data, data_type), err)
+ raise SerializationError(msg.format(data, data_type)) from err
else:
return self._serialize(data, **kwargs)
@@ -891,6 +890,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
not be None or empty.
:param str div: If set, this str will be used to combine the elements
in the iterable into a combined string. Default is 'None'.
+ :keyword bool do_quote: Whether to quote the serialized result of each iterable element.
+ Defaults to False.
:rtype: list, str
"""
if isinstance(data, str):
@@ -903,9 +904,18 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
for d in data:
try:
serialized.append(self.serialize_data(d, iter_type, **kwargs))
- except ValueError:
+ except ValueError as err:
+ if isinstance(err, SerializationError):
+ raise
serialized.append(None)
+ if kwargs.get('do_quote', False):
+ serialized = [
+ '' if s is None else quote(str(s), safe='')
+ for s
+ in serialized
+ ]
+
if div:
serialized = ["" if s is None else str(s) for s in serialized]
serialized = div.join(serialized)
@@ -950,7 +960,9 @@ def serialize_dict(self, attr, dict_type, **kwargs):
for key, value in attr.items():
try:
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
- except ValueError:
+ except ValueError as err:
+ if isinstance(err, SerializationError):
+ raise
serialized[self.serialize_unicode(key)] = None
if "xml" in serialization_ctxt:
@@ -983,7 +995,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)
@@ -1160,10 +1172,10 @@ def serialize_iso(attr, **kwargs):
return date + microseconds + "Z"
except (ValueError, OverflowError) as err:
msg = "Unable to serialize datetime object."
- raise_with_traceback(SerializationError, msg, err)
+ raise SerializationError(msg) from err
except AttributeError as err:
msg = "ISO-8601 object must be valid Datetime object."
- raise_with_traceback(TypeError, msg, err)
+ raise TypeError(msg) from err
@staticmethod
def serialize_unix(attr, **kwargs):
@@ -1199,7 +1211,6 @@ def rest_key_extractor(attr, attr_desc, data):
if working_data is None:
# If at any point while following flatten JSON path see None, it means
# that all properties under are None as well
- # https://github.com/Azure/msrest-for-python/issues/197
return None
key = ".".join(dict_keys[1:])
@@ -1220,7 +1231,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:])
@@ -1271,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type):
xml_name = internal_type_xml_map.get("name", internal_type.__name__)
xml_ns = internal_type_xml_map.get("ns", None)
if xml_ns:
- xml_name = "{}{}".format(xml_ns, xml_name)
+ xml_name = "{{{}}}{}".format(xml_ns, xml_name)
return xml_name
@@ -1295,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data):
# Integrate namespace if necessary
xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None))
if xml_ns:
- xml_name = "{}{}".format(xml_ns, xml_name)
+ xml_name = "{{{}}}{}".format(xml_ns, xml_name)
# If it's an attribute, that's simple
if xml_desc.get("attr", False):
@@ -1361,7 +1371,7 @@ class Deserializer(object):
valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?")
- def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
+ def __init__(self, classes: Optional[Mapping[str, type]]=None):
self.deserialize_type = {
"iso-8601": Deserializer.deserialize_iso,
"rfc-1123": Deserializer.deserialize_rfc,
@@ -1381,7 +1391,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
@@ -1434,12 +1444,12 @@ def _deserialize(self, target_obj, data):
response, class_name = self._classify_target(target_obj, data)
- if isinstance(response, basestring):
+ if isinstance(response, str):
return self.deserialize_data(data, response)
elif isinstance(response, type) and issubclass(response, Enum):
return self.deserialize_enum(data, response)
- if data is None:
+ if data is None or data is CoreNull:
return data
try:
attributes = response._attribute_map # type: ignore
@@ -1471,7 +1481,7 @@ def _deserialize(self, target_obj, data):
d_attrs[attr] = value
except (AttributeError, TypeError, KeyError) as err:
msg = "Unable to deserialize to object: " + class_name # type: ignore
- raise_with_traceback(DeserializationError, msg, err)
+ raise DeserializationError(msg) from err
else:
additional_properties = self._build_additional_properties(attributes, data)
return self._instantiate_model(response, d_attrs, additional_properties)
@@ -1505,14 +1515,14 @@ def _classify_target(self, target, data):
if target is None:
return None, None
- if isinstance(target, basestring):
+ if isinstance(target, str):
try:
target = self.dependencies[target]
except KeyError:
return target, target
try:
- target = target._classify(data, self.dependencies)
+ target = target._classify(data, self.dependencies) # type: ignore
except AttributeError:
pass # Target is not a Model, no classify
return target, target.__class__.__name__ # type: ignore
@@ -1568,7 +1578,7 @@ def _unpack_content(raw_data, content_type=None):
if hasattr(raw_data, "_content_consumed"):
return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers)
- if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"):
+ if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"):
return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore
return raw_data
@@ -1642,7 +1652,7 @@ def deserialize_data(self, data, data_type):
except (ValueError, TypeError, AttributeError) as err:
msg = "Unable to deserialize response data."
msg += " Data: {}, {}".format(data, data_type)
- raise_with_traceback(DeserializationError, msg, err)
+ raise DeserializationError(msg) from err
else:
return self._deserialize(obj_type, data)
@@ -1690,7 +1700,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:
@@ -1747,7 +1757,7 @@ def deserialize_basic(self, attr, data_type):
if data_type == "bool":
if attr in [True, False, 1, 0]:
return bool(attr)
- elif isinstance(attr, basestring):
+ elif isinstance(attr, str):
if attr.lower() in ["true", "1"]:
return True
elif attr.lower() in ["false", "0"]:
@@ -1798,7 +1808,6 @@ def deserialize_enum(data, enum_obj):
data = data.value
if isinstance(data, int):
# Workaround. We might consider remove it in the future.
- # https://github.com/Azure/azure-rest-api-specs/issues/141
try:
return list(enum_obj.__members__.values())[data]
except IndexError:
@@ -1852,10 +1861,10 @@ def deserialize_decimal(attr):
if isinstance(attr, ET.Element):
attr = attr.text
try:
- return decimal.Decimal(attr) # type: ignore
+ return decimal.Decimal(str(attr)) # type: ignore
except decimal.DecimalException as err:
msg = "Invalid decimal {}".format(attr)
- raise_with_traceback(DeserializationError, msg, err)
+ raise DeserializationError(msg) from err
@staticmethod
def deserialize_long(attr):
@@ -1883,7 +1892,7 @@ def deserialize_duration(attr):
duration = isodate.parse_duration(attr)
except (ValueError, OverflowError, AttributeError) as err:
msg = "Cannot deserialize duration object."
- raise_with_traceback(DeserializationError, msg, err)
+ raise DeserializationError(msg) from err
else:
return duration
@@ -1900,7 +1909,7 @@ def deserialize_date(attr):
if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore
raise DeserializationError("Date must have only digits and -. Received: %s" % attr)
# This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception.
- return isodate.parse_date(attr, defaultmonth=None, defaultday=None)
+ return isodate.parse_date(attr, defaultmonth=0, defaultday=0)
@staticmethod
def deserialize_time(attr):
@@ -1935,7 +1944,7 @@ def deserialize_rfc(attr):
date_obj = date_obj.astimezone(tz=TZ_UTC)
except ValueError as err:
msg = "Cannot deserialize to rfc datetime object."
- raise_with_traceback(DeserializationError, msg, err)
+ raise DeserializationError(msg) from err
else:
return date_obj
@@ -1972,7 +1981,7 @@ def deserialize_iso(attr):
raise OverflowError("Hit max or min date")
except (ValueError, OverflowError, AttributeError) as err:
msg = "Cannot deserialize datetime object."
- raise_with_traceback(DeserializationError, msg, err)
+ raise DeserializationError(msg) from err
else:
return date_obj
@@ -1988,9 +1997,10 @@ def deserialize_unix(attr):
if isinstance(attr, ET.Element):
attr = int(attr.text) # type: ignore
try:
+ attr = int(attr)
date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC)
except ValueError as err:
msg = "Cannot deserialize to unix datetime object."
- raise_with_traceback(DeserializationError, msg, err)
+ raise DeserializationError(msg) from err
else:
return date_obj
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/__init__.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/__init__.py
index f8cd7276168f..c247eefbacdd 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/__init__.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/__init__.py
@@ -7,5 +7,4 @@
# --------------------------------------------------------------------------
from ._app_configuration_management_client import AppConfigurationManagementClient
-
-__all__ = ["AppConfigurationManagementClient"]
+__all__ = ['AppConfigurationManagementClient']
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_app_configuration_management_client.py
index ae76cade6bfc..6983f91174a4 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_app_configuration_management_client.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_app_configuration_management_client.py
@@ -10,8 +10,11 @@
# --------------------------------------------------------------------------
from typing import Any, Optional, TYPE_CHECKING
+from typing_extensions import Self
+from azure.core.pipeline import policies
from azure.mgmt.core import AsyncARMPipelineClient
+from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
@@ -22,7 +25,6 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-
class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
@@ -30,7 +32,6 @@ def __init__(self, *args, **kwargs):
"""
pass
-
class AppConfigurationManagementClient(MultiApiClientMixin, _SDKClient):
"""AppConfigurationManagementClient.
@@ -55,15 +56,13 @@ class AppConfigurationManagementClient(MultiApiClientMixin, _SDKClient):
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""
- DEFAULT_API_VERSION = "2023-03-01"
+ DEFAULT_API_VERSION = '2023-03-01'
_PROFILE_TAG = "azure.mgmt.appconfiguration.AppConfigurationManagementClient"
- LATEST_PROFILE = ProfileDefinition(
- {
- _PROFILE_TAG: {
- None: DEFAULT_API_VERSION,
- }
- },
- _PROFILE_TAG + " latest",
+ LATEST_PROFILE = ProfileDefinition({
+ _PROFILE_TAG: {
+ None: DEFAULT_API_VERSION,
+ }},
+ _PROFILE_TAG + " latest"
)
def __init__(
@@ -75,9 +74,32 @@ def __init__(
profile: KnownProfiles = KnownProfiles.default,
**kwargs: Any
) -> None:
+ if api_version:
+ kwargs.setdefault('api_version', api_version)
self._config = AppConfigurationManagementClientConfiguration(credential, subscription_id, **kwargs)
- self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
- super(AppConfigurationManagementClient, self).__init__(api_version=api_version, profile=profile)
+ _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(base_url=base_url, policies=_policies, **kwargs)
+ super(AppConfigurationManagementClient, self).__init__(
+ api_version=api_version,
+ profile=profile
+ )
@classmethod
def _models_dict(cls, api_version):
@@ -87,21 +109,18 @@ def _models_dict(cls, api_version):
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
- * 2022-03-01-preview: :mod:`v2022_03_01_preview.models`
- * 2022-05-01: :mod:`v2022_05_01.models`
- * 2023-03-01: :mod:`v2023_03_01.models`
+ * 2022-03-01-preview: :mod:`v2022_03_01_preview.models`
+ * 2022-05-01: :mod:`v2022_05_01.models`
+ * 2023-03-01: :mod:`v2023_03_01.models`
"""
- if api_version == "2022-03-01-preview":
+ if api_version == '2022-03-01-preview':
from ..v2022_03_01_preview import models
-
return models
- elif api_version == "2022-05-01":
+ elif api_version == '2022-05-01':
from ..v2022_05_01 import models
-
return models
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from ..v2023_03_01 import models
-
return models
raise ValueError("API version {} is not available".format(api_version))
@@ -109,159 +128,123 @@ def models(cls, api_version=DEFAULT_API_VERSION):
def configuration_stores(self):
"""Instance depends on the API version:
- * 2022-03-01-preview: :class:`ConfigurationStoresOperations`
- * 2022-05-01: :class:`ConfigurationStoresOperations`
- * 2023-03-01: :class:`ConfigurationStoresOperations`
+ * 2022-03-01-preview: :class:`ConfigurationStoresOperations`
+ * 2022-05-01: :class:`ConfigurationStoresOperations`
+ * 2023-03-01: :class:`ConfigurationStoresOperations`
"""
- api_version = self._get_api_version("configuration_stores")
- if api_version == "2022-03-01-preview":
+ api_version = self._get_api_version('configuration_stores')
+ if api_version == '2022-03-01-preview':
from ..v2022_03_01_preview.aio.operations import ConfigurationStoresOperations as OperationClass
- elif api_version == "2022-05-01":
+ elif api_version == '2022-05-01':
from ..v2022_05_01.aio.operations import ConfigurationStoresOperations as OperationClass
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from ..v2023_03_01.aio.operations import ConfigurationStoresOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'configuration_stores'".format(api_version))
self._config.api_version = api_version
- return OperationClass(
- self._client,
- self._config,
- Serializer(self._models_dict(api_version)),
- Deserializer(self._models_dict(api_version)),
- )
+ return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
@property
def key_values(self):
"""Instance depends on the API version:
- * 2022-03-01-preview: :class:`KeyValuesOperations`
- * 2022-05-01: :class:`KeyValuesOperations`
- * 2023-03-01: :class:`KeyValuesOperations`
+ * 2022-03-01-preview: :class:`KeyValuesOperations`
+ * 2022-05-01: :class:`KeyValuesOperations`
+ * 2023-03-01: :class:`KeyValuesOperations`
"""
- api_version = self._get_api_version("key_values")
- if api_version == "2022-03-01-preview":
+ api_version = self._get_api_version('key_values')
+ if api_version == '2022-03-01-preview':
from ..v2022_03_01_preview.aio.operations import KeyValuesOperations as OperationClass
- elif api_version == "2022-05-01":
+ elif api_version == '2022-05-01':
from ..v2022_05_01.aio.operations import KeyValuesOperations as OperationClass
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from ..v2023_03_01.aio.operations import KeyValuesOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'key_values'".format(api_version))
self._config.api_version = api_version
- return OperationClass(
- self._client,
- self._config,
- Serializer(self._models_dict(api_version)),
- Deserializer(self._models_dict(api_version)),
- )
+ return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
@property
def operations(self):
"""Instance depends on the API version:
- * 2022-03-01-preview: :class:`Operations`
- * 2022-05-01: :class:`Operations`
- * 2023-03-01: :class:`Operations`
+ * 2022-03-01-preview: :class:`Operations`
+ * 2022-05-01: :class:`Operations`
+ * 2023-03-01: :class:`Operations`
"""
- api_version = self._get_api_version("operations")
- if api_version == "2022-03-01-preview":
+ api_version = self._get_api_version('operations')
+ if api_version == '2022-03-01-preview':
from ..v2022_03_01_preview.aio.operations import Operations as OperationClass
- elif api_version == "2022-05-01":
+ elif api_version == '2022-05-01':
from ..v2022_05_01.aio.operations import Operations as OperationClass
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from ..v2023_03_01.aio.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
self._config.api_version = api_version
- return OperationClass(
- self._client,
- self._config,
- Serializer(self._models_dict(api_version)),
- Deserializer(self._models_dict(api_version)),
- )
+ return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
@property
def private_endpoint_connections(self):
"""Instance depends on the API version:
- * 2022-03-01-preview: :class:`PrivateEndpointConnectionsOperations`
- * 2022-05-01: :class:`PrivateEndpointConnectionsOperations`
- * 2023-03-01: :class:`PrivateEndpointConnectionsOperations`
+ * 2022-03-01-preview: :class:`PrivateEndpointConnectionsOperations`
+ * 2022-05-01: :class:`PrivateEndpointConnectionsOperations`
+ * 2023-03-01: :class:`PrivateEndpointConnectionsOperations`
"""
- api_version = self._get_api_version("private_endpoint_connections")
- if api_version == "2022-03-01-preview":
+ api_version = self._get_api_version('private_endpoint_connections')
+ if api_version == '2022-03-01-preview':
from ..v2022_03_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass
- elif api_version == "2022-05-01":
+ elif api_version == '2022-05-01':
from ..v2022_05_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from ..v2023_03_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass
else:
- raise ValueError(
- "API version {} does not have operation group 'private_endpoint_connections'".format(api_version)
- )
+ raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version))
self._config.api_version = api_version
- return OperationClass(
- self._client,
- self._config,
- Serializer(self._models_dict(api_version)),
- Deserializer(self._models_dict(api_version)),
- )
+ return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
@property
def private_link_resources(self):
"""Instance depends on the API version:
- * 2022-03-01-preview: :class:`PrivateLinkResourcesOperations`
- * 2022-05-01: :class:`PrivateLinkResourcesOperations`
- * 2023-03-01: :class:`PrivateLinkResourcesOperations`
+ * 2022-03-01-preview: :class:`PrivateLinkResourcesOperations`
+ * 2022-05-01: :class:`PrivateLinkResourcesOperations`
+ * 2023-03-01: :class:`PrivateLinkResourcesOperations`
"""
- api_version = self._get_api_version("private_link_resources")
- if api_version == "2022-03-01-preview":
+ api_version = self._get_api_version('private_link_resources')
+ if api_version == '2022-03-01-preview':
from ..v2022_03_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass
- elif api_version == "2022-05-01":
+ elif api_version == '2022-05-01':
from ..v2022_05_01.aio.operations import PrivateLinkResourcesOperations as OperationClass
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from ..v2023_03_01.aio.operations import PrivateLinkResourcesOperations as OperationClass
else:
- raise ValueError(
- "API version {} does not have operation group 'private_link_resources'".format(api_version)
- )
+ raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version))
self._config.api_version = api_version
- return OperationClass(
- self._client,
- self._config,
- Serializer(self._models_dict(api_version)),
- Deserializer(self._models_dict(api_version)),
- )
+ return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
@property
def replicas(self):
"""Instance depends on the API version:
- * 2022-03-01-preview: :class:`ReplicasOperations`
- * 2023-03-01: :class:`ReplicasOperations`
+ * 2022-03-01-preview: :class:`ReplicasOperations`
+ * 2023-03-01: :class:`ReplicasOperations`
"""
- api_version = self._get_api_version("replicas")
- if api_version == "2022-03-01-preview":
+ api_version = self._get_api_version('replicas')
+ if api_version == '2022-03-01-preview':
from ..v2022_03_01_preview.aio.operations import ReplicasOperations as OperationClass
- elif api_version == "2023-03-01":
+ elif api_version == '2023-03-01':
from ..v2023_03_01.aio.operations import ReplicasOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'replicas'".format(api_version))
self._config.api_version = api_version
- return OperationClass(
- self._client,
- self._config,
- Serializer(self._models_dict(api_version)),
- Deserializer(self._models_dict(api_version)),
- )
+ return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)
async def close(self):
await self._client.close()
-
async def __aenter__(self):
await self._client.__aenter__()
return self
-
async def __aexit__(self, *exc_details):
await self._client.__aexit__(*exc_details)
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_configuration.py
index 4908cc856a4f..3de847e3d248 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_configuration.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/aio/_configuration.py
@@ -10,7 +10,6 @@
# --------------------------------------------------------------------------
from typing import Any, TYPE_CHECKING
-from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
@@ -20,8 +19,7 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-
-class AppConfigurationManagementClientConfiguration(Configuration):
+class AppConfigurationManagementClientConfiguration:
"""Configuration for AppConfigurationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -33,30 +31,36 @@ class AppConfigurationManagementClientConfiguration(Configuration):
:type subscription_id: str
"""
- def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
+ def __init__(
+ self,
+ credential: "AsyncTokenCredential",
+ subscription_id: str,
+ **kwargs: Any
+ ) -> None:
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
- super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs)
self.credential = credential
self.subscription_id = subscription_id
- self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
- kwargs.setdefault("sdk_moniker", "azure-mgmt-appconfiguration/{}".format(VERSION))
+ self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
+ kwargs.setdefault('sdk_moniker', 'azure-mgmt-appconfiguration/{}'.format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
- def _configure(self, **kwargs: Any) -> None:
- self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
- self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
- self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
- self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
- self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
- self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
- self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
- self.authentication_policy = kwargs.get("authentication_policy")
+ def _configure(
+ self,
+ **kwargs: Any
+ ) -> None:
+ self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
+ self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
+ self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
+ self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
+ self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
+ self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
+ self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
+ self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
+ self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
- self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
- self.credential, *self.credential_scopes, **kwargs
- )
+ self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_app_configuration_management_client.py
index 3781cabeec0b..ca90cfd9b81e 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_app_configuration_management_client.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_app_configuration_management_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 .._serialization import Deserializer, Serializer
@@ -72,26 +75,50 @@ def __init__(
self._config = AppConfigurationManagementClientConfiguration(
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)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.configuration_stores = ConfigurationStoresOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview"
+ )
+ self.operations = Operations(
+ self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview"
)
- self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview"
)
self.private_link_resources = PrivateLinkResourcesOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview"
+ )
+ self.key_values = KeyValuesOperations(
+ self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview"
+ )
+ self.replicas = ReplicasOperations(
+ self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview"
)
- self.key_values = KeyValuesOperations(self._client, self._config, self._serialize, self._deserialize)
- self.replicas = ReplicasOperations(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
@@ -111,12 +138,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) -> "AppConfigurationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_configuration.py
index d16a062141c3..19276dfd6acd 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_configuration.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_configuration.py
@@ -6,26 +6,19 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-import sys
from typing import Any, TYPE_CHECKING
-from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
from ._version import VERSION
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AppConfigurationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AppConfigurationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AppConfigurationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -41,8 +34,7 @@ class AppConfigurationManagementClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs)
- api_version: Literal["2022-03-01-preview"] = kwargs.pop("api_version", "2022-03-01-preview")
+ api_version: str = kwargs.pop("api_version", "2022-03-01-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@@ -54,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-appconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -62,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_metadata.json b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_metadata.json
index b5214a5c0893..430e7c8c0ca5 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_metadata.json
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_lro_operations": true,
"client_side_validation": false,
- "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
- "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"credential_scopes": ["https://management.azure.com/.default"],
"credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
"credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
- "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
- "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"configuration_stores": "ConfigurationStoresOperations",
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_vendor.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_vendor.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# --------------------------------------------------------------------------
-# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for license information.
-# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is regenerated.
-# --------------------------------------------------------------------------
-
-from typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_version.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_version.py
index cac9f5d10f8b..e5754a47ce68 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_version.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_app_configuration_management_client.py
index 0c62a97f3007..fa623c2fb5b5 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_app_configuration_management_client.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_app_configuration_management_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
@@ -72,26 +75,52 @@ def __init__(
self._config = AppConfigurationManagementClientConfiguration(
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)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.configuration_stores = ConfigurationStoresOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview"
+ )
+ self.operations = Operations(
+ self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview"
)
- self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview"
)
self.private_link_resources = PrivateLinkResourcesOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview"
+ )
+ self.key_values = KeyValuesOperations(
+ self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview"
+ )
+ self.replicas = ReplicasOperations(
+ self._client, self._config, self._serialize, self._deserialize, "2022-03-01-preview"
)
- self.key_values = KeyValuesOperations(self._client, self._config, self._serialize, self._deserialize)
- self.replicas = ReplicasOperations(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
@@ -111,12 +140,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) -> "AppConfigurationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_configuration.py
index 2474c7d8abd6..a0de53e4a3b5 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_configuration.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/_configuration.py
@@ -6,26 +6,19 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-import sys
from typing import Any, TYPE_CHECKING
-from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AppConfigurationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AppConfigurationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AppConfigurationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -41,8 +34,7 @@ class AppConfigurationManagementClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs)
- api_version: Literal["2022-03-01-preview"] = kwargs.pop("api_version", "2022-03-01-preview")
+ api_version: str = kwargs.pop("api_version", "2022-03-01-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@@ -54,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-appconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -62,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_configuration_stores_operations.py
index c1982191b596..1cd37fb119c6 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_configuration_stores_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_configuration_stores_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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._configuration_stores_operations import (
build_create_request,
build_delete_request,
@@ -45,10 +46,10 @@
build_update_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -71,6 +72,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.ConfigurationStore"]:
@@ -81,7 +83,6 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConfigurationStore or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore]
@@ -90,12 +91,12 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,16 +107,14 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
skip_token=skip_token,
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
@@ -126,14 +125,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response)
@@ -143,11 +141,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
@@ -160,8 +158,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"}
-
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any
@@ -176,7 +172,6 @@ def list_by_resource_group(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConfigurationStore or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore]
@@ -185,12 +180,12 @@ def list_by_resource_group(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -201,17 +196,15 @@ def list_by_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_resource_group_request(
+ _request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
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
@@ -222,14 +215,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response)
@@ -239,11 +231,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
@@ -256,10 +248,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/Microsoft.AppConfiguration/configurationStores"
- }
-
@distributed_trace_async
async def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore:
"""Gets the properties of the specified configuration store.
@@ -269,12 +257,11 @@ async def get(self, resource_group_name: str, config_store_name: str, **kwargs:
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ConfigurationStore or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -285,26 +272,24 @@ async def get(self, resource_group_name: str, config_store_name: str, **kwargs:
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_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
@@ -314,25 +299,21 @@ async def get(self, resource_group_name: str, config_store_name: str, **kwargs:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
async def _create_initial(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: Union[_models.ConfigurationStore, IO],
+ config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]],
**kwargs: Any
- ) -> _models.ConfigurationStore:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -343,21 +324,21 @@ async def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(config_store_creation_parameters, (IO, bytes)):
+ if isinstance(config_store_creation_parameters, (IOBase, bytes)):
_content = config_store_creation_parameters
else:
_json = self._serialize.body(config_store_creation_parameters, "ConfigurationStore")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -365,40 +346,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_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("ConfigurationStore", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ConfigurationStore", 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_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
-
@overload
async def begin_create(
self,
@@ -423,14 +399,6 @@ async def begin_create(
: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 ConfigurationStore or the result of
cls(response)
:rtype:
@@ -443,7 +411,7 @@ async def begin_create(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: IO,
+ config_store_creation_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -457,18 +425,10 @@ async def begin_create(
:type config_store_name: str
:param config_store_creation_parameters: The parameters for creating a configuration store.
Required.
- :type config_store_creation_parameters: IO
+ :type config_store_creation_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -481,7 +441,7 @@ async def begin_create(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: Union[_models.ConfigurationStore, IO],
+ config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationStore]:
"""Creates a configuration store with the specified parameters.
@@ -492,20 +452,9 @@ async def begin_create(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param config_store_creation_parameters: The parameters for creating a configuration store. Is
- either a ConfigurationStore type or a IO type. Required.
+ either a ConfigurationStore type or a IO[bytes] type. Required.
:type config_store_creation_parameters:
- ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore 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.appconfiguration.v2022_03_01_preview.models.ConfigurationStore or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -515,8 +464,8 @@ async def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
@@ -535,12 +484,13 @@ async def begin_create(
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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -550,22 +500,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.ConfigurationStore].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.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return AsyncLROPoller[_models.ConfigurationStore](
+ 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, config_store_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -576,41 +524,44 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
- 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,
config_store_name=config_store_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -623,14 +574,6 @@ async def begin_delete(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_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:
@@ -638,15 +581,15 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
api_version=api_version,
@@ -655,11 +598,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -668,26 +612,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _update_initial(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO],
+ config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.ConfigurationStore:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -698,21 +638,21 @@ async def _update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(config_store_update_parameters, (IO, bytes)):
+ if isinstance(config_store_update_parameters, (IOBase, bytes)):
_content = config_store_update_parameters
else:
_json = self._serialize.body(config_store_update_parameters, "ConfigurationStoreUpdateParameters")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -720,40 +660,35 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._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("ConfigurationStore", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ConfigurationStore", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
-
@overload
async def begin_update(
self,
@@ -778,14 +713,6 @@ async def begin_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 ConfigurationStore or the result of
cls(response)
:rtype:
@@ -798,7 +725,7 @@ async def begin_update(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: IO,
+ config_store_update_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -812,18 +739,10 @@ async def begin_update(
:type config_store_name: str
:param config_store_update_parameters: The parameters for updating a configuration store.
Required.
- :type config_store_update_parameters: IO
+ :type config_store_update_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -836,7 +755,7 @@ async def begin_update(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO],
+ config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationStore]:
"""Updates a configuration store with the specified parameters.
@@ -847,21 +766,10 @@ async def begin_update(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param config_store_update_parameters: The parameters for updating a configuration store. Is
- either a ConfigurationStoreUpdateParameters type or a IO type. Required.
+ either a ConfigurationStoreUpdateParameters type or a IO[bytes] type. Required.
:type config_store_update_parameters:
~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStoreUpdateParameters 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.
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -871,8 +779,8 @@ async def begin_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
@@ -891,12 +799,13 @@ async def begin_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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -906,17 +815,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.ConfigurationStore].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_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return AsyncLROPoller[_models.ConfigurationStore](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list_keys(
@@ -934,7 +841,6 @@ def list_keys(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ApiKey or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey]
@@ -943,12 +849,12 @@ def list_keys(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.ApiKeyListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -959,18 +865,16 @@ def list_keys(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_keys_request(
+ _request = build_list_keys_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_keys.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
@@ -981,14 +885,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ApiKeyListResult", pipeline_response)
@@ -998,11 +901,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
@@ -1015,10 +918,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_keys.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys"
- }
-
@overload
async def regenerate_key(
self,
@@ -1042,7 +941,6 @@ async def regenerate_key(
: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: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1053,7 +951,7 @@ async def regenerate_key(
self,
resource_group_name: str,
config_store_name: str,
- regenerate_key_parameters: IO,
+ regenerate_key_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1066,11 +964,10 @@ async def regenerate_key(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param regenerate_key_parameters: The parameters for regenerating an access key. Required.
- :type regenerate_key_parameters: IO
+ :type regenerate_key_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1081,7 +978,7 @@ async def regenerate_key(
self,
resource_group_name: str,
config_store_name: str,
- regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO],
+ regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO[bytes]],
**kwargs: Any
) -> _models.ApiKey:
"""Regenerates an access key for the specified configuration store.
@@ -1092,18 +989,14 @@ async def regenerate_key(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param regenerate_key_parameters: The parameters for regenerating an access key. Is either a
- RegenerateKeyParameters type or a IO type. Required.
+ RegenerateKeyParameters type or a IO[bytes] type. Required.
:type regenerate_key_parameters:
- ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.RegenerateKeyParameters 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
+ ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.RegenerateKeyParameters or IO[bytes]
:return: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1114,8 +1007,8 @@ async def regenerate_key(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None)
@@ -1123,12 +1016,12 @@ async def regenerate_key(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(regenerate_key_parameters, (IO, bytes)):
+ if isinstance(regenerate_key_parameters, (IOBase, bytes)):
_content = regenerate_key_parameters
else:
_json = self._serialize.body(regenerate_key_parameters, "RegenerateKeyParameters")
- request = build_regenerate_key_request(
+ _request = build_regenerate_key_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -1136,16 +1029,14 @@ async def regenerate_key(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.regenerate_key.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
@@ -1155,22 +1046,17 @@ async def regenerate_key(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiKey", pipeline_response)
+ deserialized = self._deserialize("ApiKey", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- regenerate_key.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_deleted(self, **kwargs: Any) -> AsyncIterable["_models.DeletedConfigurationStore"]:
"""Gets information about the deleted configuration stores in a subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DeletedConfigurationStore or the result of
cls(response)
:rtype:
@@ -1180,12 +1066,12 @@ def list_deleted(self, **kwargs: Any) -> AsyncIterable["_models.DeletedConfigura
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.DeletedConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1196,15 +1082,13 @@ def list_deleted(self, **kwargs: Any) -> AsyncIterable["_models.DeletedConfigura
def prepare_request(next_link=None):
if not next_link:
- request = build_list_deleted_request(
+ _request = build_list_deleted_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_deleted.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
@@ -1215,14 +1099,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DeletedConfigurationStoreListResult", pipeline_response)
@@ -1232,11 +1115,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
@@ -1249,10 +1132,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores"
- }
-
@distributed_trace_async
async def get_deleted(
self, location: str, config_store_name: str, **kwargs: Any
@@ -1263,12 +1142,11 @@ async def get_deleted(
:type location: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DeletedConfigurationStore or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.DeletedConfigurationStore
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1279,26 +1157,24 @@ async def get_deleted(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None)
- request = build_get_deleted_request(
+ _request = build_get_deleted_request(
location=location,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_deleted.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
@@ -1308,21 +1184,17 @@ async def get_deleted(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
- async def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements
+ async def _purge_deleted_initial(
self, location: str, config_store_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1333,41 +1205,44 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_purge_deleted_request(
+ _request = build_purge_deleted_request(
location=location,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self._purge_deleted_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
- _purge_deleted_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
@@ -1377,14 +1252,6 @@ async def begin_purge_deleted(self, location: str, config_store_name: str, **kwa
:type location: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_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:
@@ -1392,15 +1259,15 @@ async def begin_purge_deleted(self, location: str, config_store_name: str, **kwa
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._purge_deleted_initial( # type: ignore
+ raw_result = await self._purge_deleted_initial(
location=location,
config_store_name=config_store_name,
api_version=api_version,
@@ -1409,11 +1276,12 @@ async def begin_purge_deleted(self, location: str, config_store_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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -1422,14 +1290,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_purge_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_key_values_operations.py
index 085b2b9749f2..eca14e97d8fa 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_key_values_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_key_values_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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._key_values_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,10 +39,10 @@
build_list_by_configuration_store_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -81,7 +83,6 @@ def list_by_configuration_store(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either KeyValue or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue]
@@ -90,12 +91,12 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.KeyValueListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,18 +107,16 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -128,14 +127,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("KeyValueListResult", pipeline_response)
@@ -145,11 +143,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
@@ -162,10 +160,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues"
- }
-
@distributed_trace_async
async def get(
self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any
@@ -180,12 +174,11 @@ async def get(
:param key_value_name: Identifier of key and label combination. Key and label are joined by $
character. Label is optional. Required.
:type key_value_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -196,27 +189,25 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_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
@@ -226,16 +217,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KeyValue", pipeline_response)
+ deserialized = self._deserialize("KeyValue", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -263,7 +250,6 @@ async def 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
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
@@ -275,7 +261,7 @@ async def create_or_update(
resource_group_name: str,
config_store_name: str,
key_value_name: str,
- key_value_parameters: Optional[IO] = None,
+ key_value_parameters: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -291,11 +277,10 @@ async def create_or_update(
character. Label is optional. Required.
:type key_value_name: str
:param key_value_parameters: The parameters for creating a key-value. Default value is None.
- :type key_value_parameters: IO
+ :type key_value_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
@@ -307,7 +292,7 @@ async def create_or_update(
resource_group_name: str,
config_store_name: str,
key_value_name: str,
- key_value_parameters: Optional[Union[_models.KeyValue, IO]] = None,
+ key_value_parameters: Optional[Union[_models.KeyValue, IO[bytes]]] = None,
**kwargs: Any
) -> _models.KeyValue:
"""Creates a key-value.
@@ -321,18 +306,14 @@ async def create_or_update(
character. Label is optional. Required.
:type key_value_name: str
:param key_value_parameters: The parameters for creating a key-value. Is either a KeyValue type
- or a IO type. Default value is None.
+ or a IO[bytes] type. Default value is None.
:type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -343,8 +324,8 @@ async def create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None)
@@ -352,7 +333,7 @@ async def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(key_value_parameters, (IO, bytes)):
+ if isinstance(key_value_parameters, (IOBase, bytes)):
_content = key_value_parameters
else:
if key_value_parameters is not None:
@@ -360,7 +341,7 @@ async def create_or_update(
else:
_json = None
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_name,
@@ -369,16 +350,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -388,21 +367,17 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KeyValue", pipeline_response)
+ deserialized = self._deserialize("KeyValue", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -413,42 +388,45 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
- 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,
config_store_name=config_store_name,
key_value_name=key_value_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -464,14 +442,6 @@ async def begin_delete(
:param key_value_name: Identifier of key and label combination. Key and label are joined by $
character. Label is optional. Required.
:type key_value_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:
@@ -479,15 +449,15 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_name,
@@ -497,11 +467,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -510,14 +481,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_operations.py
index 65309c9afced..d33b3346e445 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,25 +21,23 @@
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._operations import (
build_check_name_availability_request,
build_list_request,
build_regional_check_name_availability_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -61,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@overload
async def check_name_availability(
@@ -79,7 +79,6 @@ async def check_name_availability(
: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: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -87,17 +86,16 @@ async def check_name_availability(
@overload
async def check_name_availability(
- self, check_name_availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, check_name_availability_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
:param check_name_availability_parameters: The object containing information for the
availability request. Required.
- :type check_name_availability_parameters: IO
+ :type check_name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -105,23 +103,23 @@ async def check_name_availability(
@distributed_trace_async
async def check_name_availability(
- self, check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any
+ self,
+ check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
:param check_name_availability_parameters: The object containing information for the
- availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required.
+ availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type.
+ Required.
:type check_name_availability_parameters:
- ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters 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
+ ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters or
+ IO[bytes]
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -132,8 +130,8 @@ async def check_name_availability(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None)
@@ -141,27 +139,25 @@ async def check_name_availability(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(check_name_availability_parameters, (IO, bytes)):
+ if isinstance(check_name_availability_parameters, (IOBase, bytes)):
_content = check_name_availability_parameters
else:
_json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters")
- request = build_check_name_availability_request(
+ _request = build_check_name_availability_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.check_name_availability.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
@@ -171,16 +167,12 @@ async def check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response)
+ deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- check_name_availability.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.OperationDefinition"]:
@@ -191,7 +183,6 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationDefinition or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.OperationDefinition]
@@ -200,12 +191,12 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.OperationDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -216,15 +207,13 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
skip_token=skip_token,
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
@@ -235,14 +224,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationDefinitionListResult", pipeline_response)
@@ -252,11 +240,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
@@ -269,8 +257,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/providers/Microsoft.AppConfiguration/operations"}
-
@overload
async def regional_check_name_availability(
self,
@@ -291,7 +277,6 @@ async def regional_check_name_availability(
: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: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -301,7 +286,7 @@ async def regional_check_name_availability(
async def regional_check_name_availability(
self,
location: str,
- check_name_availability_parameters: IO,
+ check_name_availability_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -312,11 +297,10 @@ async def regional_check_name_availability(
:type location: str
:param check_name_availability_parameters: The object containing information for the
availability request. Required.
- :type check_name_availability_parameters: IO
+ :type check_name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -326,7 +310,7 @@ async def regional_check_name_availability(
async def regional_check_name_availability(
self,
location: str,
- check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO],
+ check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]],
**kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
@@ -334,18 +318,16 @@ async def regional_check_name_availability(
:param location: The location in which uniqueness will be verified. Required.
:type location: str
:param check_name_availability_parameters: The object containing information for the
- availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required.
+ availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type.
+ Required.
:type check_name_availability_parameters:
- ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters 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
+ ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters or
+ IO[bytes]
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -356,8 +338,8 @@ async def regional_check_name_availability(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None)
@@ -365,28 +347,26 @@ async def regional_check_name_availability(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(check_name_availability_parameters, (IO, bytes)):
+ if isinstance(check_name_availability_parameters, (IOBase, bytes)):
_content = check_name_availability_parameters
else:
_json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters")
- request = build_regional_check_name_availability_request(
+ _request = build_regional_check_name_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.regional_check_name_availability.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
@@ -396,13 +376,9 @@ async def regional_check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response)
+ deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- regional_check_name_availability.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability"
- }
+ return deserialized # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_endpoint_connections_operations.py
index 8b4f3a613864..7b2fdcd0a916 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_endpoint_connections_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_endpoint_connections_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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._private_endpoint_connections_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,10 +39,10 @@
build_list_by_configuration_store_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -76,7 +78,6 @@ def list_by_configuration_store(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateEndpointConnection or the result of
cls(response)
:rtype:
@@ -86,12 +87,12 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -102,17 +103,15 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -123,14 +122,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response)
@@ -140,11 +138,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
@@ -157,10 +155,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections"
- }
-
@distributed_trace_async
async def get(
self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any
@@ -174,12 +168,11 @@ async def get(
:type config_store_name: str
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -190,27 +183,25 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_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
@@ -220,26 +211,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("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO],
+ private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
- ) -> _models.PrivateEndpointConnection:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -250,21 +237,21 @@ async def _create_or_update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(private_endpoint_connection, (IO, bytes)):
+ if isinstance(private_endpoint_connection, (IOBase, bytes)):
_content = private_endpoint_connection
else:
_json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -273,40 +260,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("PrivateEndpointConnection", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
-
@overload
async def begin_create_or_update(
self,
@@ -334,14 +316,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 PrivateEndpointConnection or the
result of cls(response)
:rtype:
@@ -355,7 +329,7 @@ async def begin_create_or_update(
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: IO,
+ private_endpoint_connection: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -371,18 +345,10 @@ async def begin_create_or_update(
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
:param private_endpoint_connection: The private endpoint connection properties. Required.
- :type private_endpoint_connection: IO
+ :type private_endpoint_connection: 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 PrivateEndpointConnection or the
result of cls(response)
:rtype:
@@ -396,7 +362,7 @@ async def begin_create_or_update(
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO],
+ private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateEndpointConnection]:
"""Update the state of the specified private endpoint connection associated with the configuration
@@ -410,20 +376,9 @@ async def begin_create_or_update(
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
:param private_endpoint_connection: The private endpoint connection properties. Is either a
- PrivateEndpointConnection type or a IO type. Required.
+ PrivateEndpointConnection type or a IO[bytes] type. Required.
:type private_endpoint_connection:
- ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection 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.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection or IO[bytes]
:return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the
result of cls(response)
:rtype:
@@ -433,8 +388,8 @@ async def begin_create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
@@ -454,12 +409,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("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -469,22 +425,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return AsyncLROPoller[_models.PrivateEndpointConnection](
+ 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, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -495,42 +449,45 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
- 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,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -545,14 +502,6 @@ async def begin_delete(
:type config_store_name: str
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_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:
@@ -560,15 +509,15 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -578,11 +527,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -591,14 +541,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_link_resources_operations.py
index 8964f3240d9e..1d6611b44cbd 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_link_resources_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_private_link_resources_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +7,7 @@
# 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
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,24 +20,22 @@
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._private_link_resources_operations import (
build_get_request,
build_list_by_configuration_store_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -60,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -72,7 +71,6 @@ def list_by_configuration_store(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateLinkResource or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateLinkResource]
@@ -81,12 +79,12 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -97,17 +95,15 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_configuration_store.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,14 +114,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response)
@@ -135,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
@@ -152,10 +147,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources"
- }
-
@distributed_trace_async
async def get(
self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any
@@ -169,12 +160,11 @@ async def get(
:type config_store_name: str
:param group_name: The name of the private link resource group. Required.
:type group_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateLinkResource or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -185,27 +175,25 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
group_name=group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.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
@@ -215,13 +203,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResource", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_replicas_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_replicas_operations.py
index e01c863b0e0d..0da48f38664e 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_replicas_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/aio/operations/_replicas_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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._replicas_operations import (
build_create_request,
build_delete_request,
@@ -38,10 +39,10 @@
build_list_by_configuration_store_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -81,7 +83,6 @@ def list_by_configuration_store(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Replica or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica]
@@ -90,12 +91,12 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.ReplicaListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,18 +107,16 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -128,14 +127,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ReplicaListResult", pipeline_response)
@@ -145,11 +143,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
@@ -162,10 +160,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas"
- }
-
@distributed_trace_async
async def get(
self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any
@@ -179,12 +173,11 @@ async def get(
:type config_store_name: str
:param replica_name: The name of the replica. Required.
:type replica_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Replica or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -195,27 +188,25 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.Replica] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_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
@@ -225,26 +216,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("Replica", pipeline_response)
+ deserialized = self._deserialize("Replica", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return deserialized # type: ignore
async def _create_initial(
self,
resource_group_name: str,
config_store_name: str,
replica_name: str,
- replica_creation_parameters: Union[_models.Replica, IO],
+ replica_creation_parameters: Union[_models.Replica, IO[bytes]],
**kwargs: Any
- ) -> _models.Replica:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -255,21 +242,21 @@ async def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Replica] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(replica_creation_parameters, (IO, bytes)):
+ if isinstance(replica_creation_parameters, (IOBase, bytes)):
_content = replica_creation_parameters
else:
_json = self._serialize.body(replica_creation_parameters, "Replica")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_name,
@@ -278,40 +265,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_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("Replica", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Replica", 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_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
-
@overload
async def begin_create(
self,
@@ -338,14 +320,6 @@ async def begin_create(
: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 Replica or the result of
cls(response)
:rtype:
@@ -359,7 +333,7 @@ async def begin_create(
resource_group_name: str,
config_store_name: str,
replica_name: str,
- replica_creation_parameters: IO,
+ replica_creation_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -374,18 +348,10 @@ async def begin_create(
:param replica_name: The name of the replica. Required.
:type replica_name: str
:param replica_creation_parameters: The parameters for creating a replica. Required.
- :type replica_creation_parameters: IO
+ :type replica_creation_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Replica or the result of
cls(response)
:rtype:
@@ -399,7 +365,7 @@ async def begin_create(
resource_group_name: str,
config_store_name: str,
replica_name: str,
- replica_creation_parameters: Union[_models.Replica, IO],
+ replica_creation_parameters: Union[_models.Replica, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Replica]:
"""Creates a replica with the specified parameters.
@@ -412,20 +378,9 @@ async def begin_create(
:param replica_name: The name of the replica. Required.
:type replica_name: str
:param replica_creation_parameters: The parameters for creating a replica. Is either a Replica
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type replica_creation_parameters:
- ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica 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.appconfiguration.v2022_03_01_preview.models.Replica or IO[bytes]
:return: An instance of AsyncLROPoller that returns either Replica or the result of
cls(response)
:rtype:
@@ -435,8 +390,8 @@ async def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Replica] = kwargs.pop("cls", None)
@@ -456,12 +411,13 @@ async def begin_create(
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("Replica", pipeline_response)
+ deserialized = self._deserialize("Replica", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -471,22 +427,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Replica].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.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return AsyncLROPoller[_models.Replica](
+ 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, config_store_name: str, replica_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -497,42 +451,45 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
- 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,
config_store_name=config_store_name,
replica_name=replica_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -547,14 +504,6 @@ async def begin_delete(
:type config_store_name: str
:param replica_name: The name of the replica. Required.
:type replica_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:
@@ -562,15 +511,15 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_name,
@@ -580,11 +529,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(
@@ -595,14 +545,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_models_py3.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_models_py3.py
index baf2b907fdb3..785322db1fff 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_models_py3.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/models/_models_py3.py
@@ -97,7 +97,7 @@ def __init__(
class CheckNameAvailabilityParameters(_serialization.Model):
"""Parameters used for checking whether a resource name is available.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar name: The name to check for availability. Required.
:vartype name: str
@@ -137,7 +137,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
@@ -172,10 +172,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
@@ -221,10 +221,10 @@ class ConfigurationStore(TrackedResource): # pylint: disable=too-many-instance-
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. 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
@@ -1614,7 +1614,7 @@ class ResourceIdentity(_serialization.Model):
:vartype type: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.IdentityType
:ivar user_assigned_identities: The list of user-assigned identities associated with the
resource. The user-assigned identity dictionary keys will be ARM resource ids in the form:
- '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
+ '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long
:vartype user_assigned_identities: dict[str,
~azure.mgmt.appconfiguration.v2022_03_01_preview.models.UserIdentity]
:ivar principal_id: The principal id of the identity. This property will only be provided for a
@@ -1652,7 +1652,7 @@ def __init__(
:paramtype type: str or ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.IdentityType
:keyword user_assigned_identities: The list of user-assigned identities associated with the
resource. The user-assigned identity dictionary keys will be ARM resource ids in the form:
- '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
+ '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long
:paramtype user_assigned_identities: dict[str,
~azure.mgmt.appconfiguration.v2022_03_01_preview.models.UserIdentity]
"""
@@ -1702,7 +1702,7 @@ def __init__(
class Sku(_serialization.Model):
"""Describes a configuration store SKU.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar name: The SKU name of the configuration store. Required.
:vartype name: str
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_configuration_stores_operations.py
index 13ca9482f02d..0a22de8c3061 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_configuration_stores_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_configuration_stores_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, 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,12 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -47,9 +48,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -60,7 +59,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -79,9 +78,7 @@ def build_list_by_resource_group_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -94,7 +91,7 @@ def build_list_by_resource_group_request(
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -113,9 +110,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -131,7 +126,7 @@ def build_get_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -148,9 +143,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -167,7 +160,7 @@ def build_create_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -186,9 +179,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -204,7 +195,7 @@ def build_delete_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -221,9 +212,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -240,7 +229,7 @@ def build_update_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -264,9 +253,7 @@ def build_list_keys_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -282,7 +269,7 @@ def build_list_keys_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -301,9 +288,7 @@ def build_regenerate_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -320,7 +305,7 @@ def build_regenerate_key_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -337,9 +322,7 @@ def build_list_deleted_request(subscription_id: str, **kwargs: Any) -> HttpReque
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -351,7 +334,7 @@ def build_list_deleted_request(subscription_id: str, **kwargs: Any) -> HttpReque
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -368,9 +351,7 @@ def build_get_deleted_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -386,7 +367,7 @@ def build_get_deleted_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -403,9 +384,7 @@ def build_purge_deleted_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -421,7 +400,7 @@ def build_purge_deleted_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -450,6 +429,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ConfigurationStore"]:
@@ -460,7 +440,6 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConfigurationStore or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore]
@@ -469,12 +448,12 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -485,16 +464,14 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
skip_token=skip_token,
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
@@ -505,14 +482,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response)
@@ -522,11 +498,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
@@ -539,8 +515,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"}
-
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any
@@ -555,7 +529,6 @@ def list_by_resource_group(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConfigurationStore or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore]
@@ -564,12 +537,12 @@ def list_by_resource_group(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -580,17 +553,15 @@ def list_by_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_resource_group_request(
+ _request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
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
@@ -601,14 +572,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response)
@@ -618,11 +588,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
@@ -635,10 +605,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores"
- }
-
@distributed_trace
def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore:
"""Gets the properties of the specified configuration store.
@@ -648,12 +614,11 @@ def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ConfigurationStore or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -664,26 +629,24 @@ def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_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
@@ -693,25 +656,21 @@ def get(self, resource_group_name: str, config_store_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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
def _create_initial(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: Union[_models.ConfigurationStore, IO],
+ config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]],
**kwargs: Any
- ) -> _models.ConfigurationStore:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -722,21 +681,21 @@ def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(config_store_creation_parameters, (IO, bytes)):
+ if isinstance(config_store_creation_parameters, (IOBase, bytes)):
_content = config_store_creation_parameters
else:
_json = self._serialize.body(config_store_creation_parameters, "ConfigurationStore")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -744,40 +703,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_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("ConfigurationStore", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ConfigurationStore", 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_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
-
@overload
def begin_create(
self,
@@ -802,14 +756,6 @@ def begin_create(
: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 ConfigurationStore or the result of
cls(response)
:rtype:
@@ -822,7 +768,7 @@ def begin_create(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: IO,
+ config_store_creation_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -836,18 +782,10 @@ def begin_create(
:type config_store_name: str
:param config_store_creation_parameters: The parameters for creating a configuration store.
Required.
- :type config_store_creation_parameters: IO
+ :type config_store_creation_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -860,7 +798,7 @@ def begin_create(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: Union[_models.ConfigurationStore, IO],
+ config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ConfigurationStore]:
"""Creates a configuration store with the specified parameters.
@@ -871,20 +809,9 @@ def begin_create(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param config_store_creation_parameters: The parameters for creating a configuration store. Is
- either a ConfigurationStore type or a IO type. Required.
+ either a ConfigurationStore type or a IO[bytes] type. Required.
:type config_store_creation_parameters:
- ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStore 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.appconfiguration.v2022_03_01_preview.models.ConfigurationStore or IO[bytes]
:return: An instance of LROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -894,8 +821,8 @@ def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
@@ -914,12 +841,13 @@ def begin_create(
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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -929,22 +857,18 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.ConfigurationStore].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.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return LROPoller[_models.ConfigurationStore](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, config_store_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _delete_initial(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -955,41 +879,44 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
- 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,
config_store_name=config_store_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -1000,14 +927,6 @@ def begin_delete(self, resource_group_name: str, config_store_name: str, **kwarg
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_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:
@@ -1015,15 +934,15 @@ def begin_delete(self, resource_group_name: str, config_store_name: str, **kwarg
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
api_version=api_version,
@@ -1032,11 +951,12 @@ def begin_delete(self, resource_group_name: str, config_store_name: str, **kwarg
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(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -1045,26 +965,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _update_initial(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO],
+ config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.ConfigurationStore:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1075,21 +991,21 @@ def _update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(config_store_update_parameters, (IO, bytes)):
+ if isinstance(config_store_update_parameters, (IOBase, bytes)):
_content = config_store_update_parameters
else:
_json = self._serialize.body(config_store_update_parameters, "ConfigurationStoreUpdateParameters")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -1097,40 +1013,35 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._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("ConfigurationStore", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ConfigurationStore", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
-
@overload
def begin_update(
self,
@@ -1155,14 +1066,6 @@ def begin_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 ConfigurationStore or the result of
cls(response)
:rtype:
@@ -1175,7 +1078,7 @@ def begin_update(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: IO,
+ config_store_update_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1189,18 +1092,10 @@ def begin_update(
:type config_store_name: str
:param config_store_update_parameters: The parameters for updating a configuration store.
Required.
- :type config_store_update_parameters: IO
+ :type config_store_update_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -1213,7 +1108,7 @@ def begin_update(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO],
+ config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ConfigurationStore]:
"""Updates a configuration store with the specified parameters.
@@ -1224,21 +1119,10 @@ def begin_update(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param config_store_update_parameters: The parameters for updating a configuration store. Is
- either a ConfigurationStoreUpdateParameters type or a IO type. Required.
+ either a ConfigurationStoreUpdateParameters type or a IO[bytes] type. Required.
:type config_store_update_parameters:
~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ConfigurationStoreUpdateParameters 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.
+ IO[bytes]
:return: An instance of LROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -1248,8 +1132,8 @@ def begin_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
@@ -1268,12 +1152,13 @@ def begin_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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1283,17 +1168,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.ConfigurationStore].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_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return LROPoller[_models.ConfigurationStore](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list_keys(
@@ -1311,7 +1194,6 @@ def list_keys(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ApiKey or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey]
@@ -1320,12 +1202,12 @@ def list_keys(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.ApiKeyListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1336,18 +1218,16 @@ def list_keys(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_keys_request(
+ _request = build_list_keys_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_keys.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
@@ -1358,14 +1238,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ApiKeyListResult", pipeline_response)
@@ -1375,11 +1254,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
@@ -1392,10 +1271,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_keys.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys"
- }
-
@overload
def regenerate_key(
self,
@@ -1419,7 +1294,6 @@ def regenerate_key(
: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: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1430,7 +1304,7 @@ def regenerate_key(
self,
resource_group_name: str,
config_store_name: str,
- regenerate_key_parameters: IO,
+ regenerate_key_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1443,11 +1317,10 @@ def regenerate_key(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param regenerate_key_parameters: The parameters for regenerating an access key. Required.
- :type regenerate_key_parameters: IO
+ :type regenerate_key_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1458,7 +1331,7 @@ def regenerate_key(
self,
resource_group_name: str,
config_store_name: str,
- regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO],
+ regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO[bytes]],
**kwargs: Any
) -> _models.ApiKey:
"""Regenerates an access key for the specified configuration store.
@@ -1469,18 +1342,14 @@ def regenerate_key(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param regenerate_key_parameters: The parameters for regenerating an access key. Is either a
- RegenerateKeyParameters type or a IO type. Required.
+ RegenerateKeyParameters type or a IO[bytes] type. Required.
:type regenerate_key_parameters:
- ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.RegenerateKeyParameters 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
+ ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.RegenerateKeyParameters or IO[bytes]
:return: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1491,8 +1360,8 @@ def regenerate_key(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None)
@@ -1500,12 +1369,12 @@ def regenerate_key(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(regenerate_key_parameters, (IO, bytes)):
+ if isinstance(regenerate_key_parameters, (IOBase, bytes)):
_content = regenerate_key_parameters
else:
_json = self._serialize.body(regenerate_key_parameters, "RegenerateKeyParameters")
- request = build_regenerate_key_request(
+ _request = build_regenerate_key_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -1513,16 +1382,14 @@ def regenerate_key(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.regenerate_key.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
@@ -1532,22 +1399,17 @@ def regenerate_key(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiKey", pipeline_response)
+ deserialized = self._deserialize("ApiKey", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- regenerate_key.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_deleted(self, **kwargs: Any) -> Iterable["_models.DeletedConfigurationStore"]:
"""Gets information about the deleted configuration stores in a subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DeletedConfigurationStore or the result of
cls(response)
:rtype:
@@ -1557,12 +1419,12 @@ def list_deleted(self, **kwargs: Any) -> Iterable["_models.DeletedConfigurationS
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.DeletedConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1573,15 +1435,13 @@ def list_deleted(self, **kwargs: Any) -> Iterable["_models.DeletedConfigurationS
def prepare_request(next_link=None):
if not next_link:
- request = build_list_deleted_request(
+ _request = build_list_deleted_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_deleted.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
@@ -1592,14 +1452,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("DeletedConfigurationStoreListResult", pipeline_response)
@@ -1609,11 +1468,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
@@ -1626,10 +1485,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores"
- }
-
@distributed_trace
def get_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> _models.DeletedConfigurationStore:
"""Gets a deleted Azure app configuration store.
@@ -1638,12 +1493,11 @@ def get_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> _
:type location: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DeletedConfigurationStore or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.DeletedConfigurationStore
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1654,26 +1508,24 @@ def get_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> _
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None)
- request = build_get_deleted_request(
+ _request = build_get_deleted_request(
location=location,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_deleted.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
@@ -1683,21 +1535,15 @@ def get_deleted(self, location: str, config_store_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("DeletedConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
- def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements
- self, location: str, config_store_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _purge_deleted_initial(self, location: str, config_store_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1708,41 +1554,44 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_purge_deleted_request(
+ _request = build_purge_deleted_request(
location=location,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self._purge_deleted_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
- _purge_deleted_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -1752,14 +1601,6 @@ def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: A
:type location: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_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:
@@ -1767,15 +1608,15 @@ def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: A
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._purge_deleted_initial( # type: ignore
+ raw_result = self._purge_deleted_initial(
location=location,
config_store_name=config_store_name,
api_version=api_version,
@@ -1784,11 +1625,12 @@ def begin_purge_deleted(self, location: str, config_store_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(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -1797,14 +1639,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_purge_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_key_values_operations.py
index 0aca62ad1d5e..02357058eec8 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_key_values_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_key_values_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, 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,12 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +44,7 @@
_SERIALIZER.client_side_validation = False
-def build_list_by_configuration_store_request(
+def build_list_by_configuration_store_request( # pylint: disable=name-too-long
resource_group_name: str,
config_store_name: str,
subscription_id: str,
@@ -54,9 +55,7 @@ def build_list_by_configuration_store_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,7 +71,7 @@ def build_list_by_configuration_store_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -91,9 +90,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -110,7 +107,7 @@ def build_get_request(
"keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -127,9 +124,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -147,7 +142,7 @@ def build_create_or_update_request(
"keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -166,9 +161,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -185,7 +178,7 @@ def build_delete_request(
"keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -214,6 +207,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -231,7 +225,6 @@ def list_by_configuration_store(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either KeyValue or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue]
@@ -240,12 +233,12 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.KeyValueListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -256,18 +249,16 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -278,14 +269,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("KeyValueListResult", pipeline_response)
@@ -295,11 +285,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
@@ -312,10 +302,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues"
- }
-
@distributed_trace
def get(
self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any
@@ -330,12 +316,11 @@ def get(
:param key_value_name: Identifier of key and label combination. Key and label are joined by $
character. Label is optional. Required.
:type key_value_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -346,27 +331,25 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_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
@@ -376,16 +359,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KeyValue", pipeline_response)
+ deserialized = self._deserialize("KeyValue", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -413,7 +392,6 @@ def 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
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
@@ -425,7 +403,7 @@ def create_or_update(
resource_group_name: str,
config_store_name: str,
key_value_name: str,
- key_value_parameters: Optional[IO] = None,
+ key_value_parameters: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -441,11 +419,10 @@ def create_or_update(
character. Label is optional. Required.
:type key_value_name: str
:param key_value_parameters: The parameters for creating a key-value. Default value is None.
- :type key_value_parameters: IO
+ :type key_value_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
@@ -457,7 +434,7 @@ def create_or_update(
resource_group_name: str,
config_store_name: str,
key_value_name: str,
- key_value_parameters: Optional[Union[_models.KeyValue, IO]] = None,
+ key_value_parameters: Optional[Union[_models.KeyValue, IO[bytes]]] = None,
**kwargs: Any
) -> _models.KeyValue:
"""Creates a key-value.
@@ -471,18 +448,14 @@ def create_or_update(
character. Label is optional. Required.
:type key_value_name: str
:param key_value_parameters: The parameters for creating a key-value. Is either a KeyValue type
- or a IO type. Default value is None.
+ or a IO[bytes] type. Default value is None.
:type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue or
- IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ IO[bytes]
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -493,8 +466,8 @@ def create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None)
@@ -502,7 +475,7 @@ def create_or_update(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(key_value_parameters, (IO, bytes)):
+ if isinstance(key_value_parameters, (IOBase, bytes)):
_content = key_value_parameters
else:
if key_value_parameters is not None:
@@ -510,7 +483,7 @@ def create_or_update(
else:
_json = None
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_name,
@@ -519,16 +492,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -538,21 +509,17 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KeyValue", pipeline_response)
+ deserialized = self._deserialize("KeyValue", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -563,42 +530,45 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
- 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,
config_store_name=config_store_name,
key_value_name=key_value_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -614,14 +584,6 @@ def begin_delete(
:param key_value_name: Identifier of key and label combination. Key and label are joined by $
character. Label is optional. Required.
:type key_value_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:
@@ -629,15 +591,15 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_name,
@@ -647,11 +609,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(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -660,14 +623,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_operations.py
index 74c17eb86890..7a1310621f57 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,20 +21,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, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,9 +44,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -59,7 +56,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -76,9 +73,7 @@ def build_list_request(*, skip_token: Optional[str] = None, **kwargs: Any) -> Ht
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -95,13 +90,13 @@ def build_list_request(*, skip_token: Optional[str] = None, **kwargs: Any) -> Ht
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-def build_regional_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
+def build_regional_check_name_availability_request( # pylint: disable=name-too-long
+ location: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -115,7 +110,7 @@ def build_regional_check_name_availability_request(location: str, subscription_i
"location": _SERIALIZER.url("location", location, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -146,6 +141,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@overload
def check_name_availability(
@@ -164,7 +160,6 @@ def check_name_availability(
: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: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -172,17 +167,16 @@ def check_name_availability(
@overload
def check_name_availability(
- self, check_name_availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, check_name_availability_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
:param check_name_availability_parameters: The object containing information for the
availability request. Required.
- :type check_name_availability_parameters: IO
+ :type check_name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -190,23 +184,23 @@ def check_name_availability(
@distributed_trace
def check_name_availability(
- self, check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any
+ self,
+ check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
:param check_name_availability_parameters: The object containing information for the
- availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required.
+ availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type.
+ Required.
:type check_name_availability_parameters:
- ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters 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
+ ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters or
+ IO[bytes]
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -217,8 +211,8 @@ def check_name_availability(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None)
@@ -226,27 +220,25 @@ def check_name_availability(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(check_name_availability_parameters, (IO, bytes)):
+ if isinstance(check_name_availability_parameters, (IOBase, bytes)):
_content = check_name_availability_parameters
else:
_json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters")
- request = build_check_name_availability_request(
+ _request = build_check_name_availability_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.check_name_availability.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
@@ -256,16 +248,12 @@ def check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response)
+ deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- check_name_availability.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.OperationDefinition"]:
@@ -276,7 +264,6 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.OperationDefinition]
@@ -285,12 +272,12 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.OperationDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -301,15 +288,13 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
skip_token=skip_token,
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
@@ -320,14 +305,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationDefinitionListResult", pipeline_response)
@@ -337,11 +321,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
@@ -354,8 +338,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/providers/Microsoft.AppConfiguration/operations"}
-
@overload
def regional_check_name_availability(
self,
@@ -376,7 +358,6 @@ def regional_check_name_availability(
: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: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -386,7 +367,7 @@ def regional_check_name_availability(
def regional_check_name_availability(
self,
location: str,
- check_name_availability_parameters: IO,
+ check_name_availability_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -397,11 +378,10 @@ def regional_check_name_availability(
:type location: str
:param check_name_availability_parameters: The object containing information for the
availability request. Required.
- :type check_name_availability_parameters: IO
+ :type check_name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -411,7 +391,7 @@ def regional_check_name_availability(
def regional_check_name_availability(
self,
location: str,
- check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO],
+ check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]],
**kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
@@ -419,18 +399,16 @@ def regional_check_name_availability(
:param location: The location in which uniqueness will be verified. Required.
:type location: str
:param check_name_availability_parameters: The object containing information for the
- availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required.
+ availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type.
+ Required.
:type check_name_availability_parameters:
- ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters 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
+ ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.CheckNameAvailabilityParameters or
+ IO[bytes]
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -441,8 +419,8 @@ def regional_check_name_availability(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None)
@@ -450,28 +428,26 @@ def regional_check_name_availability(
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(check_name_availability_parameters, (IO, bytes)):
+ if isinstance(check_name_availability_parameters, (IOBase, bytes)):
_content = check_name_availability_parameters
else:
_json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters")
- request = build_regional_check_name_availability_request(
+ _request = build_regional_check_name_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.regional_check_name_availability.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
@@ -481,13 +457,9 @@ def regional_check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response)
+ deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- regional_check_name_availability.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability"
- }
+ return deserialized # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_endpoint_connections_operations.py
index a336745f2f1a..fcab05d369fc 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_endpoint_connections_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_endpoint_connections_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, 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,12 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,15 +44,13 @@
_SERIALIZER.client_side_validation = False
-def build_list_by_configuration_store_request(
+def build_list_by_configuration_store_request( # pylint: disable=name-too-long
resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -67,7 +66,7 @@ def build_list_by_configuration_store_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -88,9 +87,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -109,7 +106,7 @@ def build_get_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -130,9 +127,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -152,7 +147,7 @@ def build_create_or_update_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -175,9 +170,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -196,7 +189,7 @@ def build_delete_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -225,6 +218,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -237,7 +231,6 @@ def list_by_configuration_store(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateEndpointConnection or the result of
cls(response)
:rtype:
@@ -247,12 +240,12 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -263,17 +256,15 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -284,14 +275,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response)
@@ -301,11 +291,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
@@ -318,10 +308,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections"
- }
-
@distributed_trace
def get(
self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any
@@ -335,12 +321,11 @@ def get(
:type config_store_name: str
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -351,27 +336,25 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_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
@@ -381,26 +364,22 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
def _create_or_update_initial(
self,
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO],
+ private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
- ) -> _models.PrivateEndpointConnection:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -411,21 +390,21 @@ def _create_or_update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(private_endpoint_connection, (IO, bytes)):
+ if isinstance(private_endpoint_connection, (IOBase, bytes)):
_content = private_endpoint_connection
else:
_json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -434,40 +413,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("PrivateEndpointConnection", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
-
@overload
def begin_create_or_update(
self,
@@ -495,14 +469,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 PrivateEndpointConnection or the result
of cls(response)
:rtype:
@@ -516,7 +482,7 @@ def begin_create_or_update(
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: IO,
+ private_endpoint_connection: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -532,18 +498,10 @@ def begin_create_or_update(
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
:param private_endpoint_connection: The private endpoint connection properties. Required.
- :type private_endpoint_connection: IO
+ :type private_endpoint_connection: 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 PrivateEndpointConnection or the result
of cls(response)
:rtype:
@@ -557,7 +515,7 @@ def begin_create_or_update(
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO],
+ private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.PrivateEndpointConnection]:
"""Update the state of the specified private endpoint connection associated with the configuration
@@ -571,20 +529,9 @@ def begin_create_or_update(
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
:param private_endpoint_connection: The private endpoint connection properties. Is either a
- PrivateEndpointConnection type or a IO type. Required.
+ PrivateEndpointConnection type or a IO[bytes] type. Required.
:type private_endpoint_connection:
- ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection 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.appconfiguration.v2022_03_01_preview.models.PrivateEndpointConnection or IO[bytes]
:return: An instance of LROPoller that returns either PrivateEndpointConnection or the result
of cls(response)
:rtype:
@@ -594,8 +541,8 @@ def begin_create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
@@ -615,12 +562,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("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -630,22 +578,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.PrivateEndpointConnection].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return LROPoller[_models.PrivateEndpointConnection](
+ 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, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -656,42 +602,45 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
- 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,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -706,14 +655,6 @@ def begin_delete(
:type config_store_name: str
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_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:
@@ -721,15 +662,15 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -739,11 +680,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(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -752,14 +694,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_link_resources_operations.py
index 4864d448ef9d..7596c4032efd 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_link_resources_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_private_link_resources_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +7,7 @@
# 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
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -20,20 +20,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, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,15 +39,13 @@
_SERIALIZER.client_side_validation = False
-def build_list_by_configuration_store_request(
+def build_list_by_configuration_store_request( # pylint: disable=name-too-long
resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -65,7 +61,7 @@ def build_list_by_configuration_store_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -82,9 +78,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -101,7 +95,7 @@ def build_get_request(
"groupName": _SERIALIZER.url("group_name", group_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -130,6 +124,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -142,7 +137,6 @@ def list_by_configuration_store(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateLinkResource or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateLinkResource]
@@ -151,12 +145,12 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -167,17 +161,15 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -188,14 +180,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response)
@@ -205,11 +196,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
@@ -222,10 +213,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources"
- }
-
@distributed_trace
def get(
self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any
@@ -239,12 +226,11 @@ def get(
:type config_store_name: str
:param group_name: The name of the private link resource group. Required.
:type group_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateLinkResource or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -255,27 +241,25 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
group_name=group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.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
@@ -285,13 +269,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResource", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_replicas_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_replicas_operations.py
index 8c4cbcdc57bf..3628bd10bff4 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_replicas_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_03_01_preview/operations/_replicas_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, 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,12 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +44,7 @@
_SERIALIZER.client_side_validation = False
-def build_list_by_configuration_store_request(
+def build_list_by_configuration_store_request( # pylint: disable=name-too-long
resource_group_name: str,
config_store_name: str,
subscription_id: str,
@@ -54,9 +55,7 @@ def build_list_by_configuration_store_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -72,7 +71,7 @@ def build_list_by_configuration_store_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -91,9 +90,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -110,7 +107,7 @@ def build_get_request(
"replicaName": _SERIALIZER.url("replica_name", replica_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -127,9 +124,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -147,7 +142,7 @@ def build_create_request(
"replicaName": _SERIALIZER.url("replica_name", replica_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -166,9 +161,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
- )
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -185,7 +178,7 @@ def build_delete_request(
"replicaName": _SERIALIZER.url("replica_name", replica_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -214,6 +207,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -231,7 +225,6 @@ def list_by_configuration_store(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Replica or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica]
@@ -240,12 +233,12 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.ReplicaListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -256,18 +249,16 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -278,14 +269,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ReplicaListResult", pipeline_response)
@@ -295,11 +285,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
@@ -312,10 +302,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas"
- }
-
@distributed_trace
def get(
self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any
@@ -329,12 +315,11 @@ def get(
:type config_store_name: str
:param replica_name: The name of the replica. Required.
:type replica_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Replica or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -345,27 +330,25 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[_models.Replica] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_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
@@ -375,26 +358,22 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Replica", pipeline_response)
+ deserialized = self._deserialize("Replica", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return deserialized # type: ignore
def _create_initial(
self,
resource_group_name: str,
config_store_name: str,
replica_name: str,
- replica_creation_parameters: Union[_models.Replica, IO],
+ replica_creation_parameters: Union[_models.Replica, IO[bytes]],
**kwargs: Any
- ) -> _models.Replica:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -405,21 +384,21 @@ def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Replica] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(replica_creation_parameters, (IO, bytes)):
+ if isinstance(replica_creation_parameters, (IOBase, bytes)):
_content = replica_creation_parameters
else:
_json = self._serialize.body(replica_creation_parameters, "Replica")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_name,
@@ -428,40 +407,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_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("Replica", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Replica", 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_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
-
@overload
def begin_create(
self,
@@ -488,14 +462,6 @@ def begin_create(
: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 Replica or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica]
@@ -508,7 +474,7 @@ def begin_create(
resource_group_name: str,
config_store_name: str,
replica_name: str,
- replica_creation_parameters: IO,
+ replica_creation_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -523,18 +489,10 @@ def begin_create(
:param replica_name: The name of the replica. Required.
:type replica_name: str
:param replica_creation_parameters: The parameters for creating a replica. Required.
- :type replica_creation_parameters: IO
+ :type replica_creation_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Replica or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica]
@@ -547,7 +505,7 @@ def begin_create(
resource_group_name: str,
config_store_name: str,
replica_name: str,
- replica_creation_parameters: Union[_models.Replica, IO],
+ replica_creation_parameters: Union[_models.Replica, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Replica]:
"""Creates a replica with the specified parameters.
@@ -560,20 +518,9 @@ def begin_create(
:param replica_name: The name of the replica. Required.
:type replica_name: str
:param replica_creation_parameters: The parameters for creating a replica. Is either a Replica
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type replica_creation_parameters:
- ~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica 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.appconfiguration.v2022_03_01_preview.models.Replica or IO[bytes]
:return: An instance of LROPoller that returns either Replica or the result of cls(response)
:rtype:
~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2022_03_01_preview.models.Replica]
@@ -582,8 +529,8 @@ def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Replica] = kwargs.pop("cls", None)
@@ -603,12 +550,13 @@ def begin_create(
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("Replica", pipeline_response)
+ deserialized = self._deserialize("Replica", 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 +566,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Replica].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.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return LROPoller[_models.Replica](
+ 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, config_store_name: str, replica_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -644,42 +590,45 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
- 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,
config_store_name=config_store_name,
replica_name=replica_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -694,14 +643,6 @@ def begin_delete(
:type config_store_name: str
:param replica_name: The name of the replica. Required.
:type replica_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:
@@ -709,15 +650,15 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-03-01-preview"] = kwargs.pop(
- "api_version", _params.pop("api-version", "2022-03-01-preview")
+ api_version: str = kwargs.pop(
+ "api_version", _params.pop("api-version", self._api_version or "2022-03-01-preview")
)
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_name,
@@ -727,11 +668,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(
@@ -742,14 +684,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_app_configuration_management_client.py
index 57cb85f68001..9b6968ede048 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_app_configuration_management_client.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_app_configuration_management_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 .._serialization import Deserializer, Serializer
@@ -67,25 +70,45 @@ def __init__(
self._config = AppConfigurationManagementClientConfiguration(
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)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.configuration_stores = ConfigurationStoresOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2022-05-01"
)
- self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
+ self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-05-01")
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2022-05-01"
)
self.private_link_resources = PrivateLinkResourcesOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2022-05-01"
+ )
+ self.key_values = KeyValuesOperations(
+ self._client, self._config, self._serialize, self._deserialize, "2022-05-01"
)
- self.key_values = KeyValuesOperations(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
@@ -105,12 +128,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) -> "AppConfigurationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_configuration.py
index 4a7d1e075081..a19363effb6f 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_configuration.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_configuration.py
@@ -6,26 +6,19 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-import sys
from typing import Any, TYPE_CHECKING
-from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
from ._version import VERSION
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AppConfigurationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AppConfigurationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AppConfigurationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -41,8 +34,7 @@ class AppConfigurationManagementClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs)
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", "2022-05-01")
+ api_version: str = kwargs.pop("api_version", "2022-05-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@@ -54,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-appconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -62,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_metadata.json b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_metadata.json
index f1e192bfd449..a41e7a8f5495 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_metadata.json
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_lro_operations": true,
"client_side_validation": false,
- "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
- "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"credential_scopes": ["https://management.azure.com/.default"],
"credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
"credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
- "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
- "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"configuration_stores": "ConfigurationStoresOperations",
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_vendor.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_vendor.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# --------------------------------------------------------------------------
-# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for license information.
-# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is regenerated.
-# --------------------------------------------------------------------------
-
-from typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_version.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_version.py
index cac9f5d10f8b..e5754a47ce68 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_version.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_app_configuration_management_client.py
index d1dff100d6e4..1323c005de88 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_app_configuration_management_client.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_app_configuration_management_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
@@ -67,25 +70,47 @@ def __init__(
self._config = AppConfigurationManagementClientConfiguration(
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)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.configuration_stores = ConfigurationStoresOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2022-05-01"
)
- self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
+ self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2022-05-01")
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2022-05-01"
)
self.private_link_resources = PrivateLinkResourcesOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2022-05-01"
+ )
+ self.key_values = KeyValuesOperations(
+ self._client, self._config, self._serialize, self._deserialize, "2022-05-01"
)
- self.key_values = KeyValuesOperations(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
@@ -105,12 +130,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) -> "AppConfigurationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_configuration.py
index 9fc6fefdeee5..b7b79279583b 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_configuration.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/_configuration.py
@@ -6,26 +6,19 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-import sys
from typing import Any, TYPE_CHECKING
-from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AppConfigurationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AppConfigurationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AppConfigurationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -41,8 +34,7 @@ class AppConfigurationManagementClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs)
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", "2022-05-01")
+ api_version: str = kwargs.pop("api_version", "2022-05-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@@ -54,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-appconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -62,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_configuration_stores_operations.py
index b97f9f369803..33f277d6c57d 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_configuration_stores_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_configuration_stores_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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._configuration_stores_operations import (
build_create_request,
build_delete_request,
@@ -45,10 +46,10 @@
build_update_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -71,6 +72,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.ConfigurationStore"]:
@@ -81,7 +83,6 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConfigurationStore or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore]
@@ -90,10 +91,10 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -104,16 +105,14 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
skip_token=skip_token,
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
@@ -124,14 +123,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response)
@@ -141,11 +139,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
@@ -158,8 +156,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"}
-
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any
@@ -174,7 +170,6 @@ def list_by_resource_group(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConfigurationStore or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore]
@@ -183,10 +178,10 @@ def list_by_resource_group(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -197,17 +192,15 @@ def list_by_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_resource_group_request(
+ _request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
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
@@ -218,14 +211,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response)
@@ -235,11 +227,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
@@ -252,10 +244,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/Microsoft.AppConfiguration/configurationStores"
- }
-
@distributed_trace_async
async def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore:
"""Gets the properties of the specified configuration store.
@@ -265,12 +253,11 @@ async def get(self, resource_group_name: str, config_store_name: str, **kwargs:
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ConfigurationStore or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -281,24 +268,22 @@ async def get(self, resource_group_name: str, config_store_name: str, **kwargs:
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_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
@@ -308,25 +293,21 @@ async def get(self, resource_group_name: str, config_store_name: str, **kwargs:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
async def _create_initial(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: Union[_models.ConfigurationStore, IO],
+ config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]],
**kwargs: Any
- ) -> _models.ConfigurationStore:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -337,19 +318,19 @@ async def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(config_store_creation_parameters, (IO, bytes)):
+ if isinstance(config_store_creation_parameters, (IOBase, bytes)):
_content = config_store_creation_parameters
else:
_json = self._serialize.body(config_store_creation_parameters, "ConfigurationStore")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -357,40 +338,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_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("ConfigurationStore", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ConfigurationStore", 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_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
-
@overload
async def begin_create(
self,
@@ -415,14 +391,6 @@ async def begin_create(
: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 ConfigurationStore or the result of
cls(response)
:rtype:
@@ -435,7 +403,7 @@ async def begin_create(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: IO,
+ config_store_creation_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -449,18 +417,10 @@ async def begin_create(
:type config_store_name: str
:param config_store_creation_parameters: The parameters for creating a configuration store.
Required.
- :type config_store_creation_parameters: IO
+ :type config_store_creation_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -473,7 +433,7 @@ async def begin_create(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: Union[_models.ConfigurationStore, IO],
+ config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationStore]:
"""Creates a configuration store with the specified parameters.
@@ -484,20 +444,9 @@ async def begin_create(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param config_store_creation_parameters: The parameters for creating a configuration store. Is
- either a ConfigurationStore type or a IO type. Required.
+ either a ConfigurationStore type or a IO[bytes] type. Required.
:type config_store_creation_parameters:
- ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore 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.appconfiguration.v2022_05_01.models.ConfigurationStore or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -507,7 +456,7 @@ async def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
@@ -525,12 +474,13 @@ async def begin_create(
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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -540,22 +490,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.ConfigurationStore].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.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return AsyncLROPoller[_models.ConfigurationStore](
+ 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, config_store_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -566,39 +514,42 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -611,14 +562,6 @@ async def begin_delete(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_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:
@@ -626,13 +569,13 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
api_version=api_version,
@@ -641,11 +584,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -654,26 +598,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _update_initial(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO],
+ config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.ConfigurationStore:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -684,19 +624,19 @@ async def _update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(config_store_update_parameters, (IO, bytes)):
+ if isinstance(config_store_update_parameters, (IOBase, bytes)):
_content = config_store_update_parameters
else:
_json = self._serialize.body(config_store_update_parameters, "ConfigurationStoreUpdateParameters")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -704,40 +644,35 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._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("ConfigurationStore", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ConfigurationStore", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
-
@overload
async def begin_update(
self,
@@ -762,14 +697,6 @@ async def begin_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 ConfigurationStore or the result of
cls(response)
:rtype:
@@ -782,7 +709,7 @@ async def begin_update(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: IO,
+ config_store_update_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -796,18 +723,10 @@ async def begin_update(
:type config_store_name: str
:param config_store_update_parameters: The parameters for updating a configuration store.
Required.
- :type config_store_update_parameters: IO
+ :type config_store_update_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -820,7 +739,7 @@ async def begin_update(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO],
+ config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationStore]:
"""Updates a configuration store with the specified parameters.
@@ -831,20 +750,9 @@ async def begin_update(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param config_store_update_parameters: The parameters for updating a configuration store. Is
- either a ConfigurationStoreUpdateParameters type or a IO type. Required.
+ either a ConfigurationStoreUpdateParameters type or a IO[bytes] type. Required.
:type config_store_update_parameters:
- ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStoreUpdateParameters 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.appconfiguration.v2022_05_01.models.ConfigurationStoreUpdateParameters or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -854,7 +762,7 @@ async def begin_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
@@ -872,12 +780,13 @@ async def begin_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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -887,17 +796,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.ConfigurationStore].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_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return AsyncLROPoller[_models.ConfigurationStore](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list_keys(
@@ -915,7 +822,6 @@ def list_keys(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ApiKey or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey]
@@ -924,10 +830,10 @@ def list_keys(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.ApiKeyListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -938,18 +844,16 @@ def list_keys(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_keys_request(
+ _request = build_list_keys_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_keys.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
@@ -960,14 +864,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ApiKeyListResult", pipeline_response)
@@ -977,11 +880,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
@@ -994,10 +897,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_keys.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys"
- }
-
@overload
async def regenerate_key(
self,
@@ -1021,7 +920,6 @@ async def regenerate_key(
: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: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1032,7 +930,7 @@ async def regenerate_key(
self,
resource_group_name: str,
config_store_name: str,
- regenerate_key_parameters: IO,
+ regenerate_key_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1045,11 +943,10 @@ async def regenerate_key(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param regenerate_key_parameters: The parameters for regenerating an access key. Required.
- :type regenerate_key_parameters: IO
+ :type regenerate_key_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1060,7 +957,7 @@ async def regenerate_key(
self,
resource_group_name: str,
config_store_name: str,
- regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO],
+ regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO[bytes]],
**kwargs: Any
) -> _models.ApiKey:
"""Regenerates an access key for the specified configuration store.
@@ -1071,18 +968,14 @@ async def regenerate_key(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param regenerate_key_parameters: The parameters for regenerating an access key. Is either a
- RegenerateKeyParameters type or a IO type. Required.
+ RegenerateKeyParameters type or a IO[bytes] type. Required.
:type regenerate_key_parameters:
- ~azure.mgmt.appconfiguration.v2022_05_01.models.RegenerateKeyParameters 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
+ ~azure.mgmt.appconfiguration.v2022_05_01.models.RegenerateKeyParameters or IO[bytes]
:return: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1093,19 +986,19 @@ async def regenerate_key(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(regenerate_key_parameters, (IO, bytes)):
+ if isinstance(regenerate_key_parameters, (IOBase, bytes)):
_content = regenerate_key_parameters
else:
_json = self._serialize.body(regenerate_key_parameters, "RegenerateKeyParameters")
- request = build_regenerate_key_request(
+ _request = build_regenerate_key_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -1113,16 +1006,14 @@ async def regenerate_key(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.regenerate_key.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
@@ -1132,22 +1023,17 @@ async def regenerate_key(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiKey", pipeline_response)
+ deserialized = self._deserialize("ApiKey", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- regenerate_key.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_deleted(self, **kwargs: Any) -> AsyncIterable["_models.DeletedConfigurationStore"]:
"""Gets information about the deleted configuration stores in a subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DeletedConfigurationStore or the result of
cls(response)
:rtype:
@@ -1157,10 +1043,10 @@ def list_deleted(self, **kwargs: Any) -> AsyncIterable["_models.DeletedConfigura
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.DeletedConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1171,15 +1057,13 @@ def list_deleted(self, **kwargs: Any) -> AsyncIterable["_models.DeletedConfigura
def prepare_request(next_link=None):
if not next_link:
- request = build_list_deleted_request(
+ _request = build_list_deleted_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_deleted.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
@@ -1190,14 +1074,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DeletedConfigurationStoreListResult", pipeline_response)
@@ -1207,11 +1090,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
@@ -1224,10 +1107,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores"
- }
-
@distributed_trace_async
async def get_deleted(
self, location: str, config_store_name: str, **kwargs: Any
@@ -1238,12 +1117,11 @@ async def get_deleted(
:type location: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DeletedConfigurationStore or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.DeletedConfigurationStore
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1254,24 +1132,22 @@ async def get_deleted(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None)
- request = build_get_deleted_request(
+ _request = build_get_deleted_request(
location=location,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_deleted.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
@@ -1281,21 +1157,17 @@ async def get_deleted(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
- async def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements
+ async def _purge_deleted_initial(
self, location: str, config_store_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1306,39 +1178,42 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_purge_deleted_request(
+ _request = build_purge_deleted_request(
location=location,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self._purge_deleted_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
- _purge_deleted_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
@@ -1348,14 +1223,6 @@ async def begin_purge_deleted(self, location: str, config_store_name: str, **kwa
:type location: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_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:
@@ -1363,13 +1230,13 @@ async def begin_purge_deleted(self, location: str, config_store_name: str, **kwa
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._purge_deleted_initial( # type: ignore
+ raw_result = await self._purge_deleted_initial(
location=location,
config_store_name=config_store_name,
api_version=api_version,
@@ -1378,11 +1245,12 @@ async def begin_purge_deleted(self, location: str, config_store_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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -1391,14 +1259,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_purge_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_key_values_operations.py
index 9d7d8c0ea389..43c58777d247 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_key_values_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_key_values_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,25 +16,25 @@
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_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._key_values_operations import build_create_or_update_request, build_delete_request, build_get_request
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -56,6 +57,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
async def get(
@@ -71,12 +73,11 @@ async def get(
:param key_value_name: Identifier of key and label combination. Key and label are joined by $
character. Label is optional. Required.
:type key_value_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -87,25 +88,23 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_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
@@ -115,16 +114,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KeyValue", pipeline_response)
+ deserialized = self._deserialize("KeyValue", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -152,7 +147,6 @@ async def 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
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
@@ -164,7 +158,7 @@ async def create_or_update(
resource_group_name: str,
config_store_name: str,
key_value_name: str,
- key_value_parameters: Optional[IO] = None,
+ key_value_parameters: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -180,11 +174,10 @@ async def create_or_update(
character. Label is optional. Required.
:type key_value_name: str
:param key_value_parameters: The parameters for creating a key-value. Default value is None.
- :type key_value_parameters: IO
+ :type key_value_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
@@ -196,7 +189,7 @@ async def create_or_update(
resource_group_name: str,
config_store_name: str,
key_value_name: str,
- key_value_parameters: Optional[Union[_models.KeyValue, IO]] = None,
+ key_value_parameters: Optional[Union[_models.KeyValue, IO[bytes]]] = None,
**kwargs: Any
) -> _models.KeyValue:
"""Creates a key-value.
@@ -210,17 +203,14 @@ async def create_or_update(
character. Label is optional. Required.
:type key_value_name: str
:param key_value_parameters: The parameters for creating a key-value. Is either a KeyValue type
- or a IO type. Default value is None.
- :type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ or a IO[bytes] type. Default value is None.
+ :type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue or
+ IO[bytes]
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -231,14 +221,14 @@ async def create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(key_value_parameters, (IO, bytes)):
+ if isinstance(key_value_parameters, (IOBase, bytes)):
_content = key_value_parameters
else:
if key_value_parameters is not None:
@@ -246,7 +236,7 @@ async def create_or_update(
else:
_json = None
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_name,
@@ -255,16 +245,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -274,21 +262,17 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KeyValue", pipeline_response)
+ deserialized = self._deserialize("KeyValue", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
+ return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
-
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -299,40 +283,43 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -348,14 +335,6 @@ async def begin_delete(
:param key_value_name: Identifier of key and label combination. Key and label are joined by $
character. Label is optional. Required.
:type key_value_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:
@@ -363,13 +342,13 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_name,
@@ -379,11 +358,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -392,14 +372,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_operations.py
index 685afcb236dd..51307a940b8f 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,25 +21,23 @@
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._operations import (
build_check_name_availability_request,
build_list_request,
build_regional_check_name_availability_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -61,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@overload
async def check_name_availability(
@@ -79,7 +79,6 @@ async def check_name_availability(
: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: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -87,17 +86,16 @@ async def check_name_availability(
@overload
async def check_name_availability(
- self, check_name_availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, check_name_availability_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
:param check_name_availability_parameters: The object containing information for the
availability request. Required.
- :type check_name_availability_parameters: IO
+ :type check_name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -105,23 +103,22 @@ async def check_name_availability(
@distributed_trace_async
async def check_name_availability(
- self, check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any
+ self,
+ check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
:param check_name_availability_parameters: The object containing information for the
- availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required.
+ availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type.
+ Required.
:type check_name_availability_parameters:
- ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters 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
+ ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters or IO[bytes]
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -132,34 +129,32 @@ async def check_name_availability(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(check_name_availability_parameters, (IO, bytes)):
+ if isinstance(check_name_availability_parameters, (IOBase, bytes)):
_content = check_name_availability_parameters
else:
_json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters")
- request = build_check_name_availability_request(
+ _request = build_check_name_availability_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.check_name_availability.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
@@ -169,16 +164,12 @@ async def check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response)
+ deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- check_name_availability.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.OperationDefinition"]:
@@ -189,7 +180,6 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationDefinition or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.OperationDefinition]
@@ -198,10 +188,10 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.OperationDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -212,15 +202,13 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
skip_token=skip_token,
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
@@ -231,14 +219,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationDefinitionListResult", pipeline_response)
@@ -248,11 +235,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
@@ -265,8 +252,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/providers/Microsoft.AppConfiguration/operations"}
-
@overload
async def regional_check_name_availability(
self,
@@ -287,7 +272,6 @@ async def regional_check_name_availability(
: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: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -297,7 +281,7 @@ async def regional_check_name_availability(
async def regional_check_name_availability(
self,
location: str,
- check_name_availability_parameters: IO,
+ check_name_availability_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -308,11 +292,10 @@ async def regional_check_name_availability(
:type location: str
:param check_name_availability_parameters: The object containing information for the
availability request. Required.
- :type check_name_availability_parameters: IO
+ :type check_name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -322,7 +305,7 @@ async def regional_check_name_availability(
async def regional_check_name_availability(
self,
location: str,
- check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO],
+ check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]],
**kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
@@ -330,18 +313,15 @@ async def regional_check_name_availability(
:param location: The location in which uniqueness will be verified. Required.
:type location: str
:param check_name_availability_parameters: The object containing information for the
- availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required.
+ availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type.
+ Required.
:type check_name_availability_parameters:
- ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters 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
+ ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters or IO[bytes]
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -352,35 +332,33 @@ async def regional_check_name_availability(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(check_name_availability_parameters, (IO, bytes)):
+ if isinstance(check_name_availability_parameters, (IOBase, bytes)):
_content = check_name_availability_parameters
else:
_json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters")
- request = build_regional_check_name_availability_request(
+ _request = build_regional_check_name_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.regional_check_name_availability.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
@@ -390,13 +368,9 @@ async def regional_check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response)
+ deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- regional_check_name_availability.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability"
- }
+ return deserialized # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_endpoint_connections_operations.py
index fd8a3c02ba11..8c58ed2e0cfc 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_endpoint_connections_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_endpoint_connections_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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._private_endpoint_connections_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,10 +39,10 @@
build_list_by_configuration_store_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -76,7 +78,6 @@ def list_by_configuration_store(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateEndpointConnection or the result of
cls(response)
:rtype:
@@ -86,10 +87,10 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -100,17 +101,15 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -121,14 +120,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response)
@@ -138,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
@@ -155,10 +153,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections"
- }
-
@distributed_trace_async
async def get(
self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any
@@ -172,12 +166,11 @@ async def get(
:type config_store_name: str
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -188,25 +181,23 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_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
@@ -216,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("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO],
+ private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
- ) -> _models.PrivateEndpointConnection:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -246,19 +233,19 @@ async def _create_or_update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(private_endpoint_connection, (IO, bytes)):
+ if isinstance(private_endpoint_connection, (IOBase, bytes)):
_content = private_endpoint_connection
else:
_json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -267,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("PrivateEndpointConnection", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
-
@overload
async def begin_create_or_update(
self,
@@ -329,14 +311,6 @@ async def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the
result of cls(response)
:rtype:
@@ -350,7 +324,7 @@ async def begin_create_or_update(
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: IO,
+ private_endpoint_connection: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -367,18 +341,10 @@ async def begin_create_or_update(
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
:param private_endpoint_connection: The private endpoint connection properties. Required.
- :type private_endpoint_connection: IO
+ :type private_endpoint_connection: 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 PrivateEndpointConnection or the
result of cls(response)
:rtype:
@@ -392,7 +358,7 @@ async def begin_create_or_update(
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO],
+ private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateEndpointConnection]:
"""Update the state of the specified private endpoint connection associated with the configuration
@@ -407,20 +373,9 @@ async def begin_create_or_update(
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
:param private_endpoint_connection: The private endpoint connection properties. Is either a
- PrivateEndpointConnection type or a IO type. Required.
+ PrivateEndpointConnection type or a IO[bytes] type. Required.
:type private_endpoint_connection:
- ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection 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.appconfiguration.v2022_05_01.models.PrivateEndpointConnection or IO[bytes]
:return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the
result of cls(response)
:rtype:
@@ -430,7 +385,7 @@ async def begin_create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
@@ -449,12 +404,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("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -464,22 +420,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return AsyncLROPoller[_models.PrivateEndpointConnection](
+ 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, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -490,40 +444,43 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -538,14 +495,6 @@ async def begin_delete(
:type config_store_name: str
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_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:
@@ -553,13 +502,13 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -569,11 +518,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -582,14 +532,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_link_resources_operations.py
index c38ab100783d..52adf70398fb 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_link_resources_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/aio/operations/_private_link_resources_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +7,7 @@
# 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
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,24 +20,22 @@
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._private_link_resources_operations import (
build_get_request,
build_list_by_configuration_store_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -60,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -72,7 +71,6 @@ def list_by_configuration_store(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateLinkResource or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateLinkResource]
@@ -81,10 +79,10 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -95,17 +93,15 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -116,14 +112,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response)
@@ -133,11 +128,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 +145,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources"
- }
-
@distributed_trace_async
async def get(
self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any
@@ -167,12 +158,11 @@ async def get(
:type config_store_name: str
:param group_name: The name of the private link resource group. Required.
:type group_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateLinkResource or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -183,25 +173,23 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
group_name=group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.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,13 +199,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResource", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_models_py3.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_models_py3.py
index ac72d1ff21a4..fa55c7ac1d1e 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_models_py3.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/models/_models_py3.py
@@ -97,7 +97,7 @@ def __init__(
class CheckNameAvailabilityParameters(_serialization.Model):
"""Parameters used for checking whether a resource name is available.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar name: The name to check for availability. Required.
:vartype name: str
@@ -136,7 +136,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
@@ -171,10 +171,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
@@ -220,10 +220,10 @@ class ConfigurationStore(TrackedResource): # pylint: disable=too-many-instance-
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. 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
@@ -1512,7 +1512,7 @@ class ResourceIdentity(_serialization.Model):
:vartype type: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.IdentityType
:ivar user_assigned_identities: The list of user-assigned identities associated with the
resource. The user-assigned identity dictionary keys will be ARM resource ids in the form:
- '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
+ '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long
:vartype user_assigned_identities: dict[str,
~azure.mgmt.appconfiguration.v2022_05_01.models.UserIdentity]
:ivar principal_id: The principal id of the identity. This property will only be provided for a
@@ -1550,7 +1550,7 @@ def __init__(
:paramtype type: str or ~azure.mgmt.appconfiguration.v2022_05_01.models.IdentityType
:keyword user_assigned_identities: The list of user-assigned identities associated with the
resource. The user-assigned identity dictionary keys will be ARM resource ids in the form:
- '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
+ '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long
:paramtype user_assigned_identities: dict[str,
~azure.mgmt.appconfiguration.v2022_05_01.models.UserIdentity]
"""
@@ -1600,7 +1600,7 @@ def __init__(
class Sku(_serialization.Model):
"""Describes a configuration store SKU.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar name: The SKU name of the configuration store. Required.
:vartype name: str
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_configuration_stores_operations.py
index 6f12b75a8631..098b57e34bf0 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_configuration_stores_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_configuration_stores_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, 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,12 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -47,7 +48,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -58,7 +59,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -77,7 +78,7 @@ def build_list_by_resource_group_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -90,7 +91,7 @@ def build_list_by_resource_group_request(
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -109,7 +110,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -125,7 +126,7 @@ def build_get_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -142,7 +143,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -159,7 +160,7 @@ def build_create_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -178,7 +179,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -194,7 +195,7 @@ def build_delete_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -211,7 +212,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -228,7 +229,7 @@ def build_update_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -252,7 +253,7 @@ def build_list_keys_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -268,7 +269,7 @@ def build_list_keys_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -287,7 +288,7 @@ def build_regenerate_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -304,7 +305,7 @@ def build_regenerate_key_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -321,7 +322,7 @@ def build_list_deleted_request(subscription_id: str, **kwargs: Any) -> HttpReque
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -333,7 +334,7 @@ def build_list_deleted_request(subscription_id: str, **kwargs: Any) -> HttpReque
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -350,7 +351,7 @@ def build_get_deleted_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -366,7 +367,7 @@ def build_get_deleted_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -383,7 +384,7 @@ def build_purge_deleted_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -399,7 +400,7 @@ def build_purge_deleted_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -428,6 +429,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ConfigurationStore"]:
@@ -438,7 +440,6 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConfigurationStore or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore]
@@ -447,10 +448,10 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -461,16 +462,14 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
skip_token=skip_token,
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
@@ -481,14 +480,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response)
@@ -498,11 +496,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
@@ -515,8 +513,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"}
-
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any
@@ -531,7 +527,6 @@ def list_by_resource_group(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConfigurationStore or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore]
@@ -540,10 +535,10 @@ def list_by_resource_group(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -554,17 +549,15 @@ def list_by_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_resource_group_request(
+ _request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
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
@@ -575,14 +568,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response)
@@ -592,11 +584,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
@@ -609,10 +601,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores"
- }
-
@distributed_trace
def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore:
"""Gets the properties of the specified configuration store.
@@ -622,12 +610,11 @@ def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ConfigurationStore or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -638,24 +625,22 @@ def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_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
@@ -665,25 +650,21 @@ def get(self, resource_group_name: str, config_store_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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
def _create_initial(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: Union[_models.ConfigurationStore, IO],
+ config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]],
**kwargs: Any
- ) -> _models.ConfigurationStore:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -694,19 +675,19 @@ def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(config_store_creation_parameters, (IO, bytes)):
+ if isinstance(config_store_creation_parameters, (IOBase, bytes)):
_content = config_store_creation_parameters
else:
_json = self._serialize.body(config_store_creation_parameters, "ConfigurationStore")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -714,40 +695,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_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("ConfigurationStore", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ConfigurationStore", 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_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
-
@overload
def begin_create(
self,
@@ -772,14 +748,6 @@ def begin_create(
: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 ConfigurationStore or the result of
cls(response)
:rtype:
@@ -792,7 +760,7 @@ def begin_create(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: IO,
+ config_store_creation_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -806,18 +774,10 @@ def begin_create(
:type config_store_name: str
:param config_store_creation_parameters: The parameters for creating a configuration store.
Required.
- :type config_store_creation_parameters: IO
+ :type config_store_creation_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -830,7 +790,7 @@ def begin_create(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: Union[_models.ConfigurationStore, IO],
+ config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ConfigurationStore]:
"""Creates a configuration store with the specified parameters.
@@ -841,20 +801,9 @@ def begin_create(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param config_store_creation_parameters: The parameters for creating a configuration store. Is
- either a ConfigurationStore type or a IO type. Required.
+ either a ConfigurationStore type or a IO[bytes] type. Required.
:type config_store_creation_parameters:
- ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStore 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.appconfiguration.v2022_05_01.models.ConfigurationStore or IO[bytes]
:return: An instance of LROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -864,7 +813,7 @@ def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
@@ -882,12 +831,13 @@ def begin_create(
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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -897,22 +847,18 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.ConfigurationStore].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.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return LROPoller[_models.ConfigurationStore](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, config_store_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _delete_initial(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -923,39 +869,42 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -966,14 +915,6 @@ def begin_delete(self, resource_group_name: str, config_store_name: str, **kwarg
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_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:
@@ -981,13 +922,13 @@ def begin_delete(self, resource_group_name: str, config_store_name: str, **kwarg
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
api_version=api_version,
@@ -996,11 +937,12 @@ def begin_delete(self, resource_group_name: str, config_store_name: str, **kwarg
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(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -1009,26 +951,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _update_initial(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO],
+ config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.ConfigurationStore:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1039,19 +977,19 @@ def _update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(config_store_update_parameters, (IO, bytes)):
+ if isinstance(config_store_update_parameters, (IOBase, bytes)):
_content = config_store_update_parameters
else:
_json = self._serialize.body(config_store_update_parameters, "ConfigurationStoreUpdateParameters")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -1059,40 +997,35 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._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("ConfigurationStore", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ConfigurationStore", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
-
@overload
def begin_update(
self,
@@ -1117,14 +1050,6 @@ def begin_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 ConfigurationStore or the result of
cls(response)
:rtype:
@@ -1137,7 +1062,7 @@ def begin_update(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: IO,
+ config_store_update_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1151,18 +1076,10 @@ def begin_update(
:type config_store_name: str
:param config_store_update_parameters: The parameters for updating a configuration store.
Required.
- :type config_store_update_parameters: IO
+ :type config_store_update_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -1175,7 +1092,7 @@ def begin_update(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO],
+ config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ConfigurationStore]:
"""Updates a configuration store with the specified parameters.
@@ -1186,20 +1103,9 @@ def begin_update(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param config_store_update_parameters: The parameters for updating a configuration store. Is
- either a ConfigurationStoreUpdateParameters type or a IO type. Required.
+ either a ConfigurationStoreUpdateParameters type or a IO[bytes] type. Required.
:type config_store_update_parameters:
- ~azure.mgmt.appconfiguration.v2022_05_01.models.ConfigurationStoreUpdateParameters 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.appconfiguration.v2022_05_01.models.ConfigurationStoreUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -1209,7 +1115,7 @@ def begin_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
@@ -1227,12 +1133,13 @@ def begin_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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1242,17 +1149,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.ConfigurationStore].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_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return LROPoller[_models.ConfigurationStore](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list_keys(
@@ -1270,7 +1175,6 @@ def list_keys(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ApiKey or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1278,10 +1182,10 @@ def list_keys(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.ApiKeyListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1292,18 +1196,16 @@ def list_keys(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_keys_request(
+ _request = build_list_keys_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_keys.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
@@ -1314,14 +1216,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ApiKeyListResult", pipeline_response)
@@ -1331,11 +1232,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
@@ -1348,10 +1249,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_keys.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys"
- }
-
@overload
def regenerate_key(
self,
@@ -1375,7 +1272,6 @@ def regenerate_key(
: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: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1386,7 +1282,7 @@ def regenerate_key(
self,
resource_group_name: str,
config_store_name: str,
- regenerate_key_parameters: IO,
+ regenerate_key_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1399,11 +1295,10 @@ def regenerate_key(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param regenerate_key_parameters: The parameters for regenerating an access key. Required.
- :type regenerate_key_parameters: IO
+ :type regenerate_key_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1414,7 +1309,7 @@ def regenerate_key(
self,
resource_group_name: str,
config_store_name: str,
- regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO],
+ regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO[bytes]],
**kwargs: Any
) -> _models.ApiKey:
"""Regenerates an access key for the specified configuration store.
@@ -1425,18 +1320,14 @@ def regenerate_key(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param regenerate_key_parameters: The parameters for regenerating an access key. Is either a
- RegenerateKeyParameters type or a IO type. Required.
+ RegenerateKeyParameters type or a IO[bytes] type. Required.
:type regenerate_key_parameters:
- ~azure.mgmt.appconfiguration.v2022_05_01.models.RegenerateKeyParameters 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
+ ~azure.mgmt.appconfiguration.v2022_05_01.models.RegenerateKeyParameters or IO[bytes]
:return: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1447,19 +1338,19 @@ def regenerate_key(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(regenerate_key_parameters, (IO, bytes)):
+ if isinstance(regenerate_key_parameters, (IOBase, bytes)):
_content = regenerate_key_parameters
else:
_json = self._serialize.body(regenerate_key_parameters, "RegenerateKeyParameters")
- request = build_regenerate_key_request(
+ _request = build_regenerate_key_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -1467,16 +1358,14 @@ def regenerate_key(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.regenerate_key.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
@@ -1486,22 +1375,17 @@ def regenerate_key(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiKey", pipeline_response)
+ deserialized = self._deserialize("ApiKey", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- regenerate_key.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_deleted(self, **kwargs: Any) -> Iterable["_models.DeletedConfigurationStore"]:
"""Gets information about the deleted configuration stores in a subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DeletedConfigurationStore or the result of
cls(response)
:rtype:
@@ -1511,10 +1395,10 @@ def list_deleted(self, **kwargs: Any) -> Iterable["_models.DeletedConfigurationS
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.DeletedConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1525,15 +1409,13 @@ def list_deleted(self, **kwargs: Any) -> Iterable["_models.DeletedConfigurationS
def prepare_request(next_link=None):
if not next_link:
- request = build_list_deleted_request(
+ _request = build_list_deleted_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_deleted.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
@@ -1544,14 +1426,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("DeletedConfigurationStoreListResult", pipeline_response)
@@ -1561,11 +1442,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
@@ -1578,10 +1459,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores"
- }
-
@distributed_trace
def get_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> _models.DeletedConfigurationStore:
"""Gets a deleted Azure app configuration store.
@@ -1590,12 +1467,11 @@ def get_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> _
:type location: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DeletedConfigurationStore or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.DeletedConfigurationStore
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1606,24 +1482,22 @@ def get_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> _
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None)
- request = build_get_deleted_request(
+ _request = build_get_deleted_request(
location=location,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_deleted.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
@@ -1633,21 +1507,15 @@ def get_deleted(self, location: str, config_store_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("DeletedConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
- def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements
- self, location: str, config_store_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _purge_deleted_initial(self, location: str, config_store_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1658,39 +1526,42 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_purge_deleted_request(
+ _request = build_purge_deleted_request(
location=location,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self._purge_deleted_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
- _purge_deleted_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -1700,14 +1571,6 @@ def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: A
:type location: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_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:
@@ -1715,13 +1578,13 @@ def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: A
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._purge_deleted_initial( # type: ignore
+ raw_result = self._purge_deleted_initial(
location=location,
config_store_name=config_store_name,
api_version=api_version,
@@ -1730,11 +1593,12 @@ def begin_purge_deleted(self, location: str, config_store_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(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -1743,14 +1607,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_purge_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_key_values_operations.py
index e6c5521b7967..a25fa81001c6 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_key_values_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_key_values_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,12 +16,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.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
@@ -28,12 +30,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -47,7 +48,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -64,7 +65,7 @@ def build_get_request(
"keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -81,7 +82,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -99,7 +100,7 @@ def build_create_or_update_request(
"keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -118,7 +119,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -135,7 +136,7 @@ def build_delete_request(
"keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -164,6 +165,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def get(
@@ -179,12 +181,11 @@ def get(
:param key_value_name: Identifier of key and label combination. Key and label are joined by $
character. Label is optional. Required.
:type key_value_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -195,25 +196,23 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_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
@@ -223,16 +222,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KeyValue", pipeline_response)
+ deserialized = self._deserialize("KeyValue", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -260,7 +255,6 @@ def 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
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
@@ -272,7 +266,7 @@ def create_or_update(
resource_group_name: str,
config_store_name: str,
key_value_name: str,
- key_value_parameters: Optional[IO] = None,
+ key_value_parameters: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
@@ -288,11 +282,10 @@ def create_or_update(
character. Label is optional. Required.
:type key_value_name: str
:param key_value_parameters: The parameters for creating a key-value. Default value is None.
- :type key_value_parameters: IO
+ :type key_value_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
@@ -304,7 +297,7 @@ def create_or_update(
resource_group_name: str,
config_store_name: str,
key_value_name: str,
- key_value_parameters: Optional[Union[_models.KeyValue, IO]] = None,
+ key_value_parameters: Optional[Union[_models.KeyValue, IO[bytes]]] = None,
**kwargs: Any
) -> _models.KeyValue:
"""Creates a key-value.
@@ -318,17 +311,14 @@ def create_or_update(
character. Label is optional. Required.
:type key_value_name: str
:param key_value_parameters: The parameters for creating a key-value. Is either a KeyValue type
- or a IO type. Default value is None.
- :type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ or a IO[bytes] type. Default value is None.
+ :type key_value_parameters: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue or
+ IO[bytes]
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -339,14 +329,14 @@ def create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(key_value_parameters, (IO, bytes)):
+ if isinstance(key_value_parameters, (IOBase, bytes)):
_content = key_value_parameters
else:
if key_value_parameters is not None:
@@ -354,7 +344,7 @@ def create_or_update(
else:
_json = None
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_name,
@@ -363,16 +353,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -382,21 +370,17 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KeyValue", pipeline_response)
+ deserialized = self._deserialize("KeyValue", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
+ return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
-
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -407,40 +391,43 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -456,14 +443,6 @@ def begin_delete(
:param key_value_name: Identifier of key and label combination. Key and label are joined by $
character. Label is optional. Required.
:type key_value_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:
@@ -471,13 +450,13 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_name,
@@ -487,11 +466,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(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -500,14 +480,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_operations.py
index 39df5b41d419..d6957092b87f 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,20 +21,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, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +44,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -57,7 +56,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -74,7 +73,7 @@ def build_list_request(*, skip_token: Optional[str] = None, **kwargs: Any) -> Ht
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -91,11 +90,13 @@ def build_list_request(*, skip_token: Optional[str] = None, **kwargs: Any) -> Ht
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-def build_regional_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
+def build_regional_check_name_availability_request( # pylint: disable=name-too-long
+ location: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -109,7 +110,7 @@ def build_regional_check_name_availability_request(location: str, subscription_i
"location": _SERIALIZER.url("location", location, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -140,6 +141,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@overload
def check_name_availability(
@@ -158,7 +160,6 @@ def check_name_availability(
: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: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -166,17 +167,16 @@ def check_name_availability(
@overload
def check_name_availability(
- self, check_name_availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, check_name_availability_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
:param check_name_availability_parameters: The object containing information for the
availability request. Required.
- :type check_name_availability_parameters: IO
+ :type check_name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -184,23 +184,22 @@ def check_name_availability(
@distributed_trace
def check_name_availability(
- self, check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any
+ self,
+ check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
:param check_name_availability_parameters: The object containing information for the
- availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required.
+ availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type.
+ Required.
:type check_name_availability_parameters:
- ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters 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
+ ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters or IO[bytes]
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -211,34 +210,32 @@ def check_name_availability(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(check_name_availability_parameters, (IO, bytes)):
+ if isinstance(check_name_availability_parameters, (IOBase, bytes)):
_content = check_name_availability_parameters
else:
_json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters")
- request = build_check_name_availability_request(
+ _request = build_check_name_availability_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.check_name_availability.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
@@ -248,16 +245,12 @@ def check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response)
+ deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- check_name_availability.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.OperationDefinition"]:
@@ -268,7 +261,6 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.OperationDefinition]
@@ -277,10 +269,10 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.OperationDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -291,15 +283,13 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
skip_token=skip_token,
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
@@ -310,14 +300,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationDefinitionListResult", pipeline_response)
@@ -327,11 +316,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
@@ -344,8 +333,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/providers/Microsoft.AppConfiguration/operations"}
-
@overload
def regional_check_name_availability(
self,
@@ -366,7 +353,6 @@ def regional_check_name_availability(
: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: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -376,7 +362,7 @@ def regional_check_name_availability(
def regional_check_name_availability(
self,
location: str,
- check_name_availability_parameters: IO,
+ check_name_availability_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -387,11 +373,10 @@ def regional_check_name_availability(
:type location: str
:param check_name_availability_parameters: The object containing information for the
availability request. Required.
- :type check_name_availability_parameters: IO
+ :type check_name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -401,7 +386,7 @@ def regional_check_name_availability(
def regional_check_name_availability(
self,
location: str,
- check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO],
+ check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]],
**kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
@@ -409,18 +394,15 @@ def regional_check_name_availability(
:param location: The location in which uniqueness will be verified. Required.
:type location: str
:param check_name_availability_parameters: The object containing information for the
- availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required.
+ availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type.
+ Required.
:type check_name_availability_parameters:
- ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters 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
+ ~azure.mgmt.appconfiguration.v2022_05_01.models.CheckNameAvailabilityParameters or IO[bytes]
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -431,35 +413,33 @@ def regional_check_name_availability(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(check_name_availability_parameters, (IO, bytes)):
+ if isinstance(check_name_availability_parameters, (IOBase, bytes)):
_content = check_name_availability_parameters
else:
_json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters")
- request = build_regional_check_name_availability_request(
+ _request = build_regional_check_name_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.regional_check_name_availability.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
@@ -469,13 +449,9 @@ def regional_check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response)
+ deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- regional_check_name_availability.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability"
- }
+ return deserialized # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_endpoint_connections_operations.py
index 7a18376296ce..60b4d2671a89 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_endpoint_connections_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_endpoint_connections_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, 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,12 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,13 +44,13 @@
_SERIALIZER.client_side_validation = False
-def build_list_by_configuration_store_request(
+def build_list_by_configuration_store_request( # pylint: disable=name-too-long
resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -65,7 +66,7 @@ def build_list_by_configuration_store_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -86,7 +87,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -105,7 +106,7 @@ def build_get_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -126,7 +127,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -146,7 +147,7 @@ def build_create_or_update_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -169,7 +170,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -188,7 +189,7 @@ def build_delete_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -217,6 +218,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -229,7 +231,6 @@ def list_by_configuration_store(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateEndpointConnection or the result of
cls(response)
:rtype:
@@ -239,10 +240,10 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -253,17 +254,15 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -274,14 +273,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response)
@@ -291,11 +289,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
@@ -308,10 +306,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections"
- }
-
@distributed_trace
def get(
self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any
@@ -325,12 +319,11 @@ def get(
:type config_store_name: str
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -341,25 +334,23 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_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
@@ -369,26 +360,22 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
def _create_or_update_initial(
self,
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO],
+ private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
- ) -> _models.PrivateEndpointConnection:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -399,19 +386,19 @@ def _create_or_update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(private_endpoint_connection, (IO, bytes)):
+ if isinstance(private_endpoint_connection, (IOBase, bytes)):
_content = private_endpoint_connection
else:
_json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -420,40 +407,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("PrivateEndpointConnection", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
-
@overload
def begin_create_or_update(
self,
@@ -482,14 +464,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 PrivateEndpointConnection or the result
of cls(response)
:rtype:
@@ -503,7 +477,7 @@ def begin_create_or_update(
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: IO,
+ private_endpoint_connection: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -520,18 +494,10 @@ def begin_create_or_update(
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
:param private_endpoint_connection: The private endpoint connection properties. Required.
- :type private_endpoint_connection: IO
+ :type private_endpoint_connection: 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 PrivateEndpointConnection or the result
of cls(response)
:rtype:
@@ -545,7 +511,7 @@ def begin_create_or_update(
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO],
+ private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.PrivateEndpointConnection]:
"""Update the state of the specified private endpoint connection associated with the configuration
@@ -560,20 +526,9 @@ def begin_create_or_update(
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
:param private_endpoint_connection: The private endpoint connection properties. Is either a
- PrivateEndpointConnection type or a IO type. Required.
+ PrivateEndpointConnection type or a IO[bytes] type. Required.
:type private_endpoint_connection:
- ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateEndpointConnection 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.appconfiguration.v2022_05_01.models.PrivateEndpointConnection or IO[bytes]
:return: An instance of LROPoller that returns either PrivateEndpointConnection or the result
of cls(response)
:rtype:
@@ -583,7 +538,7 @@ def begin_create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
@@ -602,12 +557,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("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -617,22 +573,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.PrivateEndpointConnection].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return LROPoller[_models.PrivateEndpointConnection](
+ 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, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -643,40 +597,43 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -691,14 +648,6 @@ def begin_delete(
:type config_store_name: str
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_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:
@@ -706,13 +655,13 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -722,11 +671,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(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -735,14 +685,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_link_resources_operations.py
index 6a1086b320c5..9e662c61628f 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_link_resources_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2022_05_01/operations/_private_link_resources_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +7,7 @@
# 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
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -20,20 +20,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, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,13 +39,13 @@
_SERIALIZER.client_side_validation = False
-def build_list_by_configuration_store_request(
+def build_list_by_configuration_store_request( # pylint: disable=name-too-long
resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -63,7 +61,7 @@ def build_list_by_configuration_store_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -80,7 +78,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +95,7 @@ def build_get_request(
"groupName": _SERIALIZER.url("group_name", group_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -126,6 +124,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -138,7 +137,6 @@ def list_by_configuration_store(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateLinkResource or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateLinkResource]
@@ -147,10 +145,10 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -161,17 +159,15 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -182,14 +178,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response)
@@ -199,11 +194,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
@@ -216,10 +211,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources"
- }
-
@distributed_trace
def get(
self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any
@@ -233,12 +224,11 @@ def get(
:type config_store_name: str
:param group_name: The name of the private link resource group. Required.
:type group_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateLinkResource or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2022_05_01.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -249,25 +239,23 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2022-05-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01"))
cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
group_name=group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.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
@@ -277,13 +265,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResource", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_app_configuration_management_client.py
index 62459c73a097..c1775c57db1e 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_app_configuration_management_client.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_app_configuration_management_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 .._serialization import Deserializer, Serializer
@@ -70,26 +73,46 @@ def __init__(
self._config = AppConfigurationManagementClientConfiguration(
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)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.configuration_stores = ConfigurationStoresOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2023-03-01"
)
- self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
+ self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01")
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2023-03-01"
)
self.private_link_resources = PrivateLinkResourcesOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2023-03-01"
)
- self.key_values = KeyValuesOperations(self._client, self._config, self._serialize, self._deserialize)
- self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.key_values = KeyValuesOperations(
+ self._client, self._config, self._serialize, self._deserialize, "2023-03-01"
+ )
+ self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01")
- 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
@@ -109,12 +132,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) -> "AppConfigurationManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_configuration.py
index ea2833c5f763..e96d4e0ee6db 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_configuration.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_configuration.py
@@ -6,26 +6,19 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-import sys
from typing import Any, TYPE_CHECKING
-from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
from ._version import VERSION
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class AppConfigurationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AppConfigurationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AppConfigurationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -41,8 +34,7 @@ class AppConfigurationManagementClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs)
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", "2023-03-01")
+ api_version: str = kwargs.pop("api_version", "2023-03-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@@ -54,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-appconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -62,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_metadata.json b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_metadata.json
index 12c61872593a..59dd4bc9fa28 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_metadata.json
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_metadata.json
@@ -8,10 +8,10 @@
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
- "has_lro_operations": true,
+ "has_public_lro_operations": true,
"client_side_validation": false,
- "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
- "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"AppConfigurationManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"global_parameters": {
"sync": {
@@ -101,8 +101,8 @@
"credential_scopes": ["https://management.azure.com/.default"],
"credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
"credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
- "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
- "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
+ "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
+ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"configuration_stores": "ConfigurationStoresOperations",
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_vendor.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_vendor.py
deleted file mode 100644
index bd0df84f5319..000000000000
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_vendor.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# --------------------------------------------------------------------------
-# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for license information.
-# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is regenerated.
-# --------------------------------------------------------------------------
-
-from typing import List, cast
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
-
-
-def _format_url_section(template, **kwargs):
- components = template.split("/")
- while components:
- try:
- return template.format(**kwargs)
- except KeyError as key:
- # Need the cast, as for some reasons "split" is typed as list[str | Any]
- formatted_components = cast(List[str], template.split("/"))
- components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
- template = "/".join(components)
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_version.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_version.py
index cac9f5d10f8b..e5754a47ce68 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_version.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "3.0.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/_app_configuration_management_client.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/_app_configuration_management_client.py
index 9a0aaf0403a2..92a0b8c02810 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/_app_configuration_management_client.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/_app_configuration_management_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
@@ -70,26 +73,48 @@ def __init__(
self._config = AppConfigurationManagementClientConfiguration(
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)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.configuration_stores = ConfigurationStoresOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2023-03-01"
)
- self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
+ self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01")
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2023-03-01"
)
self.private_link_resources = PrivateLinkResourcesOperations(
- self._client, self._config, self._serialize, self._deserialize
+ self._client, self._config, self._serialize, self._deserialize, "2023-03-01"
)
- self.key_values = KeyValuesOperations(self._client, self._config, self._serialize, self._deserialize)
- self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize)
+ self.key_values = KeyValuesOperations(
+ self._client, self._config, self._serialize, self._deserialize, "2023-03-01"
+ )
+ self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize, "2023-03-01")
- 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
@@ -109,12 +134,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) -> "AppConfigurationManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/_configuration.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/_configuration.py
index 8dc112b38539..02a6b7c3be0d 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/_configuration.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/_configuration.py
@@ -6,26 +6,19 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-import sys
from typing import Any, TYPE_CHECKING
-from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
-else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
-
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class AppConfigurationManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
+class AppConfigurationManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AppConfigurationManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -41,8 +34,7 @@ class AppConfigurationManagementClientConfiguration(Configuration): # pylint: d
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- super(AppConfigurationManagementClientConfiguration, self).__init__(**kwargs)
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", "2023-03-01")
+ api_version: str = kwargs.pop("api_version", "2023-03-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
@@ -54,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-appconfiguration/{}".format(VERSION))
+ self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
@@ -62,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_configuration_stores_operations.py
index 1770f1629278..6c78c0eabd68 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_configuration_stores_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_configuration_stores_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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._configuration_stores_operations import (
build_create_request,
build_delete_request,
@@ -45,10 +46,10 @@
build_update_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -71,6 +72,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.ConfigurationStore"]:
@@ -81,7 +83,6 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConfigurationStore or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2023_03_01.models.ConfigurationStore]
@@ -90,10 +91,10 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -104,16 +105,14 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
skip_token=skip_token,
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
@@ -124,14 +123,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response)
@@ -141,11 +139,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
@@ -158,8 +156,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"}
-
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any
@@ -174,7 +170,6 @@ def list_by_resource_group(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConfigurationStore or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2023_03_01.models.ConfigurationStore]
@@ -183,10 +178,10 @@ def list_by_resource_group(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -197,17 +192,15 @@ def list_by_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_resource_group_request(
+ _request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
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
@@ -218,14 +211,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response)
@@ -235,11 +227,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
@@ -252,10 +244,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/Microsoft.AppConfiguration/configurationStores"
- }
-
@distributed_trace_async
async def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore:
"""Gets the properties of the specified configuration store.
@@ -265,12 +253,11 @@ async def get(self, resource_group_name: str, config_store_name: str, **kwargs:
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ConfigurationStore or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.ConfigurationStore
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -281,24 +268,22 @@ async def get(self, resource_group_name: str, config_store_name: str, **kwargs:
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_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
@@ -308,25 +293,21 @@ async def get(self, resource_group_name: str, config_store_name: str, **kwargs:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
async def _create_initial(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: Union[_models.ConfigurationStore, IO],
+ config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]],
**kwargs: Any
- ) -> _models.ConfigurationStore:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -337,19 +318,19 @@ async def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(config_store_creation_parameters, (IO, bytes)):
+ if isinstance(config_store_creation_parameters, (IOBase, bytes)):
_content = config_store_creation_parameters
else:
_json = self._serialize.body(config_store_creation_parameters, "ConfigurationStore")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -357,40 +338,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_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("ConfigurationStore", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ConfigurationStore", 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_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
-
@overload
async def begin_create(
self,
@@ -415,14 +391,6 @@ async def begin_create(
: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 ConfigurationStore or the result of
cls(response)
:rtype:
@@ -435,7 +403,7 @@ async def begin_create(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: IO,
+ config_store_creation_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -449,18 +417,10 @@ async def begin_create(
:type config_store_name: str
:param config_store_creation_parameters: The parameters for creating a configuration store.
Required.
- :type config_store_creation_parameters: IO
+ :type config_store_creation_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -473,7 +433,7 @@ async def begin_create(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: Union[_models.ConfigurationStore, IO],
+ config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationStore]:
"""Creates a configuration store with the specified parameters.
@@ -484,20 +444,9 @@ async def begin_create(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param config_store_creation_parameters: The parameters for creating a configuration store. Is
- either a ConfigurationStore type or a IO type. Required.
+ either a ConfigurationStore type or a IO[bytes] type. Required.
:type config_store_creation_parameters:
- ~azure.mgmt.appconfiguration.v2023_03_01.models.ConfigurationStore 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.appconfiguration.v2023_03_01.models.ConfigurationStore or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -507,7 +456,7 @@ async def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
@@ -525,12 +474,13 @@ async def begin_create(
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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -540,22 +490,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.ConfigurationStore].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.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return AsyncLROPoller[_models.ConfigurationStore](
+ 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, config_store_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -566,39 +514,42 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -611,14 +562,6 @@ async def begin_delete(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_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:
@@ -626,13 +569,13 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
api_version=api_version,
@@ -641,11 +584,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -654,26 +598,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
async def _update_initial(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO],
+ config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.ConfigurationStore:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -684,19 +624,19 @@ async def _update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(config_store_update_parameters, (IO, bytes)):
+ if isinstance(config_store_update_parameters, (IOBase, bytes)):
_content = config_store_update_parameters
else:
_json = self._serialize.body(config_store_update_parameters, "ConfigurationStoreUpdateParameters")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -704,40 +644,35 @@ async def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._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("ConfigurationStore", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ConfigurationStore", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
-
@overload
async def begin_update(
self,
@@ -762,14 +697,6 @@ async def begin_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 ConfigurationStore or the result of
cls(response)
:rtype:
@@ -782,7 +709,7 @@ async def begin_update(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: IO,
+ config_store_update_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -796,18 +723,10 @@ async def begin_update(
:type config_store_name: str
:param config_store_update_parameters: The parameters for updating a configuration store.
Required.
- :type config_store_update_parameters: IO
+ :type config_store_update_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -820,7 +739,7 @@ async def begin_update(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO],
+ config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.ConfigurationStore]:
"""Updates a configuration store with the specified parameters.
@@ -831,20 +750,9 @@ async def begin_update(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param config_store_update_parameters: The parameters for updating a configuration store. Is
- either a ConfigurationStoreUpdateParameters type or a IO type. Required.
+ either a ConfigurationStoreUpdateParameters type or a IO[bytes] type. Required.
:type config_store_update_parameters:
- ~azure.mgmt.appconfiguration.v2023_03_01.models.ConfigurationStoreUpdateParameters 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.appconfiguration.v2023_03_01.models.ConfigurationStoreUpdateParameters or IO[bytes]
:return: An instance of AsyncLROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -854,7 +762,7 @@ async def begin_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
@@ -872,12 +780,13 @@ async def begin_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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -887,17 +796,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.ConfigurationStore].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_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return AsyncLROPoller[_models.ConfigurationStore](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list_keys(
@@ -915,7 +822,6 @@ def list_keys(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ApiKey or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2023_03_01.models.ApiKey]
@@ -924,10 +830,10 @@ def list_keys(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.ApiKeyListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -938,18 +844,16 @@ def list_keys(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_keys_request(
+ _request = build_list_keys_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_keys.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
@@ -960,14 +864,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ApiKeyListResult", pipeline_response)
@@ -977,11 +880,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
@@ -994,10 +897,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_keys.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys"
- }
-
@overload
async def regenerate_key(
self,
@@ -1021,7 +920,6 @@ async def regenerate_key(
: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: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1032,7 +930,7 @@ async def regenerate_key(
self,
resource_group_name: str,
config_store_name: str,
- regenerate_key_parameters: IO,
+ regenerate_key_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1045,11 +943,10 @@ async def regenerate_key(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param regenerate_key_parameters: The parameters for regenerating an access key. Required.
- :type regenerate_key_parameters: IO
+ :type regenerate_key_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1060,7 +957,7 @@ async def regenerate_key(
self,
resource_group_name: str,
config_store_name: str,
- regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO],
+ regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO[bytes]],
**kwargs: Any
) -> _models.ApiKey:
"""Regenerates an access key for the specified configuration store.
@@ -1071,18 +968,14 @@ async def regenerate_key(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param regenerate_key_parameters: The parameters for regenerating an access key. Is either a
- RegenerateKeyParameters type or a IO type. Required.
+ RegenerateKeyParameters type or a IO[bytes] type. Required.
:type regenerate_key_parameters:
- ~azure.mgmt.appconfiguration.v2023_03_01.models.RegenerateKeyParameters 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
+ ~azure.mgmt.appconfiguration.v2023_03_01.models.RegenerateKeyParameters or IO[bytes]
:return: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1093,19 +986,19 @@ async def regenerate_key(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(regenerate_key_parameters, (IO, bytes)):
+ if isinstance(regenerate_key_parameters, (IOBase, bytes)):
_content = regenerate_key_parameters
else:
_json = self._serialize.body(regenerate_key_parameters, "RegenerateKeyParameters")
- request = build_regenerate_key_request(
+ _request = build_regenerate_key_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -1113,16 +1006,14 @@ async def regenerate_key(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.regenerate_key.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
@@ -1132,22 +1023,17 @@ async def regenerate_key(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiKey", pipeline_response)
+ deserialized = self._deserialize("ApiKey", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- regenerate_key.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_deleted(self, **kwargs: Any) -> AsyncIterable["_models.DeletedConfigurationStore"]:
"""Gets information about the deleted configuration stores in a subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DeletedConfigurationStore or the result of
cls(response)
:rtype:
@@ -1157,10 +1043,10 @@ def list_deleted(self, **kwargs: Any) -> AsyncIterable["_models.DeletedConfigura
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.DeletedConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1171,15 +1057,13 @@ def list_deleted(self, **kwargs: Any) -> AsyncIterable["_models.DeletedConfigura
def prepare_request(next_link=None):
if not next_link:
- request = build_list_deleted_request(
+ _request = build_list_deleted_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_deleted.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
@@ -1190,14 +1074,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DeletedConfigurationStoreListResult", pipeline_response)
@@ -1207,11 +1090,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
@@ -1224,10 +1107,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores"
- }
-
@distributed_trace_async
async def get_deleted(
self, location: str, config_store_name: str, **kwargs: Any
@@ -1238,12 +1117,11 @@ async def get_deleted(
:type location: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DeletedConfigurationStore or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.DeletedConfigurationStore
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1254,24 +1132,22 @@ async def get_deleted(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None)
- request = build_get_deleted_request(
+ _request = build_get_deleted_request(
location=location,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_deleted.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
@@ -1281,21 +1157,17 @@ async def get_deleted(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
- async def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements
+ async def _purge_deleted_initial(
self, location: str, config_store_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1306,39 +1178,42 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_purge_deleted_request(
+ _request = build_purge_deleted_request(
location=location,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self._purge_deleted_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
- _purge_deleted_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
@@ -1348,14 +1223,6 @@ async def begin_purge_deleted(self, location: str, config_store_name: str, **kwa
:type location: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_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:
@@ -1363,13 +1230,13 @@ async def begin_purge_deleted(self, location: str, config_store_name: str, **kwa
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._purge_deleted_initial( # type: ignore
+ raw_result = await self._purge_deleted_initial(
location=location,
config_store_name=config_store_name,
api_version=api_version,
@@ -1378,11 +1245,12 @@ async def begin_purge_deleted(self, location: str, config_store_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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -1391,14 +1259,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_purge_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_key_values_operations.py
index 2f0365c1c58f..cbaaa9df9ff0 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_key_values_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_key_values_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,25 +16,25 @@
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_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._key_values_operations import build_create_or_update_request, build_delete_request, build_get_request
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -56,12 +57,15 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace_async
async def get(
self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any
) -> _models.KeyValue:
- """Gets the properties of the specified key-value.
+ """Gets the properties of the specified key-value. NOTE: This operation is intended for use in ARM
+ Template deployments. For all other scenarios involving App Configuration key-values the data
+ plane API should be used instead.
:param resource_group_name: The name of the resource group to which the container registry
belongs. Required.
@@ -71,12 +75,11 @@ async def get(
:param key_value_name: Identifier of key and label combination. Key and label are joined by $
character. Label is optional. Required.
:type key_value_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -87,25 +90,23 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_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
@@ -115,16 +116,12 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KeyValue", pipeline_response)
+ deserialized = self._deserialize("KeyValue", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
@overload
async def create_or_update(
@@ -137,7 +134,9 @@ async def create_or_update(
content_type: str = "application/json",
**kwargs: Any
) -> _models.KeyValue:
- """Creates a key-value.
+ """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For
+ all other scenarios involving App Configuration key-values the data plane API should be used
+ instead.
:param resource_group_name: The name of the resource group to which the container registry
belongs. Required.
@@ -152,7 +151,6 @@ async def 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
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
@@ -164,12 +162,14 @@ async def create_or_update(
resource_group_name: str,
config_store_name: str,
key_value_name: str,
- key_value_parameters: Optional[IO] = None,
+ key_value_parameters: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.KeyValue:
- """Creates a key-value.
+ """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For
+ all other scenarios involving App Configuration key-values the data plane API should be used
+ instead.
:param resource_group_name: The name of the resource group to which the container registry
belongs. Required.
@@ -180,11 +180,10 @@ async def create_or_update(
character. Label is optional. Required.
:type key_value_name: str
:param key_value_parameters: The parameters for creating a key-value. Default value is None.
- :type key_value_parameters: IO
+ :type key_value_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
@@ -196,10 +195,12 @@ async def create_or_update(
resource_group_name: str,
config_store_name: str,
key_value_name: str,
- key_value_parameters: Optional[Union[_models.KeyValue, IO]] = None,
+ key_value_parameters: Optional[Union[_models.KeyValue, IO[bytes]]] = None,
**kwargs: Any
) -> _models.KeyValue:
- """Creates a key-value.
+ """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For
+ all other scenarios involving App Configuration key-values the data plane API should be used
+ instead.
:param resource_group_name: The name of the resource group to which the container registry
belongs. Required.
@@ -210,17 +211,14 @@ async def create_or_update(
character. Label is optional. Required.
:type key_value_name: str
:param key_value_parameters: The parameters for creating a key-value. Is either a KeyValue type
- or a IO type. Default value is None.
- :type key_value_parameters: ~azure.mgmt.appconfiguration.v2023_03_01.models.KeyValue or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ or a IO[bytes] type. Default value is None.
+ :type key_value_parameters: ~azure.mgmt.appconfiguration.v2023_03_01.models.KeyValue or
+ IO[bytes]
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -231,14 +229,14 @@ async def create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(key_value_parameters, (IO, bytes)):
+ if isinstance(key_value_parameters, (IOBase, bytes)):
_content = key_value_parameters
else:
if key_value_parameters is not None:
@@ -246,7 +244,7 @@ async def create_or_update(
else:
_json = None
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_name,
@@ -255,16 +253,14 @@ async def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -274,21 +270,17 @@ async def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KeyValue", pipeline_response)
+ deserialized = self._deserialize("KeyValue", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
+ return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
-
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -299,46 +291,51 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
- """Deletes a key-value.
+ """Deletes a key-value. NOTE: This operation is intended for use in ARM Template deployments. For
+ all other scenarios involving App Configuration key-values the data plane API should be used
+ instead.
:param resource_group_name: The name of the resource group to which the container registry
belongs. Required.
@@ -348,14 +345,6 @@ async def begin_delete(
:param key_value_name: Identifier of key and label combination. Key and label are joined by $
character. Label is optional. Required.
:type key_value_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:
@@ -363,13 +352,13 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_name,
@@ -379,11 +368,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -392,14 +382,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_operations.py
index 9cdc850c5c67..d0eca0671495 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
+from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,25 +21,23 @@
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._operations import (
build_check_name_availability_request,
build_list_request,
build_regional_check_name_availability_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -61,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@overload
async def check_name_availability(
@@ -79,7 +79,6 @@ async def check_name_availability(
: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: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -87,17 +86,16 @@ async def check_name_availability(
@overload
async def check_name_availability(
- self, check_name_availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, check_name_availability_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
:param check_name_availability_parameters: The object containing information for the
availability request. Required.
- :type check_name_availability_parameters: IO
+ :type check_name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -105,23 +103,22 @@ async def check_name_availability(
@distributed_trace_async
async def check_name_availability(
- self, check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any
+ self,
+ check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
:param check_name_availability_parameters: The object containing information for the
- availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required.
+ availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type.
+ Required.
:type check_name_availability_parameters:
- ~azure.mgmt.appconfiguration.v2023_03_01.models.CheckNameAvailabilityParameters 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
+ ~azure.mgmt.appconfiguration.v2023_03_01.models.CheckNameAvailabilityParameters or IO[bytes]
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -132,34 +129,32 @@ async def check_name_availability(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(check_name_availability_parameters, (IO, bytes)):
+ if isinstance(check_name_availability_parameters, (IOBase, bytes)):
_content = check_name_availability_parameters
else:
_json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters")
- request = build_check_name_availability_request(
+ _request = build_check_name_availability_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.check_name_availability.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
@@ -169,16 +164,12 @@ async def check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response)
+ deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- check_name_availability.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.OperationDefinition"]:
@@ -189,7 +180,6 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationDefinition or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2023_03_01.models.OperationDefinition]
@@ -198,10 +188,10 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.OperationDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -212,15 +202,13 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> AsyncIterable
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
skip_token=skip_token,
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
@@ -231,14 +219,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationDefinitionListResult", pipeline_response)
@@ -248,11 +235,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
@@ -265,8 +252,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list.metadata = {"url": "/providers/Microsoft.AppConfiguration/operations"}
-
@overload
async def regional_check_name_availability(
self,
@@ -287,7 +272,6 @@ async def regional_check_name_availability(
: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: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -297,7 +281,7 @@ async def regional_check_name_availability(
async def regional_check_name_availability(
self,
location: str,
- check_name_availability_parameters: IO,
+ check_name_availability_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -308,11 +292,10 @@ async def regional_check_name_availability(
:type location: str
:param check_name_availability_parameters: The object containing information for the
availability request. Required.
- :type check_name_availability_parameters: IO
+ :type check_name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -322,7 +305,7 @@ async def regional_check_name_availability(
async def regional_check_name_availability(
self,
location: str,
- check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO],
+ check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]],
**kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
@@ -330,18 +313,15 @@ async def regional_check_name_availability(
:param location: The location in which uniqueness will be verified. Required.
:type location: str
:param check_name_availability_parameters: The object containing information for the
- availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required.
+ availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type.
+ Required.
:type check_name_availability_parameters:
- ~azure.mgmt.appconfiguration.v2023_03_01.models.CheckNameAvailabilityParameters 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
+ ~azure.mgmt.appconfiguration.v2023_03_01.models.CheckNameAvailabilityParameters or IO[bytes]
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -352,35 +332,33 @@ async def regional_check_name_availability(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(check_name_availability_parameters, (IO, bytes)):
+ if isinstance(check_name_availability_parameters, (IOBase, bytes)):
_content = check_name_availability_parameters
else:
_json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters")
- request = build_regional_check_name_availability_request(
+ _request = build_regional_check_name_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.regional_check_name_availability.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
@@ -390,13 +368,9 @@ async def regional_check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response)
+ deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- regional_check_name_availability.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability"
- }
+ return deserialized # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_private_endpoint_connections_operations.py
index 6a53daf8e89d..489d5e1e5a5b 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_private_endpoint_connections_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_private_endpoint_connections_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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._private_endpoint_connections_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,10 +39,10 @@
build_list_by_configuration_store_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -76,7 +78,6 @@ def list_by_configuration_store(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateEndpointConnection or the result of
cls(response)
:rtype:
@@ -86,10 +87,10 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -100,17 +101,15 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -121,14 +120,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response)
@@ -138,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
@@ -155,10 +153,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections"
- }
-
@distributed_trace_async
async def get(
self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any
@@ -172,12 +166,11 @@ async def get(
:type config_store_name: str
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -188,25 +181,23 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_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
@@ -216,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("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO],
+ private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
- ) -> _models.PrivateEndpointConnection:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -246,19 +233,19 @@ async def _create_or_update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(private_endpoint_connection, (IO, bytes)):
+ if isinstance(private_endpoint_connection, (IOBase, bytes)):
_content = private_endpoint_connection
else:
_json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -267,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("PrivateEndpointConnection", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
-
@overload
async def begin_create_or_update(
self,
@@ -329,14 +311,6 @@ async def begin_create_or_update(
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the
result of cls(response)
:rtype:
@@ -350,7 +324,7 @@ async def begin_create_or_update(
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: IO,
+ private_endpoint_connection: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -367,18 +341,10 @@ async def begin_create_or_update(
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
:param private_endpoint_connection: The private endpoint connection properties. Required.
- :type private_endpoint_connection: IO
+ :type private_endpoint_connection: 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 PrivateEndpointConnection or the
result of cls(response)
:rtype:
@@ -392,7 +358,7 @@ async def begin_create_or_update(
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO],
+ private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateEndpointConnection]:
"""Update the state of the specified private endpoint connection associated with the configuration
@@ -407,20 +373,9 @@ async def begin_create_or_update(
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
:param private_endpoint_connection: The private endpoint connection properties. Is either a
- PrivateEndpointConnection type or a IO type. Required.
+ PrivateEndpointConnection type or a IO[bytes] type. Required.
:type private_endpoint_connection:
- ~azure.mgmt.appconfiguration.v2023_03_01.models.PrivateEndpointConnection 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.appconfiguration.v2023_03_01.models.PrivateEndpointConnection or IO[bytes]
:return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the
result of cls(response)
:rtype:
@@ -430,7 +385,7 @@ async def begin_create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
@@ -449,12 +404,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("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -464,22 +420,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return AsyncLROPoller[_models.PrivateEndpointConnection](
+ 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, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -490,40 +444,43 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -538,14 +495,6 @@ async def begin_delete(
:type config_store_name: str
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_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:
@@ -553,13 +502,13 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -569,11 +518,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(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
@@ -582,14 +532,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_private_link_resources_operations.py
index 193bb8bb5cf4..6e25b0de5bf4 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_private_link_resources_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_private_link_resources_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +7,7 @@
# 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
+from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -20,24 +20,22 @@
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._private_link_resources_operations import (
build_get_request,
build_list_by_configuration_store_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -60,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -72,7 +71,6 @@ def list_by_configuration_store(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateLinkResource or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2023_03_01.models.PrivateLinkResource]
@@ -81,10 +79,10 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -95,17 +93,15 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -116,14 +112,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response)
@@ -133,11 +128,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 +145,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources"
- }
-
@distributed_trace_async
async def get(
self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any
@@ -167,12 +158,11 @@ async def get(
:type config_store_name: str
:param group_name: The name of the private link resource group. Required.
:type group_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateLinkResource or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -183,25 +173,23 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
group_name=group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.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,13 +199,9 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResource", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_replicas_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_replicas_operations.py
index 7bf2c53da59f..f99b99a945bb 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_replicas_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/aio/operations/_replicas_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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._replicas_operations import (
build_create_request,
build_delete_request,
@@ -38,10 +39,10 @@
build_list_by_configuration_store_request,
)
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -64,6 +65,7 @@ def __init__(self, *args, **kwargs) -> None:
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -81,7 +83,6 @@ def list_by_configuration_store(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Replica or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appconfiguration.v2023_03_01.models.Replica]
@@ -90,10 +91,10 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.ReplicaListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -104,18 +105,16 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -126,14 +125,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ReplicaListResult", pipeline_response)
@@ -143,11 +141,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
@@ -160,10 +158,6 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas"
- }
-
@distributed_trace_async
async def get(
self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any
@@ -177,12 +171,11 @@ async def get(
:type config_store_name: str
:param replica_name: The name of the replica. Required.
:type replica_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Replica or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.Replica
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -193,25 +186,23 @@ async def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.Replica] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_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
@@ -221,26 +212,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("Replica", pipeline_response)
+ deserialized = self._deserialize("Replica", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return deserialized # type: ignore
async def _create_initial(
self,
resource_group_name: str,
config_store_name: str,
replica_name: str,
- replica_creation_parameters: Union[_models.Replica, IO],
+ replica_creation_parameters: Union[_models.Replica, IO[bytes]],
**kwargs: Any
- ) -> _models.Replica:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -251,19 +238,19 @@ async def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Replica] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(replica_creation_parameters, (IO, bytes)):
+ if isinstance(replica_creation_parameters, (IOBase, bytes)):
_content = replica_creation_parameters
else:
_json = self._serialize.body(replica_creation_parameters, "Replica")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_name,
@@ -272,40 +259,35 @@ async def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_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("Replica", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Replica", 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_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
-
@overload
async def begin_create(
self,
@@ -331,14 +313,6 @@ async def begin_create(
: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 Replica or the result of
cls(response)
:rtype:
@@ -352,7 +326,7 @@ async def begin_create(
resource_group_name: str,
config_store_name: str,
replica_name: str,
- replica_creation_parameters: IO,
+ replica_creation_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -367,18 +341,10 @@ async def begin_create(
:param replica_name: The name of the replica. Required.
:type replica_name: str
:param replica_creation_parameters: The parameters for creating a replica. Required.
- :type replica_creation_parameters: IO
+ :type replica_creation_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
- this operation to not poll, or pass in your own initialized polling object for a personal
- polling strategy.
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Replica or the result of
cls(response)
:rtype:
@@ -392,7 +358,7 @@ async def begin_create(
resource_group_name: str,
config_store_name: str,
replica_name: str,
- replica_creation_parameters: Union[_models.Replica, IO],
+ replica_creation_parameters: Union[_models.Replica, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.Replica]:
"""Creates a replica with the specified parameters.
@@ -405,20 +371,9 @@ async def begin_create(
:param replica_name: The name of the replica. Required.
:type replica_name: str
:param replica_creation_parameters: The parameters for creating a replica. Is either a Replica
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type replica_creation_parameters: ~azure.mgmt.appconfiguration.v2023_03_01.models.Replica 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.
+ IO[bytes]
:return: An instance of AsyncLROPoller that returns either Replica or the result of
cls(response)
:rtype:
@@ -428,7 +383,7 @@ async def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Replica] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
@@ -447,12 +402,13 @@ async def begin_create(
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("Replica", pipeline_response)
+ deserialized = self._deserialize("Replica", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -465,22 +421,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return AsyncLROPoller.from_continuation_token(
+ return AsyncLROPoller[_models.Replica].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.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return AsyncLROPoller[_models.Replica](
+ 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, config_store_name: str, replica_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -491,30 +445,33 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_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)
@@ -525,12 +482,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
"str", response.headers.get("Azure-AsyncOperation")
)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -545,14 +502,6 @@ async def begin_delete(
:type config_store_name: str
:param replica_name: The name of the replica. Required.
:type replica_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:
@@ -560,13 +509,13 @@ async def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_name,
@@ -576,11 +525,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(
@@ -592,14 +542,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/models/_models_py3.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/models/_models_py3.py
index f6a1c059876d..92161cce3f5b 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/models/_models_py3.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/models/_models_py3.py
@@ -97,7 +97,7 @@ def __init__(
class CheckNameAvailabilityParameters(_serialization.Model):
"""Parameters used for checking whether a resource name is available.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar name: The name to check for availability. Required.
:vartype name: str
@@ -136,7 +136,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
@@ -171,10 +171,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
@@ -220,10 +220,10 @@ class ConfigurationStore(TrackedResource): # pylint: disable=too-many-instance-
Variables are only populated by the server, and will be ignored when sending a request.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar id: Fully qualified resource ID for the resource. 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
@@ -1597,7 +1597,7 @@ class ResourceIdentity(_serialization.Model):
:vartype type: str or ~azure.mgmt.appconfiguration.v2023_03_01.models.IdentityType
:ivar user_assigned_identities: The list of user-assigned identities associated with the
resource. The user-assigned identity dictionary keys will be ARM resource ids in the form:
- '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
+ '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long
:vartype user_assigned_identities: dict[str,
~azure.mgmt.appconfiguration.v2023_03_01.models.UserIdentity]
:ivar principal_id: The principal id of the identity. This property will only be provided for a
@@ -1635,7 +1635,7 @@ def __init__(
:paramtype type: str or ~azure.mgmt.appconfiguration.v2023_03_01.models.IdentityType
:keyword user_assigned_identities: The list of user-assigned identities associated with the
resource. The user-assigned identity dictionary keys will be ARM resource ids in the form:
- '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
+ '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long
:paramtype user_assigned_identities: dict[str,
~azure.mgmt.appconfiguration.v2023_03_01.models.UserIdentity]
"""
@@ -1685,7 +1685,7 @@ def __init__(
class Sku(_serialization.Model):
"""Describes a configuration store SKU.
- All required parameters must be populated in order to send to Azure.
+ All required parameters must be populated in order to send to server.
:ivar name: The SKU name of the configuration store. Required.
:vartype name: str
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_configuration_stores_operations.py
index 1e580859fb0e..96e03d005872 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_configuration_stores_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_configuration_stores_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, 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,12 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -47,7 +48,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -58,7 +59,7 @@ def build_list_request(subscription_id: str, *, skip_token: Optional[str] = None
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -77,7 +78,7 @@ def build_list_by_resource_group_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -90,7 +91,7 @@ def build_list_by_resource_group_request(
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -109,7 +110,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -125,7 +126,7 @@ def build_get_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -142,7 +143,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -159,7 +160,7 @@ def build_create_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -178,7 +179,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -194,7 +195,7 @@ def build_delete_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -211,7 +212,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -228,7 +229,7 @@ def build_update_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -252,7 +253,7 @@ def build_list_keys_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -268,7 +269,7 @@ def build_list_keys_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -287,7 +288,7 @@ def build_regenerate_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -304,7 +305,7 @@ def build_regenerate_key_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -321,7 +322,7 @@ def build_list_deleted_request(subscription_id: str, **kwargs: Any) -> HttpReque
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -333,7 +334,7 @@ def build_list_deleted_request(subscription_id: str, **kwargs: Any) -> HttpReque
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -350,7 +351,7 @@ def build_get_deleted_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -366,7 +367,7 @@ def build_get_deleted_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -383,7 +384,7 @@ def build_purge_deleted_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -399,7 +400,7 @@ def build_purge_deleted_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -428,6 +429,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ConfigurationStore"]:
@@ -438,7 +440,6 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConfigurationStore or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2023_03_01.models.ConfigurationStore]
@@ -447,10 +448,10 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -461,16 +462,14 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
subscription_id=self._config.subscription_id,
skip_token=skip_token,
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
@@ -481,14 +480,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response)
@@ -498,11 +496,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
@@ -515,8 +513,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores"}
-
@distributed_trace
def list_by_resource_group(
self, resource_group_name: str, skip_token: Optional[str] = None, **kwargs: Any
@@ -531,7 +527,6 @@ def list_by_resource_group(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConfigurationStore or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2023_03_01.models.ConfigurationStore]
@@ -540,10 +535,10 @@ def list_by_resource_group(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.ConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -554,17 +549,15 @@ def list_by_resource_group(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_resource_group_request(
+ _request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
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
@@ -575,14 +568,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ConfigurationStoreListResult", pipeline_response)
@@ -592,11 +584,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
@@ -609,10 +601,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_resource_group.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores"
- }
-
@distributed_trace
def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> _models.ConfigurationStore:
"""Gets the properties of the specified configuration store.
@@ -622,12 +610,11 @@ def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ConfigurationStore or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.ConfigurationStore
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -638,24 +625,22 @@ def get(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_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
@@ -665,25 +650,21 @@ def get(self, resource_group_name: str, config_store_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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
def _create_initial(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: Union[_models.ConfigurationStore, IO],
+ config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]],
**kwargs: Any
- ) -> _models.ConfigurationStore:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -694,19 +675,19 @@ def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(config_store_creation_parameters, (IO, bytes)):
+ if isinstance(config_store_creation_parameters, (IOBase, bytes)):
_content = config_store_creation_parameters
else:
_json = self._serialize.body(config_store_creation_parameters, "ConfigurationStore")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -714,40 +695,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_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("ConfigurationStore", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ConfigurationStore", 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_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
-
@overload
def begin_create(
self,
@@ -772,14 +748,6 @@ def begin_create(
: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 ConfigurationStore or the result of
cls(response)
:rtype:
@@ -792,7 +760,7 @@ def begin_create(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: IO,
+ config_store_creation_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -806,18 +774,10 @@ def begin_create(
:type config_store_name: str
:param config_store_creation_parameters: The parameters for creating a configuration store.
Required.
- :type config_store_creation_parameters: IO
+ :type config_store_creation_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -830,7 +790,7 @@ def begin_create(
self,
resource_group_name: str,
config_store_name: str,
- config_store_creation_parameters: Union[_models.ConfigurationStore, IO],
+ config_store_creation_parameters: Union[_models.ConfigurationStore, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ConfigurationStore]:
"""Creates a configuration store with the specified parameters.
@@ -841,20 +801,9 @@ def begin_create(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param config_store_creation_parameters: The parameters for creating a configuration store. Is
- either a ConfigurationStore type or a IO type. Required.
+ either a ConfigurationStore type or a IO[bytes] type. Required.
:type config_store_creation_parameters:
- ~azure.mgmt.appconfiguration.v2023_03_01.models.ConfigurationStore 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.appconfiguration.v2023_03_01.models.ConfigurationStore or IO[bytes]
:return: An instance of LROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -864,7 +813,7 @@ def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
@@ -882,12 +831,13 @@ def begin_create(
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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -897,22 +847,18 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.ConfigurationStore].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.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return LROPoller[_models.ConfigurationStore](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
- def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, config_store_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _delete_initial(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -923,39 +869,42 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -966,14 +915,6 @@ def begin_delete(self, resource_group_name: str, config_store_name: str, **kwarg
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_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:
@@ -981,13 +922,13 @@ def begin_delete(self, resource_group_name: str, config_store_name: str, **kwarg
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
api_version=api_version,
@@ -996,11 +937,12 @@ def begin_delete(self, resource_group_name: str, config_store_name: str, **kwarg
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(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -1009,26 +951,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[None].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_delete.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
def _update_initial(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO],
+ config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.ConfigurationStore:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1039,19 +977,19 @@ def _update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(config_store_update_parameters, (IO, bytes)):
+ if isinstance(config_store_update_parameters, (IOBase, bytes)):
_content = config_store_update_parameters
else:
_json = self._serialize.body(config_store_update_parameters, "ConfigurationStoreUpdateParameters")
- request = build_update_request(
+ _request = build_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -1059,40 +997,35 @@ def _update_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._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("ConfigurationStore", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ConfigurationStore", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- _update_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
-
@overload
def begin_update(
self,
@@ -1117,14 +1050,6 @@ def begin_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 ConfigurationStore or the result of
cls(response)
:rtype:
@@ -1137,7 +1062,7 @@ def begin_update(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: IO,
+ config_store_update_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1151,18 +1076,10 @@ def begin_update(
:type config_store_name: str
:param config_store_update_parameters: The parameters for updating a configuration store.
Required.
- :type config_store_update_parameters: IO
+ :type config_store_update_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -1175,7 +1092,7 @@ def begin_update(
self,
resource_group_name: str,
config_store_name: str,
- config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO],
+ config_store_update_parameters: Union[_models.ConfigurationStoreUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.ConfigurationStore]:
"""Updates a configuration store with the specified parameters.
@@ -1186,20 +1103,9 @@ def begin_update(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param config_store_update_parameters: The parameters for updating a configuration store. Is
- either a ConfigurationStoreUpdateParameters type or a IO type. Required.
+ either a ConfigurationStoreUpdateParameters type or a IO[bytes] type. Required.
:type config_store_update_parameters:
- ~azure.mgmt.appconfiguration.v2023_03_01.models.ConfigurationStoreUpdateParameters 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.appconfiguration.v2023_03_01.models.ConfigurationStoreUpdateParameters or IO[bytes]
:return: An instance of LROPoller that returns either ConfigurationStore or the result of
cls(response)
:rtype:
@@ -1209,7 +1115,7 @@ def begin_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ConfigurationStore] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
@@ -1227,12 +1133,13 @@ def begin_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("ConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("ConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -1242,17 +1149,15 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.ConfigurationStore].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_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}"
- }
+ return LROPoller[_models.ConfigurationStore](
+ self._client, raw_result, get_long_running_output, polling_method # type: ignore
+ )
@distributed_trace
def list_keys(
@@ -1270,7 +1175,6 @@ def list_keys(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ApiKey or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2023_03_01.models.ApiKey]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1278,10 +1182,10 @@ def list_keys(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.ApiKeyListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1292,18 +1196,16 @@ def list_keys(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_keys_request(
+ _request = build_list_keys_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_keys.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
@@ -1314,14 +1216,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ApiKeyListResult", pipeline_response)
@@ -1331,11 +1232,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
@@ -1348,10 +1249,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_keys.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/listKeys"
- }
-
@overload
def regenerate_key(
self,
@@ -1375,7 +1272,6 @@ def regenerate_key(
: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: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1386,7 +1282,7 @@ def regenerate_key(
self,
resource_group_name: str,
config_store_name: str,
- regenerate_key_parameters: IO,
+ regenerate_key_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -1399,11 +1295,10 @@ def regenerate_key(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param regenerate_key_parameters: The parameters for regenerating an access key. Required.
- :type regenerate_key_parameters: IO
+ :type regenerate_key_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1414,7 +1309,7 @@ def regenerate_key(
self,
resource_group_name: str,
config_store_name: str,
- regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO],
+ regenerate_key_parameters: Union[_models.RegenerateKeyParameters, IO[bytes]],
**kwargs: Any
) -> _models.ApiKey:
"""Regenerates an access key for the specified configuration store.
@@ -1425,18 +1320,14 @@ def regenerate_key(
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
:param regenerate_key_parameters: The parameters for regenerating an access key. Is either a
- RegenerateKeyParameters type or a IO type. Required.
+ RegenerateKeyParameters type or a IO[bytes] type. Required.
:type regenerate_key_parameters:
- ~azure.mgmt.appconfiguration.v2023_03_01.models.RegenerateKeyParameters 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
+ ~azure.mgmt.appconfiguration.v2023_03_01.models.RegenerateKeyParameters or IO[bytes]
:return: ApiKey or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.ApiKey
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1447,19 +1338,19 @@ def regenerate_key(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ApiKey] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(regenerate_key_parameters, (IO, bytes)):
+ if isinstance(regenerate_key_parameters, (IOBase, bytes)):
_content = regenerate_key_parameters
else:
_json = self._serialize.body(regenerate_key_parameters, "RegenerateKeyParameters")
- request = build_regenerate_key_request(
+ _request = build_regenerate_key_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
@@ -1467,16 +1358,14 @@ def regenerate_key(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.regenerate_key.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
@@ -1486,22 +1375,17 @@ def regenerate_key(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ApiKey", pipeline_response)
+ deserialized = self._deserialize("ApiKey", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- regenerate_key.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/regenerateKey"
- }
+ return deserialized # type: ignore
@distributed_trace
def list_deleted(self, **kwargs: Any) -> Iterable["_models.DeletedConfigurationStore"]:
"""Gets information about the deleted configuration stores in a subscription.
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DeletedConfigurationStore or the result of
cls(response)
:rtype:
@@ -1511,10 +1395,10 @@ def list_deleted(self, **kwargs: Any) -> Iterable["_models.DeletedConfigurationS
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.DeletedConfigurationStoreListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1525,15 +1409,13 @@ def list_deleted(self, **kwargs: Any) -> Iterable["_models.DeletedConfigurationS
def prepare_request(next_link=None):
if not next_link:
- request = build_list_deleted_request(
+ _request = build_list_deleted_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_deleted.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
@@ -1544,14 +1426,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("DeletedConfigurationStoreListResult", pipeline_response)
@@ -1561,11 +1442,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
@@ -1578,10 +1459,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/deletedConfigurationStores"
- }
-
@distributed_trace
def get_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> _models.DeletedConfigurationStore:
"""Gets a deleted Azure app configuration store.
@@ -1590,12 +1467,11 @@ def get_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> _
:type location: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: DeletedConfigurationStore or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.DeletedConfigurationStore
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1606,24 +1482,22 @@ def get_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> _
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.DeletedConfigurationStore] = kwargs.pop("cls", None)
- request = build_get_deleted_request(
+ _request = build_get_deleted_request(
location=location,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get_deleted.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
@@ -1633,21 +1507,15 @@ def get_deleted(self, location: str, config_store_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("DeletedConfigurationStore", pipeline_response)
+ deserialized = self._deserialize("DeletedConfigurationStore", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
-
- return deserialized
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- get_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}"
- }
+ return deserialized # type: ignore
- def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements
- self, location: str, config_store_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _purge_deleted_initial(self, location: str, config_store_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1658,39 +1526,42 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_purge_deleted_request(
+ _request = build_purge_deleted_request(
location=location,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self._purge_deleted_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
- _purge_deleted_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -1700,14 +1571,6 @@ def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: A
:type location: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_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:
@@ -1715,13 +1578,13 @@ def begin_purge_deleted(self, location: str, config_store_name: str, **kwargs: A
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._purge_deleted_initial( # type: ignore
+ raw_result = self._purge_deleted_initial(
location=location,
config_store_name=config_store_name,
api_version=api_version,
@@ -1730,11 +1593,12 @@ def begin_purge_deleted(self, location: str, config_store_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(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -1743,14 +1607,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_purge_deleted.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/deletedConfigurationStores/{configStoreName}/purge"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_key_values_operations.py
index d4bad12eae97..ffaaa2741012 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_key_values_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_key_values_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,12 +16,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.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
@@ -28,12 +30,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -47,7 +48,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -64,7 +65,7 @@ def build_get_request(
"keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -81,7 +82,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -99,7 +100,7 @@ def build_create_or_update_request(
"keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -118,7 +119,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -135,7 +136,7 @@ def build_delete_request(
"keyValueName": _SERIALIZER.url("key_value_name", key_value_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -164,12 +165,15 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def get(
self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any
) -> _models.KeyValue:
- """Gets the properties of the specified key-value.
+ """Gets the properties of the specified key-value. NOTE: This operation is intended for use in ARM
+ Template deployments. For all other scenarios involving App Configuration key-values the data
+ plane API should be used instead.
:param resource_group_name: The name of the resource group to which the container registry
belongs. Required.
@@ -179,12 +183,11 @@ def get(
:param key_value_name: Identifier of key and label combination. Key and label are joined by $
character. Label is optional. Required.
:type key_value_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -195,25 +198,23 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_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
@@ -223,16 +224,12 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KeyValue", pipeline_response)
+ deserialized = self._deserialize("KeyValue", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
@overload
def create_or_update(
@@ -245,7 +242,9 @@ def create_or_update(
content_type: str = "application/json",
**kwargs: Any
) -> _models.KeyValue:
- """Creates a key-value.
+ """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For
+ all other scenarios involving App Configuration key-values the data plane API should be used
+ instead.
:param resource_group_name: The name of the resource group to which the container registry
belongs. Required.
@@ -260,7 +259,6 @@ def 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
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
@@ -272,12 +270,14 @@ def create_or_update(
resource_group_name: str,
config_store_name: str,
key_value_name: str,
- key_value_parameters: Optional[IO] = None,
+ key_value_parameters: Optional[IO[bytes]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.KeyValue:
- """Creates a key-value.
+ """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For
+ all other scenarios involving App Configuration key-values the data plane API should be used
+ instead.
:param resource_group_name: The name of the resource group to which the container registry
belongs. Required.
@@ -288,11 +288,10 @@ def create_or_update(
character. Label is optional. Required.
:type key_value_name: str
:param key_value_parameters: The parameters for creating a key-value. Default value is None.
- :type key_value_parameters: IO
+ :type key_value_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
@@ -304,10 +303,12 @@ def create_or_update(
resource_group_name: str,
config_store_name: str,
key_value_name: str,
- key_value_parameters: Optional[Union[_models.KeyValue, IO]] = None,
+ key_value_parameters: Optional[Union[_models.KeyValue, IO[bytes]]] = None,
**kwargs: Any
) -> _models.KeyValue:
- """Creates a key-value.
+ """Creates a key-value. NOTE: This operation is intended for use in ARM Template deployments. For
+ all other scenarios involving App Configuration key-values the data plane API should be used
+ instead.
:param resource_group_name: The name of the resource group to which the container registry
belongs. Required.
@@ -318,17 +319,14 @@ def create_or_update(
character. Label is optional. Required.
:type key_value_name: str
:param key_value_parameters: The parameters for creating a key-value. Is either a KeyValue type
- or a IO type. Default value is None.
- :type key_value_parameters: ~azure.mgmt.appconfiguration.v2023_03_01.models.KeyValue or IO
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
- Default value is None.
- :paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
+ or a IO[bytes] type. Default value is None.
+ :type key_value_parameters: ~azure.mgmt.appconfiguration.v2023_03_01.models.KeyValue or
+ IO[bytes]
:return: KeyValue or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.KeyValue
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -339,14 +337,14 @@ def create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.KeyValue] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(key_value_parameters, (IO, bytes)):
+ if isinstance(key_value_parameters, (IOBase, bytes)):
_content = key_value_parameters
else:
if key_value_parameters is not None:
@@ -354,7 +352,7 @@ def create_or_update(
else:
_json = None
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_name,
@@ -363,16 +361,14 @@ def create_or_update(
content_type=content_type,
json=_json,
content=_content,
- template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _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
@@ -382,21 +378,17 @@ def create_or_update(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("KeyValue", pipeline_response)
+ deserialized = self._deserialize("KeyValue", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
+ return deserialized # type: ignore
- create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
-
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -407,46 +399,51 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
self, resource_group_name: str, config_store_name: str, key_value_name: str, **kwargs: Any
) -> LROPoller[None]:
- """Deletes a key-value.
+ """Deletes a key-value. NOTE: This operation is intended for use in ARM Template deployments. For
+ all other scenarios involving App Configuration key-values the data plane API should be used
+ instead.
:param resource_group_name: The name of the resource group to which the container registry
belongs. Required.
@@ -456,14 +453,6 @@ def begin_delete(
:param key_value_name: Identifier of key and label combination. Key and label are joined by $
character. Label is optional. Required.
:type key_value_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:
@@ -471,13 +460,13 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
key_value_name=key_value_name,
@@ -487,11 +476,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(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -500,14 +490,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/keyValues/{keyValueName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_operations.py
index 5a125a9cf15e..88b12929d4ba 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
+from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
@@ -20,20 +21,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, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +44,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -57,7 +56,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -74,7 +73,7 @@ def build_list_request(*, skip_token: Optional[str] = None, **kwargs: Any) -> Ht
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -91,11 +90,13 @@ def build_list_request(*, skip_token: Optional[str] = None, **kwargs: Any) -> Ht
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
-def build_regional_check_name_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
+def build_regional_check_name_availability_request( # pylint: disable=name-too-long
+ location: str, subscription_id: str, **kwargs: Any
+) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -109,7 +110,7 @@ def build_regional_check_name_availability_request(location: str, subscription_i
"location": _SERIALIZER.url("location", location, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -140,6 +141,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@overload
def check_name_availability(
@@ -158,7 +160,6 @@ def check_name_availability(
: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: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -166,17 +167,16 @@ def check_name_availability(
@overload
def check_name_availability(
- self, check_name_availability_parameters: IO, *, content_type: str = "application/json", **kwargs: Any
+ self, check_name_availability_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
:param check_name_availability_parameters: The object containing information for the
availability request. Required.
- :type check_name_availability_parameters: IO
+ :type check_name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -184,23 +184,22 @@ def check_name_availability(
@distributed_trace
def check_name_availability(
- self, check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any
+ self,
+ check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]],
+ **kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
:param check_name_availability_parameters: The object containing information for the
- availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required.
+ availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type.
+ Required.
:type check_name_availability_parameters:
- ~azure.mgmt.appconfiguration.v2023_03_01.models.CheckNameAvailabilityParameters 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
+ ~azure.mgmt.appconfiguration.v2023_03_01.models.CheckNameAvailabilityParameters or IO[bytes]
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -211,34 +210,32 @@ def check_name_availability(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(check_name_availability_parameters, (IO, bytes)):
+ if isinstance(check_name_availability_parameters, (IOBase, bytes)):
_content = check_name_availability_parameters
else:
_json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters")
- request = build_check_name_availability_request(
+ _request = build_check_name_availability_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.check_name_availability.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
@@ -248,16 +245,12 @@ def check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response)
+ deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- check_name_availability.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/checkNameAvailability"
- }
+ return deserialized # type: ignore
@distributed_trace
def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_models.OperationDefinition"]:
@@ -268,7 +261,6 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationDefinition or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2023_03_01.models.OperationDefinition]
@@ -277,10 +269,10 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.OperationDefinitionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -291,15 +283,13 @@ def list(self, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable["_mo
def prepare_request(next_link=None):
if not next_link:
- request = build_list_request(
+ _request = build_list_request(
skip_token=skip_token,
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
@@ -310,14 +300,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationDefinitionListResult", pipeline_response)
@@ -327,11 +316,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
@@ -344,8 +333,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list.metadata = {"url": "/providers/Microsoft.AppConfiguration/operations"}
-
@overload
def regional_check_name_availability(
self,
@@ -366,7 +353,6 @@ def regional_check_name_availability(
: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: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -376,7 +362,7 @@ def regional_check_name_availability(
def regional_check_name_availability(
self,
location: str,
- check_name_availability_parameters: IO,
+ check_name_availability_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -387,11 +373,10 @@ def regional_check_name_availability(
:type location: str
:param check_name_availability_parameters: The object containing information for the
availability request. Required.
- :type check_name_availability_parameters: IO
+ :type check_name_availability_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
@@ -401,7 +386,7 @@ def regional_check_name_availability(
def regional_check_name_availability(
self,
location: str,
- check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO],
+ check_name_availability_parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]],
**kwargs: Any
) -> _models.NameAvailabilityStatus:
"""Checks whether the configuration store name is available for use.
@@ -409,18 +394,15 @@ def regional_check_name_availability(
:param location: The location in which uniqueness will be verified. Required.
:type location: str
:param check_name_availability_parameters: The object containing information for the
- availability request. Is either a CheckNameAvailabilityParameters type or a IO type. Required.
+ availability request. Is either a CheckNameAvailabilityParameters type or a IO[bytes] type.
+ Required.
:type check_name_availability_parameters:
- ~azure.mgmt.appconfiguration.v2023_03_01.models.CheckNameAvailabilityParameters 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
+ ~azure.mgmt.appconfiguration.v2023_03_01.models.CheckNameAvailabilityParameters or IO[bytes]
:return: NameAvailabilityStatus or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.NameAvailabilityStatus
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -431,35 +413,33 @@ def regional_check_name_availability(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.NameAvailabilityStatus] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(check_name_availability_parameters, (IO, bytes)):
+ if isinstance(check_name_availability_parameters, (IOBase, bytes)):
_content = check_name_availability_parameters
else:
_json = self._serialize.body(check_name_availability_parameters, "CheckNameAvailabilityParameters")
- request = build_regional_check_name_availability_request(
+ _request = build_regional_check_name_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
- template_url=self.regional_check_name_availability.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
@@ -469,13 +449,9 @@ def regional_check_name_availability(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response)
+ deserialized = self._deserialize("NameAvailabilityStatus", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
- return deserialized
-
- regional_check_name_availability.metadata = {
- "url": "/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/locations/{location}/checkNameAvailability"
- }
+ return deserialized # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_private_endpoint_connections_operations.py
index 3b80d58d39bc..082c48d9eadc 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_private_endpoint_connections_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_private_endpoint_connections_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, 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,12 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,13 +44,13 @@
_SERIALIZER.client_side_validation = False
-def build_list_by_configuration_store_request(
+def build_list_by_configuration_store_request( # pylint: disable=name-too-long
resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -65,7 +66,7 @@ def build_list_by_configuration_store_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -86,7 +87,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -105,7 +106,7 @@ def build_get_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -126,7 +127,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -146,7 +147,7 @@ def build_create_or_update_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -169,7 +170,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -188,7 +189,7 @@ def build_delete_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -217,6 +218,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -229,7 +231,6 @@ def list_by_configuration_store(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateEndpointConnection or the result of
cls(response)
:rtype:
@@ -239,10 +240,10 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -253,17 +254,15 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -274,14 +273,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response)
@@ -291,11 +289,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
@@ -308,10 +306,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections"
- }
-
@distributed_trace
def get(
self, resource_group_name: str, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any
@@ -325,12 +319,11 @@ def get(
:type config_store_name: str
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -341,25 +334,23 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_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
@@ -369,26 +360,22 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
def _create_or_update_initial(
self,
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO],
+ private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
- ) -> _models.PrivateEndpointConnection:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -399,19 +386,19 @@ def _create_or_update_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(private_endpoint_connection, (IO, bytes)):
+ if isinstance(private_endpoint_connection, (IOBase, bytes)):
_content = private_endpoint_connection
else:
_json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection")
- request = build_create_or_update_request(
+ _request = build_create_or_update_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -420,40 +407,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("PrivateEndpointConnection", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
-
@overload
def begin_create_or_update(
self,
@@ -482,14 +464,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 PrivateEndpointConnection or the result
of cls(response)
:rtype:
@@ -503,7 +477,7 @@ def begin_create_or_update(
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: IO,
+ private_endpoint_connection: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -520,18 +494,10 @@ def begin_create_or_update(
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
:param private_endpoint_connection: The private endpoint connection properties. Required.
- :type private_endpoint_connection: IO
+ :type private_endpoint_connection: 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 PrivateEndpointConnection or the result
of cls(response)
:rtype:
@@ -545,7 +511,7 @@ def begin_create_or_update(
resource_group_name: str,
config_store_name: str,
private_endpoint_connection_name: str,
- private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO],
+ private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.PrivateEndpointConnection]:
"""Update the state of the specified private endpoint connection associated with the configuration
@@ -560,20 +526,9 @@ def begin_create_or_update(
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_name: str
:param private_endpoint_connection: The private endpoint connection properties. Is either a
- PrivateEndpointConnection type or a IO type. Required.
+ PrivateEndpointConnection type or a IO[bytes] type. Required.
:type private_endpoint_connection:
- ~azure.mgmt.appconfiguration.v2023_03_01.models.PrivateEndpointConnection 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.appconfiguration.v2023_03_01.models.PrivateEndpointConnection or IO[bytes]
:return: An instance of LROPoller that returns either PrivateEndpointConnection or the result
of cls(response)
:rtype:
@@ -583,7 +538,7 @@ def begin_create_or_update(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
@@ -602,12 +557,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("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -617,22 +573,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.PrivateEndpointConnection].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
-
- begin_create_or_update.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return LROPoller[_models.PrivateEndpointConnection](
+ 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, config_store_name: str, private_endpoint_connection_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -643,40 +597,43 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -691,14 +648,6 @@ def begin_delete(
:type config_store_name: str
:param private_endpoint_connection_name: Private endpoint connection name. Required.
:type private_endpoint_connection_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:
@@ -706,13 +655,13 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
private_endpoint_connection_name=private_endpoint_connection_name,
@@ -722,11 +671,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(PollingMethod, ARMPolling(lro_delay, **kwargs))
@@ -735,14 +685,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateEndpointConnections/{privateEndpointConnectionName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_private_link_resources_operations.py
index 12f9adf09845..1a8eaed43a4d 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_private_link_resources_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_private_link_resources_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7,7 +7,7 @@
# 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
+from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar
import urllib.parse
from azure.core.exceptions import (
@@ -20,20 +20,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, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -41,13 +39,13 @@
_SERIALIZER.client_side_validation = False
-def build_list_by_configuration_store_request(
+def build_list_by_configuration_store_request( # pylint: disable=name-too-long
resource_group_name: str, config_store_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -63,7 +61,7 @@ def build_list_by_configuration_store_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -80,7 +78,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -97,7 +95,7 @@ def build_get_request(
"groupName": _SERIALIZER.url("group_name", group_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -126,6 +124,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -138,7 +137,6 @@ def list_by_configuration_store(
:type resource_group_name: str
:param config_store_name: The name of the configuration store. Required.
:type config_store_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateLinkResource or the result of cls(response)
:rtype:
~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2023_03_01.models.PrivateLinkResource]
@@ -147,10 +145,10 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -161,17 +159,15 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -182,14 +178,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response)
@@ -199,11 +194,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
@@ -216,10 +211,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources"
- }
-
@distributed_trace
def get(
self, resource_group_name: str, config_store_name: str, group_name: str, **kwargs: Any
@@ -233,12 +224,11 @@ def get(
:type config_store_name: str
:param group_name: The name of the private link resource group. Required.
:type group_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateLinkResource or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -249,25 +239,23 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
group_name=group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
- template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
+ _request.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
@@ -277,13 +265,9 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResource", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/privateLinkResources/{groupName}"
- }
+ return deserialized # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_replicas_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_replicas_operations.py
index c6d0c2b2679b..2744c6d7df86 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_replicas_operations.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/azure/mgmt/appconfiguration/v2023_03_01/operations/_replicas_operations.py
@@ -1,4 +1,4 @@
-# pylint: disable=too-many-lines
+# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,8 +6,9 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+from io import IOBase
import sys
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, 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,12 +32,11 @@
from .. import models as _models
from ..._serialization import Serializer
-from .._vendor import _convert_request, _format_url_section
-if sys.version_info >= (3, 8):
- from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
else:
- from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
+ from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +44,7 @@
_SERIALIZER.client_side_validation = False
-def build_list_by_configuration_store_request(
+def build_list_by_configuration_store_request( # pylint: disable=name-too-long
resource_group_name: str,
config_store_name: str,
subscription_id: str,
@@ -54,7 +55,7 @@ def build_list_by_configuration_store_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -70,7 +71,7 @@ def build_list_by_configuration_store_request(
),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -89,7 +90,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -106,7 +107,7 @@ def build_get_request(
"replicaName": _SERIALIZER.url("replica_name", replica_name, "str", pattern=r"^[a-zA-Z0-9]*$"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -123,7 +124,7 @@ def build_create_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -141,7 +142,7 @@ def build_create_request(
"replicaName": _SERIALIZER.url("replica_name", replica_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -160,7 +161,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -177,7 +178,7 @@ def build_delete_request(
"replicaName": _SERIALIZER.url("replica_name", replica_name, "str"),
}
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
+ _url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
@@ -206,6 +207,7 @@ def __init__(self, *args, **kwargs):
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version")
@distributed_trace
def list_by_configuration_store(
@@ -223,7 +225,6 @@ def list_by_configuration_store(
element will include a skipToken parameter that specifies a starting point to use for
subsequent calls. Default value is None.
:type skip_token: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Replica or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appconfiguration.v2023_03_01.models.Replica]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -231,10 +232,10 @@ def list_by_configuration_store(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.ReplicaListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -245,18 +246,16 @@ def list_by_configuration_store(
def prepare_request(next_link=None):
if not next_link:
- request = build_list_by_configuration_store_request(
+ _request = build_list_by_configuration_store_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
subscription_id=self._config.subscription_id,
skip_token=skip_token,
api_version=api_version,
- template_url=self.list_by_configuration_store.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
@@ -267,14 +266,13 @@ def prepare_request(next_link=None):
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
- _next_request_params["api-version"] = self._config.api_version
- request = HttpRequest(
+ _next_request_params["api-version"] = self._api_version
+ _request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- request = _convert_request(request)
- request.url = self._client.format_url(request.url)
- request.method = "GET"
- return request
+ _request.url = self._client.format_url(_request.url)
+ _request.method = "GET"
+ return _request
def extract_data(pipeline_response):
deserialized = self._deserialize("ReplicaListResult", pipeline_response)
@@ -284,11 +282,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
@@ -301,10 +299,6 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)
- list_by_configuration_store.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas"
- }
-
@distributed_trace
def get(
self, resource_group_name: str, config_store_name: str, replica_name: str, **kwargs: Any
@@ -318,12 +312,11 @@ def get(
:type config_store_name: str
:param replica_name: The name of the replica. Required.
:type replica_name: str
- :keyword callable cls: A custom type or function that will be passed the direct response
:return: Replica or the result of cls(response)
:rtype: ~azure.mgmt.appconfiguration.v2023_03_01.models.Replica
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -334,25 +327,23 @@ def get(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[_models.Replica] = kwargs.pop("cls", None)
- request = build_get_request(
+ _request = build_get_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_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
@@ -362,26 +353,22 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Replica", pipeline_response)
+ deserialized = self._deserialize("Replica", 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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return deserialized # type: ignore
def _create_initial(
self,
resource_group_name: str,
config_store_name: str,
replica_name: str,
- replica_creation_parameters: Union[_models.Replica, IO],
+ replica_creation_parameters: Union[_models.Replica, IO[bytes]],
**kwargs: Any
- ) -> _models.Replica:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -392,19 +379,19 @@ def _create_initial(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Replica] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
- if isinstance(replica_creation_parameters, (IO, bytes)):
+ if isinstance(replica_creation_parameters, (IOBase, bytes)):
_content = replica_creation_parameters
else:
_json = self._serialize.body(replica_creation_parameters, "Replica")
- request = build_create_request(
+ _request = build_create_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_name,
@@ -413,40 +400,35 @@ def _create_initial(
content_type=content_type,
json=_json,
content=_content,
- template_url=self._create_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("Replica", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Replica", 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_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
-
@overload
def begin_create(
self,
@@ -472,14 +454,6 @@ def begin_create(
: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 Replica or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2023_03_01.models.Replica]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -491,7 +465,7 @@ def begin_create(
resource_group_name: str,
config_store_name: str,
replica_name: str,
- replica_creation_parameters: IO,
+ replica_creation_parameters: IO[bytes],
*,
content_type: str = "application/json",
**kwargs: Any
@@ -506,18 +480,10 @@ def begin_create(
:param replica_name: The name of the replica. Required.
:type replica_name: str
:param replica_creation_parameters: The parameters for creating a replica. Required.
- :type replica_creation_parameters: IO
+ :type replica_creation_parameters: IO[bytes]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
- :keyword callable cls: A custom type or function that will be passed the direct response
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
- :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
- operation to not poll, or pass in your own initialized polling object for a personal polling
- strategy.
- :paramtype polling: bool or ~azure.core.polling.PollingMethod
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
- Retry-After header is present.
:return: An instance of LROPoller that returns either Replica or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2023_03_01.models.Replica]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -529,7 +495,7 @@ def begin_create(
resource_group_name: str,
config_store_name: str,
replica_name: str,
- replica_creation_parameters: Union[_models.Replica, IO],
+ replica_creation_parameters: Union[_models.Replica, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.Replica]:
"""Creates a replica with the specified parameters.
@@ -542,20 +508,9 @@ def begin_create(
:param replica_name: The name of the replica. Required.
:type replica_name: str
:param replica_creation_parameters: The parameters for creating a replica. Is either a Replica
- type or a IO type. Required.
+ type or a IO[bytes] type. Required.
:type replica_creation_parameters: ~azure.mgmt.appconfiguration.v2023_03_01.models.Replica 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.
+ IO[bytes]
:return: An instance of LROPoller that returns either Replica or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appconfiguration.v2023_03_01.models.Replica]
:raises ~azure.core.exceptions.HttpResponseError:
@@ -563,7 +518,7 @@ def begin_create(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Replica] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
@@ -582,12 +537,13 @@ def begin_create(
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("Replica", pipeline_response)
+ deserialized = self._deserialize("Replica", pipeline_response.http_response)
if cls:
- return cls(pipeline_response, deserialized, {})
+ return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
if polling is True:
@@ -599,22 +555,20 @@ def get_long_running_output(pipeline_response):
else:
polling_method = polling
if cont_token:
- return LROPoller.from_continuation_token(
+ return LROPoller[_models.Replica].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.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return LROPoller[_models.Replica](
+ 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, config_store_name: str, replica_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -625,30 +579,33 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
- request = build_delete_request(
+ _request = build_delete_request(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_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)
@@ -659,12 +616,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
"str", response.headers.get("Azure-AsyncOperation")
)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers)
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
- _delete_initial.metadata = {
- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -679,14 +636,6 @@ def begin_delete(
:type config_store_name: str
:param replica_name: The name of the replica. Required.
:type replica_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:
@@ -694,13 +643,13 @@ def begin_delete(
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: Literal["2023-03-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-03-01"))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
config_store_name=config_store_name,
replica_name=replica_name,
@@ -710,11 +659,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(
@@ -725,14 +675,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/Microsoft.AppConfiguration/configurationStores/{configStoreName}/replicas/{replicaName}"
- }
+ return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_available.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_available.py
index 333c2e7a9594..d783b128762e 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_available.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_available.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_not_available.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_not_available.py
index 0fd5f81a8eb0..126a1160e17a 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_not_available.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/check_name_not_available.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create.py
index 7f9e7e84ec1e..7c0fc7fdd7a8 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_key_value.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_key_value.py
index 38b525683300..8fb65cf499f9 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_key_value.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_key_value.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_replica.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_replica.py
index 78832a235c86..0837a775500b 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_replica.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_replica.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_identity.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_identity.py
index 3b7fa0e3fd9c..38a47ce0dbd8 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_identity.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_identity.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_local_auth_disabled.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_local_auth_disabled.py
index 2dc093741123..ad2757f87d72 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_local_auth_disabled.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_create_with_local_auth_disabled.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete.py
index 8a5fa3c2ed96..090000b0f700 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
@@ -29,11 +30,10 @@ def main():
subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882",
)
- response = client.configuration_stores.begin_delete(
+ client.configuration_stores.begin_delete(
resource_group_name="myResourceGroup",
config_store_name="contoso",
).result()
- print(response)
# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresDelete.json
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_key_value.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_key_value.py
index 1f156e677861..66726c8268e2 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_key_value.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_key_value.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
@@ -29,12 +30,11 @@ def main():
subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882",
)
- response = client.key_values.begin_delete(
+ client.key_values.begin_delete(
resource_group_name="myResourceGroup",
config_store_name="contoso",
key_value_name="myKey$myLabel",
).result()
- print(response)
# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresDeleteKeyValue.json
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_private_endpoint_connection.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_private_endpoint_connection.py
index 8e7b2c6384f7..b3c172e68f8f 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_private_endpoint_connection.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_private_endpoint_connection.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
@@ -29,12 +30,11 @@ def main():
subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882",
)
- response = client.private_endpoint_connections.begin_delete(
+ client.private_endpoint_connections.begin_delete(
resource_group_name="myResourceGroup",
config_store_name="contoso",
private_endpoint_connection_name="myConnection",
).result()
- print(response)
# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresDeletePrivateEndpointConnection.json
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_replica.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_replica.py
index e0e6d7485c75..7cebf0cbf40f 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_replica.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_delete_replica.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
@@ -29,12 +30,11 @@ def main():
subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882",
)
- response = client.replicas.begin_delete(
+ client.replicas.begin_delete(
resource_group_name="myResourceGroup",
config_store_name="contoso",
replica_name="myReplicaEus",
).result()
- print(response)
# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/ConfigurationStoresDeleteReplica.json
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get.py
index 85b8d3ec524c..87e13514c1bd 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_key_value.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_key_value.py
index 1220a3d05e69..451e48132f87 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_key_value.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_key_value.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_private_endpoint_connection.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_private_endpoint_connection.py
index 3ef4142b72da..8698582b7f34 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_private_endpoint_connection.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_private_endpoint_connection.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_replica.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_replica.py
index c6160e168a3e..b00762d3175f 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_replica.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_get_replica.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list.py
index 76e9d209f565..e21ad0dcf5ac 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_by_resource_group.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_by_resource_group.py
index 7a28dae863cb..fc8bf2f3a138 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_by_resource_group.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_by_resource_group.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_keys.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_keys.py
index db88205336f3..bca5dbbbda45 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_keys.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_keys.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_private_endpoint_connections.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_private_endpoint_connections.py
index 0106b7ad9ee2..2c2d58f8c206 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_private_endpoint_connections.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_private_endpoint_connections.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_replicas.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_replicas.py
index eb197f1dd7dd..7192ce9c8840 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_replicas.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_list_replicas.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_regenerate_key.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_regenerate_key.py
index 1c287bb926bd..630220961f35 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_regenerate_key.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_regenerate_key.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update.py
index 62501ec4ae23..a917a445cb6d 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_disable_local_auth.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_disable_local_auth.py
index 177236714355..ddee18675ed7 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_disable_local_auth.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_disable_local_auth.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_private_endpoint_connection.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_private_endpoint_connection.py
index 73f8869a623a..a34cd7cba83d 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_private_endpoint_connection.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_private_endpoint_connection.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_with_identity.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_with_identity.py
index bfa74e003c4d..4c9c7066e5b6 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_with_identity.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/configuration_stores_update_with_identity.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_get.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_get.py
index 42f52c778fdb..4adfb4b56a6c 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_get.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_list.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_list.py
index e632a4de4733..632af8a0a1f2 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_list.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_list.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_purge.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_purge.py
index 18ba402c8963..8a49fbb95c96 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_purge.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/deleted_configuration_stores_purge.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
@@ -29,11 +30,10 @@ def main():
subscription_id="c80fb759-c965-4c6a-9110-9b2b2d038882",
)
- response = client.configuration_stores.begin_purge_deleted(
+ client.configuration_stores.begin_purge_deleted(
location="westus",
config_store_name="contoso",
).result()
- print(response)
# x-ms-original-file: specification/appconfiguration/resource-manager/Microsoft.AppConfiguration/stable/2023-03-01/examples/DeletedConfigurationStoresPurge.json
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/operations_list.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/operations_list.py
index 0b8c8d793e9d..474adecc80c2 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/operations_list.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/operations_list.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resource_get.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resource_get.py
index 08d53356ccc5..57f7c50279a8 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resource_get.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resource_get.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resources_list_by_configuration_store.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resources_list_by_configuration_store.py
index 6336f9497500..7b333cc1f05d 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resources_list_by_configuration_store.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/private_link_resources_list_by_configuration_store.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_available.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_available.py
index fe494110a646..1487b4f12ca4 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_available.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_available.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_not_available.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_not_available.py
index 4227882a2e4c..645cbd5b1734 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_not_available.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_samples/regional_check_name_not_available.py
@@ -7,6 +7,7 @@
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
+
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
"""
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/conftest.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/conftest.py
new file mode 100644
index 000000000000..bdabbe9c6cc3
--- /dev/null
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/conftest.py
@@ -0,0 +1,47 @@
+# 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()
+
+
+# aovid record sensitive identity information in recordings
+@pytest.fixture(scope="session", autouse=True)
+def add_sanitizers(test_proxy):
+ appconfigurationmanagement_subscription_id = os.environ.get(
+ "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000"
+ )
+ appconfigurationmanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
+ appconfigurationmanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
+ appconfigurationmanagement_client_secret = os.environ.get(
+ "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000"
+ )
+ add_general_regex_sanitizer(
+ regex=appconfigurationmanagement_subscription_id, value="00000000-0000-0000-0000-000000000000"
+ )
+ add_general_regex_sanitizer(
+ regex=appconfigurationmanagement_tenant_id, value="00000000-0000-0000-0000-000000000000"
+ )
+ add_general_regex_sanitizer(
+ regex=appconfigurationmanagement_client_id, value="00000000-0000-0000-0000-000000000000"
+ )
+ add_general_regex_sanitizer(
+ regex=appconfigurationmanagement_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/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations.py
new file mode 100644
index 000000000000..fc89139632ae
--- /dev/null
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations.py
@@ -0,0 +1,206 @@
+# 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.appconfiguration import AppConfigurationManagementClient
+
+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 TestAppConfigurationManagementConfigurationStoresOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AppConfigurationManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.configuration_stores.list(
+ api_version="2023-03-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_resource_group(self, resource_group):
+ response = self.client.configuration_stores.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2023-03-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.configuration_stores.get(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create(self, resource_group):
+ response = self.client.configuration_stores.begin_create(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ config_store_creation_parameters={
+ "location": "str",
+ "sku": {"name": "str"},
+ "createMode": "str",
+ "creationDate": "2020-02-20 00:00:00",
+ "disableLocalAuth": False,
+ "enablePurgeProtection": False,
+ "encryption": {"keyVaultProperties": {"identityClientId": "str", "keyIdentifier": "str"}},
+ "endpoint": "str",
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "name": "str",
+ "privateEndpointConnections": [
+ {
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "provisioningState": "str",
+ "publicNetworkAccess": "str",
+ "softDeleteRetentionInDays": 7,
+ "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="2023-03-01",
+ ).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_begin_delete(self, resource_group):
+ response = self.client.configuration_stores.begin_delete(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ api_version="2023-03-01",
+ ).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_begin_update(self, resource_group):
+ response = self.client.configuration_stores.begin_update(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ config_store_update_parameters={
+ "disableLocalAuth": bool,
+ "enablePurgeProtection": bool,
+ "encryption": {"keyVaultProperties": {"identityClientId": "str", "keyIdentifier": "str"}},
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "publicNetworkAccess": "str",
+ "sku": {"name": "str"},
+ "tags": {"str": "str"},
+ },
+ api_version="2023-03-01",
+ ).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_list_keys(self, resource_group):
+ response = self.client.configuration_stores.list_keys(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_regenerate_key(self, resource_group):
+ response = self.client.configuration_stores.regenerate_key(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ regenerate_key_parameters={"id": "str"},
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_deleted(self, resource_group):
+ response = self.client.configuration_stores.list_deleted(
+ api_version="2023-03-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get_deleted(self, resource_group):
+ response = self.client.configuration_stores.get_deleted(
+ location="str",
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_purge_deleted(self, resource_group):
+ response = self.client.configuration_stores.begin_purge_deleted(
+ location="str",
+ config_store_name="str",
+ api_version="2023-03-01",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations_async.py
new file mode 100644
index 000000000000..dcc6c93e5e1f
--- /dev/null
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_configuration_stores_operations_async.py
@@ -0,0 +1,215 @@
+# 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.appconfiguration.aio import AppConfigurationManagementClient
+
+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 TestAppConfigurationManagementConfigurationStoresOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AppConfigurationManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.configuration_stores.list(
+ api_version="2023-03-01",
+ )
+ 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_list_by_resource_group(self, resource_group):
+ response = self.client.configuration_stores.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2023-03-01",
+ )
+ 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_get(self, resource_group):
+ response = await self.client.configuration_stores.get(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create(self, resource_group):
+ response = await (
+ await self.client.configuration_stores.begin_create(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ config_store_creation_parameters={
+ "location": "str",
+ "sku": {"name": "str"},
+ "createMode": "str",
+ "creationDate": "2020-02-20 00:00:00",
+ "disableLocalAuth": False,
+ "enablePurgeProtection": False,
+ "encryption": {"keyVaultProperties": {"identityClientId": "str", "keyIdentifier": "str"}},
+ "endpoint": "str",
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "name": "str",
+ "privateEndpointConnections": [
+ {
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "provisioningState": "str",
+ "publicNetworkAccess": "str",
+ "softDeleteRetentionInDays": 7,
+ "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="2023-03-01",
+ )
+ ).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_begin_delete(self, resource_group):
+ response = await (
+ await self.client.configuration_stores.begin_delete(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+ ).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_begin_update(self, resource_group):
+ response = await (
+ await self.client.configuration_stores.begin_update(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ config_store_update_parameters={
+ "disableLocalAuth": bool,
+ "enablePurgeProtection": bool,
+ "encryption": {"keyVaultProperties": {"identityClientId": "str", "keyIdentifier": "str"}},
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "publicNetworkAccess": "str",
+ "sku": {"name": "str"},
+ "tags": {"str": "str"},
+ },
+ api_version="2023-03-01",
+ )
+ ).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_list_keys(self, resource_group):
+ response = self.client.configuration_stores.list_keys(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+ 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_regenerate_key(self, resource_group):
+ response = await self.client.configuration_stores.regenerate_key(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ regenerate_key_parameters={"id": "str"},
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_deleted(self, resource_group):
+ response = self.client.configuration_stores.list_deleted(
+ api_version="2023-03-01",
+ )
+ 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_get_deleted(self, resource_group):
+ response = await self.client.configuration_stores.get_deleted(
+ location="str",
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_purge_deleted(self, resource_group):
+ response = await (
+ await self.client.configuration_stores.begin_purge_deleted(
+ location="str",
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations.py
new file mode 100644
index 000000000000..5672022c4152
--- /dev/null
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations.py
@@ -0,0 +1,58 @@
+# 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.appconfiguration import AppConfigurationManagementClient
+
+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 TestAppConfigurationManagementKeyValuesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AppConfigurationManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.key_values.get(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ key_value_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_create_or_update(self, resource_group):
+ response = self.client.key_values.create_or_update(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ key_value_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_delete(self, resource_group):
+ response = self.client.key_values.begin_delete(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ key_value_name="str",
+ api_version="2023-03-01",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations_async.py
new file mode 100644
index 000000000000..024fd4a633e1
--- /dev/null
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_key_values_operations_async.py
@@ -0,0 +1,61 @@
+# 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.appconfiguration.aio import AppConfigurationManagementClient
+
+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 TestAppConfigurationManagementKeyValuesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AppConfigurationManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_get(self, resource_group):
+ response = await self.client.key_values.get(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ key_value_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_create_or_update(self, resource_group):
+ response = await self.client.key_values.create_or_update(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ key_value_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_delete(self, resource_group):
+ response = await (
+ await self.client.key_values.begin_delete(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ key_value_name="str",
+ api_version="2023-03-01",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations.py
new file mode 100644
index 000000000000..196269987420
--- /dev/null
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations.py
@@ -0,0 +1,52 @@
+# 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.appconfiguration import AppConfigurationManagementClient
+
+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 TestAppConfigurationManagementOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AppConfigurationManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_check_name_availability(self, resource_group):
+ response = self.client.operations.check_name_availability(
+ check_name_availability_parameters={"name": "str", "type": "str"},
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list(self, resource_group):
+ response = self.client.operations.list(
+ api_version="2023-03-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_regional_check_name_availability(self, resource_group):
+ response = self.client.operations.regional_check_name_availability(
+ location="str",
+ check_name_availability_parameters={"name": "str", "type": "str"},
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations_async.py
new file mode 100644
index 000000000000..2fd451ec4cb9
--- /dev/null
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_operations_async.py
@@ -0,0 +1,53 @@
+# 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.appconfiguration.aio import AppConfigurationManagementClient
+
+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 TestAppConfigurationManagementOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AppConfigurationManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_check_name_availability(self, resource_group):
+ response = await self.client.operations.check_name_availability(
+ check_name_availability_parameters={"name": "str", "type": "str"},
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list(self, resource_group):
+ response = self.client.operations.list(
+ api_version="2023-03-01",
+ )
+ 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_regional_check_name_availability(self, resource_group):
+ response = await self.client.operations.regional_check_name_availability(
+ location="str",
+ check_name_availability_parameters={"name": "str", "type": "str"},
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations.py
new file mode 100644
index 000000000000..4809914b0afa
--- /dev/null
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations.py
@@ -0,0 +1,78 @@
+# 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.appconfiguration import AppConfigurationManagementClient
+
+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 TestAppConfigurationManagementPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AppConfigurationManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_configuration_store(self, resource_group):
+ response = self.client.private_endpoint_connections.list_by_configuration_store(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.private_endpoint_connections.get(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ private_endpoint_connection_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create_or_update(self, resource_group):
+ response = self.client.private_endpoint_connections.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ private_endpoint_connection_name="str",
+ private_endpoint_connection={
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"},
+ "provisioningState": "str",
+ "type": "str",
+ },
+ api_version="2023-03-01",
+ ).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_begin_delete(self, resource_group):
+ response = self.client.private_endpoint_connections.begin_delete(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ private_endpoint_connection_name="str",
+ api_version="2023-03-01",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations_async.py
new file mode 100644
index 000000000000..02b9ecf61795
--- /dev/null
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_endpoint_connections_operations_async.py
@@ -0,0 +1,87 @@
+# 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.appconfiguration.aio import AppConfigurationManagementClient
+
+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 TestAppConfigurationManagementPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AppConfigurationManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_configuration_store(self, resource_group):
+ response = self.client.private_endpoint_connections.list_by_configuration_store(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+ 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_get(self, resource_group):
+ response = await self.client.private_endpoint_connections.get(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ private_endpoint_connection_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.private_endpoint_connections.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ private_endpoint_connection_name="str",
+ private_endpoint_connection={
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ },
+ api_version="2023-03-01",
+ )
+ ).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_begin_delete(self, resource_group):
+ response = await (
+ await self.client.private_endpoint_connections.begin_delete(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ private_endpoint_connection_name="str",
+ api_version="2023-03-01",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations.py
new file mode 100644
index 000000000000..7d31b2197418
--- /dev/null
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations.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.appconfiguration import AppConfigurationManagementClient
+
+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 TestAppConfigurationManagementPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AppConfigurationManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_configuration_store(self, resource_group):
+ response = self.client.private_link_resources.list_by_configuration_store(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.private_link_resources.get(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ group_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations_async.py
new file mode 100644
index 000000000000..d8e630951086
--- /dev/null
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_private_link_resources_operations_async.py
@@ -0,0 +1,45 @@
+# 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.appconfiguration.aio import AppConfigurationManagementClient
+
+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 TestAppConfigurationManagementPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AppConfigurationManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_configuration_store(self, resource_group):
+ response = self.client.private_link_resources.list_by_configuration_store(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+ 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_get(self, resource_group):
+ response = await self.client.private_link_resources.get(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ group_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations.py
new file mode 100644
index 000000000000..30d08b09940b
--- /dev/null
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations.py
@@ -0,0 +1,86 @@
+# 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.appconfiguration import AppConfigurationManagementClient
+
+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 TestAppConfigurationManagementReplicasOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AppConfigurationManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_list_by_configuration_store(self, resource_group):
+ response = self.client.replicas.list_by_configuration_store(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_get(self, resource_group):
+ response = self.client.replicas.get(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ replica_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_begin_create(self, resource_group):
+ response = self.client.replicas.begin_create(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ replica_name="str",
+ replica_creation_parameters={
+ "endpoint": "str",
+ "id": "str",
+ "location": "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="2023-03-01",
+ ).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_begin_delete(self, resource_group):
+ response = self.client.replicas.begin_delete(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ replica_name="str",
+ api_version="2023-03-01",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations_async.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations_async.py
new file mode 100644
index 000000000000..7b91cf11b167
--- /dev/null
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/generated_tests/test_app_configuration_management_replicas_operations_async.py
@@ -0,0 +1,91 @@
+# 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.appconfiguration.aio import AppConfigurationManagementClient
+
+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 TestAppConfigurationManagementReplicasOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(AppConfigurationManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_list_by_configuration_store(self, resource_group):
+ response = self.client.replicas.list_by_configuration_store(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ api_version="2023-03-01",
+ )
+ 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_get(self, resource_group):
+ response = await self.client.replicas.get(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ replica_name="str",
+ api_version="2023-03-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_begin_create(self, resource_group):
+ response = await (
+ await self.client.replicas.begin_create(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ replica_name="str",
+ replica_creation_parameters={
+ "endpoint": "str",
+ "id": "str",
+ "location": "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="2023-03-01",
+ )
+ ).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_begin_delete(self, resource_group):
+ response = await (
+ await self.client.replicas.begin_delete(
+ resource_group_name=resource_group.name,
+ config_store_name="str",
+ replica_name="str",
+ api_version="2023-03-01",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py b/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py
index e16e5fa240c3..c44dd5169f9b 100644
--- a/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py
+++ b/sdk/appconfiguration/azure-mgmt-appconfiguration/setup.py
@@ -22,11 +22,9 @@
# Version extraction inspired from 'requests'
with open(
- (
- os.path.join(package_folder_path, "version.py")
- if os.path.exists(os.path.join(package_folder_path, "version.py"))
- else os.path.join(package_folder_path, "_version.py")
- ),
+ os.path.join(package_folder_path, "version.py")
+ if os.path.exists(os.path.join(package_folder_path, "version.py"))
+ else os.path.join(package_folder_path, "_version.py"),
"r",
) as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)
@@ -55,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,
@@ -76,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",
)