diff --git a/sdk/botservice/azure-mgmt-botservice/README.md b/sdk/botservice/azure-mgmt-botservice/README.md index dca2d0fccdd4..71c470f78844 100644 --- a/sdk/botservice/azure-mgmt-botservice/README.md +++ b/sdk/botservice/azure-mgmt-botservice/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Bot Service 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 @@ -45,8 +45,9 @@ client = AzureBotService(credential=DefaultAzureCredential(), subscription_id=su ## Examples - -Code samples for this package can be found at [Bot Service](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) +Code samples for this package can be found at: +- [Search Bot Service](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) ## Troubleshooting @@ -58,6 +59,3 @@ Code samples for this package can be found at [Bot Service](https://docs.microso 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. - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-botservice%2FREADME.png) diff --git a/sdk/botservice/azure-mgmt-botservice/_meta.json b/sdk/botservice/azure-mgmt-botservice/_meta.json index 0d85a464e792..addc898c5641 100644 --- a/sdk/botservice/azure-mgmt-botservice/_meta.json +++ b/sdk/botservice/azure-mgmt-botservice/_meta.json @@ -1,11 +1,11 @@ { - "commit": "c0f92082a788895368a738a9200e24971157d7ca", + "commit": "240350840bd5b2fc2bd45df7960b33ed83d3634a", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.2.7", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.13.16", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/botservice/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/botservice/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.13.16 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/botservice/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_azure_bot_service.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_azure_bot_service.py index 44db9f168a6a..c5140967792b 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_azure_bot_service.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_azure_bot_service.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import AzureBotServiceConfiguration @@ -22,6 +24,7 @@ DirectLineOperations, EmailOperations, HostSettingsOperations, + NetworkSecurityPerimeterConfigurationsOperations, OperationResultsOperations, Operations, PrivateEndpointConnectionsOperations, @@ -62,14 +65,18 @@ class AzureBotService: # pylint: disable=client-accepts-api-version-keyword,too :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.botservice.operations.PrivateLinkResourcesOperations + :ivar network_security_perimeter_configurations: + NetworkSecurityPerimeterConfigurationsOperations operations + :vartype network_security_perimeter_configurations: + azure.mgmt.botservice.operations.NetworkSecurityPerimeterConfigurationsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Azure Subscription ID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-15". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-09-15-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -83,7 +90,25 @@ def __init__( **kwargs: Any ) -> None: self._config = AzureBotServiceConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = 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) @@ -108,8 +133,11 @@ def __init__( self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( + 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 @@ -129,7 +157,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() @@ -138,5 +166,5 @@ def __enter__(self) -> "AzureBotService": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_configuration.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_configuration.py index 540805c9b9db..011c1f2f5dee 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_configuration.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_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 AzureBotServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AzureBotServiceConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for AzureBotService. Note that all parameters used to create this instance are saved as instance @@ -35,14 +28,13 @@ class AzureBotServiceConfiguration(Configuration): # pylint: disable=too-many-i :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Azure Subscription ID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-15". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-09-15-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(AzureBotServiceConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", "2022-09-15") + api_version: str = kwargs.pop("api_version", "2023-09-15-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-botservice/{}".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/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_serialization.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_serialization.py index 2c170e28dbca..2f781d740827 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_serialization.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -107,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 @@ -126,7 +143,7 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -153,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -277,8 +287,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: 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__) @@ -287,25 +297,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,8 +332,8 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): - """Return the JSON that would be sent to azure from this model. + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """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)`. @@ -334,10 +344,15 @@ def serialize(self, keep_readonly=False, **kwargs): :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=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -368,7 +383,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -384,7 +399,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -393,10 +408,15 @@ def deserialize(cls, data, content_type=None): :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(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +429,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -418,7 +438,7 @@ def from_dict(cls, data, key_extractors=None, content_type=None): 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): @@ -518,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +554,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = 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 @@ -602,7 +622,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): @@ -622,12 +642,11 @@ 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 - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -636,12 +655,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 @@ -656,8 +676,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -683,7 +703,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -703,6 +723,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -715,7 +736,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 """ @@ -723,10 +746,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) @@ -777,6 +798,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is CoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -795,7 +818,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -863,6 +886,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): @@ -875,9 +900,14 @@ 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) @@ -922,7 +952,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: @@ -955,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1132,10 +1164,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1161,7 +1193,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1170,7 +1203,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1191,7 +1223,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1242,7 +1273,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1297,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1383,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = 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 @@ -1405,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1442,7 +1473,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1471,22 +1502,22 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None - 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__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1527,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1539,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1613,7 +1644,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1661,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1718,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1769,7 +1800,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1823,10 +1853,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1854,7 +1884,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1871,7 +1901,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1906,7 +1936,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1943,7 +1973,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1959,9 +1989,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_vendor.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_vendor.py index 9aad73fc743e..0dafe0e287ff 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_vendor.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_vendor.py @@ -14,14 +14,3 @@ def _convert_request(request, files=None): 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: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_version.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_version.py index 48944bf3938a..035146e99a22 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_version.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "0.2.0" diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_azure_bot_service.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_azure_bot_service.py index 6e270fe50648..b041ce8fa303 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_azure_bot_service.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_azure_bot_service.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -22,6 +24,7 @@ DirectLineOperations, EmailOperations, HostSettingsOperations, + NetworkSecurityPerimeterConfigurationsOperations, OperationResultsOperations, Operations, PrivateEndpointConnectionsOperations, @@ -62,14 +65,18 @@ class AzureBotService: # pylint: disable=client-accepts-api-version-keyword,too :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.botservice.aio.operations.PrivateLinkResourcesOperations + :ivar network_security_perimeter_configurations: + NetworkSecurityPerimeterConfigurationsOperations operations + :vartype network_security_perimeter_configurations: + azure.mgmt.botservice.aio.operations.NetworkSecurityPerimeterConfigurationsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Azure Subscription ID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-15". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-09-15-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -83,7 +90,25 @@ def __init__( **kwargs: Any ) -> None: self._config = AzureBotServiceConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = 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) @@ -108,8 +133,13 @@ def __init__( self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( + 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 @@ -129,7 +159,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() @@ -138,5 +168,5 @@ async def __aenter__(self) -> "AzureBotService": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_configuration.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_configuration.py index 4c071fe5af6f..e0e281c48e04 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_configuration.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/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 AzureBotServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AzureBotServiceConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for AzureBotService. Note that all parameters used to create this instance are saved as instance @@ -35,14 +28,13 @@ class AzureBotServiceConfiguration(Configuration): # pylint: disable=too-many-i :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Azure Subscription ID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-15". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-09-15-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(AzureBotServiceConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", "2022-09-15") + api_version: str = kwargs.pop("api_version", "2023-09-15-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-botservice/{}".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/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_patch.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_patch.py index f99e77fef986..17dbc073e01b 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_patch.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_patch.py @@ -25,6 +25,7 @@ # # -------------------------------------------------------------------------- + # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/__init__.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/__init__.py index 67f6c5b0276c..712f818ea3ec 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/__init__.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/__init__.py @@ -17,6 +17,7 @@ from ._operation_results_operations import OperationResultsOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -34,6 +35,7 @@ "OperationResultsOperations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", + "NetworkSecurityPerimeterConfigurationsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bot_connection_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bot_connection_operations.py index af7e836b0bf2..28c03023e5b8 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bot_connection_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bot_connection_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 @@ -39,10 +40,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]] @@ -70,12 +71,11 @@ def __init__(self, *args, **kwargs) -> None: async def list_service_providers(self, **kwargs: Any) -> _models.ServiceProviderResponseList: """Lists the available Service Providers for creating Connection Settings. - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceProviderResponseList or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ServiceProviderResponseList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -86,23 +86,21 @@ async def list_service_providers(self, **kwargs: Any) -> _models.ServiceProvider _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServiceProviderResponseList] = kwargs.pop("cls", None) - request = build_list_service_providers_request( + _request = build_list_service_providers_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_service_providers.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -115,13 +113,9 @@ async def list_service_providers(self, **kwargs: Any) -> _models.ServiceProvider deserialized = self._deserialize("ServiceProviderResponseList", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_service_providers.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders" - } + return deserialized # type: ignore @distributed_trace_async async def list_with_secrets( @@ -136,12 +130,11 @@ async def list_with_secrets( :type resource_name: str :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -152,26 +145,24 @@ async def list_with_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) - request = build_list_with_secrets_request( + _request = build_list_with_secrets_request( resource_group_name=resource_group_name, resource_name=resource_name, connection_name=connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_with_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,13 +175,9 @@ async def list_with_secrets( deserialized = self._deserialize("ConnectionSetting", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_with_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets" - } + return deserialized # type: ignore @overload async def create( @@ -217,7 +204,6 @@ async def 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 :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: @@ -229,7 +215,7 @@ async def create( resource_group_name: str, resource_name: str, connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -244,11 +230,10 @@ async def create( :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str :param parameters: The parameters to provide for creating the Connection Setting. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: @@ -260,7 +245,7 @@ async def create( resource_group_name: str, resource_name: str, connection_name: str, - parameters: Union[_models.ConnectionSetting, IO], + parameters: Union[_models.ConnectionSetting, IO[bytes]], **kwargs: Any ) -> _models.ConnectionSetting: """Register a new Auth Connection for a Bot Service. @@ -273,17 +258,13 @@ async def create( :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str :param parameters: The parameters to provide for creating the Connection Setting. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting 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 + ConnectionSetting type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting or IO[bytes] :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -294,21 +275,19 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionSetting") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, resource_name=resource_name, connection_name=connection_name, @@ -317,15 +296,15 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -346,10 +325,6 @@ async def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } - @overload async def update( self, @@ -375,7 +350,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: @@ -387,7 +361,7 @@ async def update( resource_group_name: str, resource_name: str, connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -402,11 +376,10 @@ async def update( :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str :param parameters: The parameters to provide for updating the Connection Setting. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: @@ -418,7 +391,7 @@ async def update( resource_group_name: str, resource_name: str, connection_name: str, - parameters: Union[_models.ConnectionSetting, IO], + parameters: Union[_models.ConnectionSetting, IO[bytes]], **kwargs: Any ) -> _models.ConnectionSetting: """Updates a Connection Setting registration for a Bot Service. @@ -431,17 +404,13 @@ async def update( :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str :param parameters: The parameters to provide for updating the Connection Setting. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting 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 + ConnectionSetting type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting or IO[bytes] :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -452,21 +421,19 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionSetting") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, resource_name=resource_name, connection_name=connection_name, @@ -475,15 +442,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -504,10 +471,6 @@ async def update( return deserialized # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } - @distributed_trace_async async def get( self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any @@ -521,12 +484,11 @@ async def get( :type resource_name: str :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -537,26 +499,24 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_name, connection_name=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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -569,13 +529,9 @@ async def get( deserialized = self._deserialize("ConnectionSetting", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -590,12 +546,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type resource_name: str :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -606,26 +561,24 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, connection_name=connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -636,11 +589,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_bot_service( @@ -653,7 +602,6 @@ def list_by_bot_service( :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ConnectionSetting or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.ConnectionSetting] @@ -662,12 +610,10 @@ def list_by_bot_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectionSettingResponseList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -678,17 +624,16 @@ def list_by_bot_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_bot_service_request( + _request = build_list_by_bot_service_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_bot_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -700,13 +645,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ConnectionSettingResponseList", pipeline_response) @@ -716,10 +661,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -731,7 +677,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_bot_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bots_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bots_operations.py index d70d0bbdd4dd..8f51312128b2 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bots_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bots_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 @@ -39,10 +40,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]] @@ -88,7 +89,6 @@ async def 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 :return: Bot or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.Bot :raises ~azure.core.exceptions.HttpResponseError: @@ -99,7 +99,7 @@ async def create( self, resource_group_name: str, resource_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -112,11 +112,10 @@ async def create( :param resource_name: The name of the Bot resource. Required. :type resource_name: str :param parameters: The parameters to provide for the created bot. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Bot or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.Bot :raises ~azure.core.exceptions.HttpResponseError: @@ -124,7 +123,7 @@ async def create( @distributed_trace_async async def create( - self, resource_group_name: str, resource_name: str, parameters: Union[_models.Bot, IO], **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Bot, IO[bytes]], **kwargs: Any ) -> _models.Bot: """Creates a Bot Service. Bot Service is a resource group wide resource type. @@ -133,18 +132,14 @@ async def create( :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :param parameters: The parameters to provide for the created bot. Is either a model type or a - IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.Bot or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: The parameters to provide for the created bot. Is either a Bot type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.Bot or IO[bytes] :return: Bot or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.Bot :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -155,21 +150,19 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Bot] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Bot") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, @@ -177,15 +170,15 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -206,10 +199,6 @@ async def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } - @distributed_trace_async async def update( self, @@ -243,12 +232,11 @@ async def update( :type etag: str :param properties: The set of properties specific to bot resource. Default value is None. :type properties: ~azure.mgmt.botservice.models.BotProperties - :keyword callable cls: A custom type or function that will be passed the direct response :return: Bot or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.Bot :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,31 +247,29 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) cls: ClsType[_models.Bot] = kwargs.pop("cls", None) _parameters = _models.Bot(etag=etag, kind=kind, location=location, properties=properties, sku=sku, tags=tags) _json = self._serialize.body(_parameters, "Bot") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -304,10 +290,6 @@ async def update( return deserialized # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, **kwargs: Any @@ -319,12 +301,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,25 +316,23 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,11 +343,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Bot: @@ -379,12 +354,11 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Bot or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.Bot :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -395,25 +369,23 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Bot] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -426,13 +398,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) deserialized = self._deserialize("Bot", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Bot"]: @@ -441,7 +409,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy :param resource_group_name: The name of the Bot resource group in the user subscription. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Bot or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.Bot] :raises ~azure.core.exceptions.HttpResponseError: @@ -449,12 +416,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BotResponseList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -465,16 +430,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -486,13 +450,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("BotResponseList", pipeline_response) @@ -502,10 +466,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=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -518,15 +483,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices" - } - @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Bot"]: """Returns all the resources of a particular type belonging to a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Bot or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.Bot] :raises ~azure.core.exceptions.HttpResponseError: @@ -534,12 +494,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Bot"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BotResponseList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -550,15 +508,14 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Bot"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -570,13 +527,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("BotResponseList", pipeline_response) @@ -586,10 +543,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=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -602,8 +560,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices"} - @overload async def get_check_name_availability( self, @@ -620,7 +576,6 @@ async def get_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: CheckNameAvailabilityResponseBody or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody :raises ~azure.core.exceptions.HttpResponseError: @@ -628,17 +583,16 @@ async def get_check_name_availability( @overload async def get_check_name_availability( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResponseBody: """Check whether a bot name is available. :param parameters: The request body parameters to provide for the check name availability request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResponseBody or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody :raises ~azure.core.exceptions.HttpResponseError: @@ -646,22 +600,18 @@ async def get_check_name_availability( @distributed_trace_async async def get_check_name_availability( - self, parameters: Union[_models.CheckNameAvailabilityRequestBody, IO], **kwargs: Any + self, parameters: Union[_models.CheckNameAvailabilityRequestBody, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityResponseBody: """Check whether a bot name is available. :param parameters: The request body parameters to provide for the check name availability - request. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.CheckNameAvailabilityRequestBody 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 + request. Is either a CheckNameAvailabilityRequestBody type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.CheckNameAvailabilityRequestBody or IO[bytes] :return: CheckNameAvailabilityResponseBody or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -672,34 +622,32 @@ async def get_check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CheckNameAvailabilityResponseBody] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CheckNameAvailabilityRequestBody") - request = build_get_check_name_availability_request( + _request = build_get_check_name_availability_request( api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.get_check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -712,8 +660,6 @@ async def get_check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityResponseBody", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_check_name_availability.metadata = {"url": "/providers/Microsoft.BotService/checkNameAvailability"} + return deserialized # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_channels_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_channels_operations.py index 211cb9cf12e2..49027f77f828 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_channels_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_channels_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 @@ -38,10 +39,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]] @@ -94,7 +95,6 @@ async def 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 :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: @@ -106,7 +106,7 @@ async def create( resource_group_name: str, resource_name: str, channel_name: Union[str, _models.ChannelName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -125,11 +125,10 @@ async def create( "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName :param parameters: The parameters to provide for the created bot. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: @@ -141,7 +140,7 @@ async def create( resource_group_name: str, resource_name: str, channel_name: Union[str, _models.ChannelName], - parameters: Union[_models.BotChannel, IO], + parameters: Union[_models.BotChannel, IO[bytes]], **kwargs: Any ) -> _models.BotChannel: """Creates a Channel registration for a Bot Service. @@ -157,18 +156,14 @@ async def create( "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :param parameters: The parameters to provide for the created bot. Is either a model type or a - IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.BotChannel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: The parameters to provide for the created bot. Is either a BotChannel type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.BotChannel or IO[bytes] :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -179,21 +174,19 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BotChannel") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, resource_name=resource_name, channel_name=channel_name, @@ -202,15 +195,15 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -231,10 +224,6 @@ async def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } - @distributed_trace_async async def update( self, @@ -276,12 +265,11 @@ async def update( :param properties: The set of properties specific to bot channel resource. Default value is None. :type properties: ~azure.mgmt.botservice.models.Channel - :keyword callable cls: A custom type or function that will be passed the direct response :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -292,9 +280,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) @@ -303,7 +289,7 @@ async def update( ) _json = self._serialize.body(_parameters, "BotChannel") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, resource_name=resource_name, channel_name=channel_name, @@ -311,15 +297,15 @@ async def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -340,10 +326,6 @@ async def update( return deserialized # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, channel_name: str, **kwargs: Any @@ -357,12 +339,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type resource_name: str :param channel_name: The name of the Bot resource. Required. :type channel_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,26 +354,24 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, channel_name=channel_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,11 +382,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get( @@ -422,12 +397,11 @@ async def get( :type resource_name: str :param channel_name: The name of the Bot resource. Required. :type channel_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -438,26 +412,24 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_name, channel_name=channel_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -470,13 +442,9 @@ async def get( deserialized = self._deserialize("BotChannel", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } + return deserialized # type: ignore @distributed_trace_async async def list_with_keys( @@ -495,12 +463,11 @@ async def list_with_keys( "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListChannelWithKeysResponse or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ListChannelWithKeysResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -511,26 +478,24 @@ async def list_with_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListChannelWithKeysResponse] = kwargs.pop("cls", None) - request = build_list_with_keys_request( + _request = build_list_with_keys_request( resource_group_name=resource_group_name, resource_name=resource_name, channel_name=channel_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_with_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -543,13 +508,9 @@ async def list_with_keys( deserialized = self._deserialize("ListChannelWithKeysResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_with_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -562,7 +523,6 @@ def list_by_resource_group( :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BotChannel or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.BotChannel] :raises ~azure.core.exceptions.HttpResponseError: @@ -570,12 +530,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ChannelResponseList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -586,17 +544,16 @@ 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, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -608,13 +565,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ChannelResponseList", pipeline_response) @@ -624,10 +581,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=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -639,7 +597,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_direct_line_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_direct_line_operations.py index 136c3f25abd9..44edd92310c0 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_direct_line_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_direct_line_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, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,10 +29,10 @@ from ..._vendor import _convert_request from ...operations._direct_line_operations import build_regenerate_keys_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]] @@ -82,7 +83,6 @@ async def regenerate_keys( :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: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: @@ -94,7 +94,7 @@ async def regenerate_keys( resource_group_name: str, resource_name: str, channel_name: Union[str, _models.RegenerateKeysChannelName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -111,11 +111,10 @@ async def regenerate_keys( Known values are: "WebChatChannel" and "DirectLineChannel". Required. :type channel_name: str or ~azure.mgmt.botservice.models.RegenerateKeysChannelName :param parameters: The parameters to provide for the created bot. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: @@ -127,7 +126,7 @@ async def regenerate_keys( resource_group_name: str, resource_name: str, channel_name: Union[str, _models.RegenerateKeysChannelName], - parameters: Union[_models.SiteInfo, IO], + parameters: Union[_models.SiteInfo, IO[bytes]], **kwargs: Any ) -> _models.BotChannel: """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService @@ -141,18 +140,14 @@ async def regenerate_keys( :param channel_name: The name of the Channel resource for which keys are to be regenerated. Known values are: "WebChatChannel" and "DirectLineChannel". Required. :type channel_name: str or ~azure.mgmt.botservice.models.RegenerateKeysChannelName - :param parameters: The parameters to provide for the created bot. Is either a model type or a - IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.SiteInfo or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: The parameters to provide for the created bot. Is either a SiteInfo type or + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.SiteInfo or IO[bytes] :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -163,21 +158,19 @@ async def regenerate_keys( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SiteInfo") - request = build_regenerate_keys_request( + _request = build_regenerate_keys_request( resource_group_name=resource_group_name, resource_name=resource_name, channel_name=channel_name, @@ -186,15 +179,15 @@ async def regenerate_keys( content_type=content_type, json=_json, content=_content, - template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -207,10 +200,6 @@ async def regenerate_keys( deserialized = self._deserialize("BotChannel", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - regenerate_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys" - } + return deserialized # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_email_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_email_operations.py index 8f7f40aff2b6..33615b3be0e5 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_email_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_email_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, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,10 +28,10 @@ from ..._vendor import _convert_request from ...operations._email_operations import build_create_sign_in_url_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]] @@ -66,12 +66,11 @@ async def create_sign_in_url( :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CreateEmailSignInUrlResponse or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.CreateEmailSignInUrlResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -82,25 +81,23 @@ async def create_sign_in_url( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CreateEmailSignInUrlResponse] = kwargs.pop("cls", None) - request = build_create_sign_in_url_request( + _request = build_create_sign_in_url_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create_sign_in_url.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -113,10 +110,6 @@ async def create_sign_in_url( deserialized = self._deserialize("CreateEmailSignInUrlResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_sign_in_url.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/createEmailSignInUrl" - } + return deserialized # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_host_settings_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_host_settings_operations.py index 29e8ffea13f8..350084342ebe 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_host_settings_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_host_settings_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, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,10 +28,10 @@ from ..._vendor import _convert_request from ...operations._host_settings_operations import 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]] @@ -59,12 +59,11 @@ def __init__(self, *args, **kwargs) -> None: async def get(self, **kwargs: Any) -> _models.HostSettingsResponse: """Get per subscription settings needed to host bot in compute resource such as Azure App Service. - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostSettingsResponse or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.HostSettingsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -75,23 +74,21 @@ async def get(self, **kwargs: Any) -> _models.HostSettingsResponse: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostSettingsResponse] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -104,8 +101,6 @@ async def get(self, **kwargs: Any) -> _models.HostSettingsResponse: deserialized = self._deserialize("HostSettingsResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings"} + return deserialized # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_network_security_perimeter_configurations_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_network_security_perimeter_configurations_operations.py new file mode 100644 index 000000000000..d838e7661394 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_network_security_perimeter_configurations_operations.py @@ -0,0 +1,346 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union, cast +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._network_security_perimeter_configurations_operations import ( + build_get_request, + build_list_request, + build_reconcile_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.AzureBotService`'s + :attr:`network_security_perimeter_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> _models.NetworkSecurityPerimeterConfiguration: + """Gets the specified Network Security Perimeter configuration associated with the Bot. + + :param resource_group_name: The name of the Bot resource group in the user subscription. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param network_security_perimeter_configuration_name: The resource association Name. Composed + of parameter guid and association name. Required. + :type network_security_perimeter_configuration_name: str + :return: NetworkSecurityPerimeterConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkSecurityPerimeterConfiguration"]: + """List Network Security Perimeter configurations associated with the Bot. + + :param resource_group_name: The name of the Bot resource group in the user subscription. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkSecurityPerimeterConfigurationList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkSecurityPerimeterConfigurationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _reconcile_initial( + self, + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> Optional[_models.NetworkSecurityPerimeterConfiguration]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.NetworkSecurityPerimeterConfiguration]] = kwargs.pop("cls", None) + + _request = build_reconcile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_reconcile( + self, + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkSecurityPerimeterConfiguration]: + """Reconcile the specified Network Security Perimeter configuration associated with the Bot. + + :param resource_group_name: The name of the Bot resource group in the user subscription. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param network_security_perimeter_configuration_name: The resource association Name. Composed + of parameter guid and association name. Required. + :type network_security_perimeter_configuration_name: str + :return: An instance of AsyncLROPoller that returns either + NetworkSecurityPerimeterConfiguration or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = 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._reconcile_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.NetworkSecurityPerimeterConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NetworkSecurityPerimeterConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operation_results_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operation_results_operations.py index 448d2de6d45b..e46b9b362a2e 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operation_results_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operation_results_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, Optional, TypeVar, Union, cast +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,10 +30,10 @@ from ..._vendor import _convert_request from ...operations._operation_results_operations import 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]] @@ -60,7 +60,7 @@ def __init__(self, *args, **kwargs) -> None: async def _get_initial( self, operation_result_id: str, **kwargs: Any ) -> Optional[_models.OperationResultsDescription]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -71,24 +71,22 @@ async def _get_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.OperationResultsDescription]] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( operation_result_id=operation_result_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._get_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -103,13 +101,9 @@ async def _get_initial( deserialized = self._deserialize("OperationResultsDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _get_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_get( @@ -119,14 +113,6 @@ async def begin_get( :param operation_result_id: The ID of the operation result to get. Required. :type operation_result_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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 OperationResultsDescription or the result of cls(response) :rtype: @@ -136,9 +122,7 @@ async def begin_get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResultsDescription] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -157,7 +141,7 @@ async def begin_get( def get_long_running_output(pipeline_response): deserialized = self._deserialize("OperationResultsDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -167,14 +151,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.OperationResultsDescription].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_get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}" - } + return AsyncLROPoller[_models.OperationResultsDescription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operations.py index 59c08e55779a..3361738bb227 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/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. @@ -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 @@ -30,10 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +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,7 +61,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationEntity"]: """Lists all the available BotService operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationEntity or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.OperationEntity] :raises ~azure.core.exceptions.HttpResponseError: @@ -69,12 +68,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationEntity"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationEntityListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -85,14 +82,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationEntity"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -104,13 +100,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OperationEntityListResult", pipeline_response) @@ -120,10 +116,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -135,5 +132,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.BotService/operations"} diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_endpoint_connections_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_endpoint_connections_operations.py index 635716e2980b..f244ef8e90d4 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/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, 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 @@ -36,10 +37,10 @@ build_list_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]] @@ -74,7 +75,6 @@ def list( :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_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: @@ -84,12 +84,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,17 +98,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -122,13 +119,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -138,10 +135,11 @@ async def extract_data(pipeline_response): return 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=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -154,10 +152,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections" - } - @distributed_trace_async async def get( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -172,12 +166,11 @@ async def get( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. 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.botservice.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -188,26 +181,24 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -220,13 +211,9 @@ async def get( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload async def create( @@ -254,7 +241,6 @@ async def 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 :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: @@ -266,7 +252,7 @@ async def create( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -282,11 +268,10 @@ async def create( with the Azure resource. Required. :type private_endpoint_connection_name: str :param properties: The private endpoint connection properties. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: @@ -298,7 +283,7 @@ async def create( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], + properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnection: """Update the state of specified private endpoint connection associated with the Bot. @@ -311,18 +296,14 @@ async def create( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Is either a model type or a IO - type. Required. - :type properties: ~azure.mgmt.botservice.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 + :param properties: The private endpoint connection properties. Is either a + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.botservice.models.PrivateEndpointConnection or IO[bytes] :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,21 +314,19 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(properties, (IO, bytes)): + if isinstance(properties, (IOBase, bytes)): _content = properties else: _json = self._serialize.body(properties, "PrivateEndpointConnection") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -356,15 +335,15 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,13 +356,9 @@ async def create( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -399,12 +374,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -415,26 +389,24 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -445,8 +417,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_link_resources_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_link_resources_operations.py index 11a39921edab..570007f89d7a 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_link_resources_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/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, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,10 +28,10 @@ from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_bot_resource_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]] @@ -66,12 +66,11 @@ async def list_by_bot_resource( :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceListResult or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -82,25 +81,23 @@ async def list_by_bot_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - request = build_list_by_bot_resource_request( + _request = build_list_by_bot_resource_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_bot_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -113,10 +110,6 @@ async def list_by_bot_resource( deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_by_bot_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources" - } + return deserialized # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_qn_amaker_endpoint_keys_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_qn_amaker_endpoint_keys_operations.py index e1e28a0a90e5..c627fc9eb4e7 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_qn_amaker_endpoint_keys_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_qn_amaker_endpoint_keys_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, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,10 +29,10 @@ from ..._vendor import _convert_request from ...operations._qn_amaker_endpoint_keys_operations import 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]] @@ -71,7 +72,6 @@ async def get( :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: QnAMakerEndpointKeysResponse or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -79,17 +79,16 @@ async def get( @overload async def get( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.QnAMakerEndpointKeysResponse: """Lists the QnA Maker endpoint keys. :param parameters: The request body parameters to provide for the check name availability request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QnAMakerEndpointKeysResponse or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -97,22 +96,18 @@ async def get( @distributed_trace_async async def get( - self, parameters: Union[_models.QnAMakerEndpointKeysRequestBody, IO], **kwargs: Any + self, parameters: Union[_models.QnAMakerEndpointKeysRequestBody, IO[bytes]], **kwargs: Any ) -> _models.QnAMakerEndpointKeysResponse: """Lists the QnA Maker endpoint keys. :param parameters: The request body parameters to provide for the check name availability - request. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody 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 + request. Is either a QnAMakerEndpointKeysRequestBody type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody or IO[bytes] :return: QnAMakerEndpointKeysResponse or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,35 +118,33 @@ async def get( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.QnAMakerEndpointKeysResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "QnAMakerEndpointKeysRequestBody") - request = build_get_request( + _request = build_get_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -164,8 +157,6 @@ async def get( deserialized = self._deserialize("QnAMakerEndpointKeysResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listQnAMakerEndpointKeys"} + return deserialized # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py index a679b8e73964..3669cf918891 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py @@ -33,7 +33,10 @@ from ._models_py3 import EmailChannel from ._models_py3 import EmailChannelProperties from ._models_py3 import Error +from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorBody +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse from ._models_py3 import FacebookChannel from ._models_py3 import FacebookChannelProperties from ._models_py3 import FacebookPage @@ -47,6 +50,13 @@ from ._models_py3 import M365Extensions from ._models_py3 import MsTeamsChannel from ._models_py3 import MsTeamsChannelProperties +from ._models_py3 import NetworkSecurityPerimeter +from ._models_py3 import NetworkSecurityPerimeterConfiguration +from ._models_py3 import NetworkSecurityPerimeterConfigurationList +from ._models_py3 import NetworkSecurityPerimeterConfigurationProperties +from ._models_py3 import NspAccessRule +from ._models_py3 import NspAccessRuleProperties +from ._models_py3 import NspAccessRulePropertiesSubscriptionsItem from ._models_py3 import Omnichannel from ._models_py3 import OperationDisplayInfo from ._models_py3 import OperationEntity @@ -60,9 +70,13 @@ from ._models_py3 import PrivateLinkResourceBase from ._models_py3 import PrivateLinkResourceListResult from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Profile +from ._models_py3 import ProvisioningIssue +from ._models_py3 import ProvisioningIssueProperties from ._models_py3 import QnAMakerEndpointKeysRequestBody from ._models_py3 import QnAMakerEndpointKeysResponse from ._models_py3 import Resource +from ._models_py3 import ResourceAssociation from ._models_py3 import SearchAssistant from ._models_py3 import ServiceProvider from ._models_py3 import ServiceProviderParameter @@ -89,16 +103,20 @@ from ._models_py3 import WebChatChannelProperties from ._models_py3 import WebChatSite +from ._azure_bot_service_enums import AccessMode from ._azure_bot_service_enums import ChannelName from ._azure_bot_service_enums import EmailChannelAuthMethod from ._azure_bot_service_enums import Key from ._azure_bot_service_enums import Kind from ._azure_bot_service_enums import MsaAppType +from ._azure_bot_service_enums import NspAccessRuleDirection from ._azure_bot_service_enums import OperationResultStatus from ._azure_bot_service_enums import PrivateEndpointConnectionProvisioningState from ._azure_bot_service_enums import PrivateEndpointServiceConnectionStatus +from ._azure_bot_service_enums import ProvisioningState from ._azure_bot_service_enums import PublicNetworkAccess from ._azure_bot_service_enums import RegenerateKeysChannelName +from ._azure_bot_service_enums import Severity from ._azure_bot_service_enums import SkuName from ._azure_bot_service_enums import SkuTier from ._patch import __all__ as _patch_all @@ -133,7 +151,10 @@ "EmailChannel", "EmailChannelProperties", "Error", + "ErrorAdditionalInfo", "ErrorBody", + "ErrorDetail", + "ErrorResponse", "FacebookChannel", "FacebookChannelProperties", "FacebookPage", @@ -147,6 +168,13 @@ "M365Extensions", "MsTeamsChannel", "MsTeamsChannelProperties", + "NetworkSecurityPerimeter", + "NetworkSecurityPerimeterConfiguration", + "NetworkSecurityPerimeterConfigurationList", + "NetworkSecurityPerimeterConfigurationProperties", + "NspAccessRule", + "NspAccessRuleProperties", + "NspAccessRulePropertiesSubscriptionsItem", "Omnichannel", "OperationDisplayInfo", "OperationEntity", @@ -160,9 +188,13 @@ "PrivateLinkResourceBase", "PrivateLinkResourceListResult", "PrivateLinkServiceConnectionState", + "Profile", + "ProvisioningIssue", + "ProvisioningIssueProperties", "QnAMakerEndpointKeysRequestBody", "QnAMakerEndpointKeysResponse", "Resource", + "ResourceAssociation", "SearchAssistant", "ServiceProvider", "ServiceProviderParameter", @@ -188,16 +220,20 @@ "WebChatChannel", "WebChatChannelProperties", "WebChatSite", + "AccessMode", "ChannelName", "EmailChannelAuthMethod", "Key", "Kind", "MsaAppType", + "NspAccessRuleDirection", "OperationResultStatus", "PrivateEndpointConnectionProvisioningState", "PrivateEndpointServiceConnectionStatus", + "ProvisioningState", "PublicNetworkAccess", "RegenerateKeysChannelName", + "Severity", "SkuName", "SkuTier", ] diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_azure_bot_service_enums.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_azure_bot_service_enums.py index 24dd86f7728e..aa08472125fc 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_azure_bot_service_enums.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_azure_bot_service_enums.py @@ -10,6 +10,14 @@ from azure.core import CaseInsensitiveEnumMeta +class AccessMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Access Mode of the resource association.""" + + ENFORCED = "Enforced" + LEARNING = "Learning" + AUDIT = "Audit" + + class ChannelName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ChannelName.""" @@ -37,10 +45,10 @@ class ChannelName(str, Enum, metaclass=CaseInsensitiveEnumMeta): class EmailChannelAuthMethod(float, Enum, metaclass=CaseInsensitiveEnumMeta): """Email channel auth method. 0 Password (Default); 1 Graph.""" - #: Basic authentication. PASSWORD = 0 - #: Modern authentication. + """Basic authentication.""" GRAPH = 1 + """Modern authentication.""" class Key(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -68,6 +76,13 @@ class MsaAppType(str, Enum, metaclass=CaseInsensitiveEnumMeta): MULTI_TENANT = "MultiTenant" +class NspAccessRuleDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Direction of Access Rule.""" + + INBOUND = "Inbound" + OUTBOUND = "Outbound" + + class OperationResultStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the operation being performed.""" @@ -95,11 +110,23 @@ class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiv REJECTED = "Rejected" +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ProvisioningState.""" + + CREATING = "Creating" + UPDATING = "Updating" + ACCEPTED = "Accepted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether the bot is in an isolated network.""" ENABLED = "Enabled" DISABLED = "Disabled" + SECURED_BY_PERIMETER = "SecuredByPerimeter" class RegenerateKeysChannelName(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -109,6 +136,13 @@ class RegenerateKeysChannelName(str, Enum, metaclass=CaseInsensitiveEnumMeta): DIRECT_LINE_CHANNEL = "DirectLineChannel" +class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of Network Security Perimeter configuration propagation.""" + + WARNING = "Warning" + ERROR = "Error" + + class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of SKU.""" diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models_py3.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models_py3.py index cf2b03a9e72e..5a3c0e1c77fb 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models_py3.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models_py3.py @@ -34,7 +34,7 @@ class Channel(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar channel_name: The channel name. Required. :vartype channel_name: str @@ -82,7 +82,7 @@ class Channel(_serialization.Model): } } - def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs): + def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs: Any) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -101,7 +101,7 @@ class AcsChatChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -125,7 +125,7 @@ class AcsChatChannel(Channel): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs): + def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs: Any) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -141,7 +141,7 @@ class AlexaChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -174,8 +174,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.AlexaChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -194,7 +194,7 @@ class AlexaChannelProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar alexa_skill_id: The Alexa skill Id. Required. :vartype alexa_skill_id: str @@ -220,7 +220,7 @@ class AlexaChannelProperties(_serialization.Model): "is_enabled": {"key": "isEnabled", "type": "bool"}, } - def __init__(self, *, alexa_skill_id: str, is_enabled: bool, **kwargs): + def __init__(self, *, alexa_skill_id: str, is_enabled: bool, **kwargs: Any) -> None: """ :keyword alexa_skill_id: The Alexa skill Id. Required. :paramtype alexa_skill_id: str @@ -287,8 +287,8 @@ def __init__( sku: Optional["_models.Sku"] = None, kind: Optional[Union[str, "_models.Kind"]] = None, etag: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Specifies the location of the resource. :paramtype location: str @@ -371,8 +371,8 @@ def __init__( kind: Optional[Union[str, "_models.Kind"]] = None, etag: Optional[str] = None, properties: Optional["_models.BotProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Specifies the location of the resource. :paramtype location: str @@ -449,8 +449,8 @@ def __init__( kind: Optional[Union[str, "_models.Kind"]] = None, etag: Optional[str] = None, properties: Optional["_models.Channel"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Specifies the location of the resource. :paramtype location: str @@ -475,7 +475,7 @@ class BotProperties(_serialization.Model): # 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 display_name: The Name of the bot. Required. :vartype display_name: str @@ -525,7 +525,7 @@ class BotProperties(_serialization.Model): # pylint: disable=too-many-instance- :ivar tenant_id: The Tenant Id for the bot. :vartype tenant_id: str :ivar public_network_access: Whether the bot is in an isolated network. Known values are: - "Enabled" and "Disabled". + "Enabled", "Disabled", and "SecuredByPerimeter". :vartype public_network_access: str or ~azure.mgmt.botservice.models.PublicNetworkAccess :ivar is_streaming_supported: Whether the bot is streaming supported. :vartype is_streaming_supported: bool @@ -544,6 +544,10 @@ class BotProperties(_serialization.Model): # pylint: disable=too-many-instance- bot. :vartype private_endpoint_connections: list[~azure.mgmt.botservice.models.PrivateEndpointConnection] + :ivar network_security_perimeter_configurations: List of Network Security Perimeter + configurations for the bot. + :vartype network_security_perimeter_configurations: + list[~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration] :ivar open_with_hint: The hint to browser (e.g. protocol handler) on how to open the bot for authoring. :vartype open_with_hint: str @@ -567,6 +571,7 @@ class BotProperties(_serialization.Model): # pylint: disable=too-many-instance- "is_developer_app_insights_api_key_set": {"readonly": True}, "migration_token": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, + "network_security_perimeter_configurations": {"readonly": True}, "provisioning_state": {"readonly": True}, } @@ -602,6 +607,10 @@ class BotProperties(_serialization.Model): # pylint: disable=too-many-instance- "schema_transformation_version": {"key": "schemaTransformationVersion", "type": "str"}, "storage_resource_id": {"key": "storageResourceId", "type": "str"}, "private_endpoint_connections": {"key": "privateEndpointConnections", "type": "[PrivateEndpointConnection]"}, + "network_security_perimeter_configurations": { + "key": "networkSecurityPerimeterConfigurations", + "type": "[NetworkSecurityPerimeterConfiguration]", + }, "open_with_hint": {"key": "openWithHint", "type": "str"}, "app_password_hint": {"key": "appPasswordHint", "type": "str"}, "provisioning_state": {"key": "provisioningState", "type": "str"}, @@ -638,8 +647,8 @@ def __init__( # pylint: disable=too-many-locals open_with_hint: Optional[str] = None, app_password_hint: Optional[str] = None, publishing_credentials: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword display_name: The Name of the bot. Required. :paramtype display_name: str @@ -681,7 +690,7 @@ def __init__( # pylint: disable=too-many-locals :keyword tenant_id: The Tenant Id for the bot. :paramtype tenant_id: str :keyword public_network_access: Whether the bot is in an isolated network. Known values are: - "Enabled" and "Disabled". + "Enabled", "Disabled", and "SecuredByPerimeter". :paramtype public_network_access: str or ~azure.mgmt.botservice.models.PublicNetworkAccess :keyword is_streaming_supported: Whether the bot is streaming supported. :paramtype is_streaming_supported: bool @@ -733,6 +742,7 @@ def __init__( # pylint: disable=too-many-locals self.schema_transformation_version = schema_transformation_version self.storage_resource_id = storage_resource_id self.private_endpoint_connections = None + self.network_security_perimeter_configurations = None self.open_with_hint = open_with_hint self.app_password_hint = app_password_hint self.provisioning_state = None @@ -759,7 +769,7 @@ class BotResponseList(_serialization.Model): "value": {"key": "value", "type": "[Bot]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of bot service resources. :paramtype next_link: str @@ -789,7 +799,7 @@ class ChannelResponseList(_serialization.Model): "value": {"key": "value", "type": "[BotChannel]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of bot service channel resources. :paramtype next_link: str @@ -851,8 +861,8 @@ def __init__( is_enabled: Optional[bool] = None, disable_local_auth: Optional[bool] = None, require_terms_agreement: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword extension_key1: The extensionKey1. :paramtype extension_key1: str @@ -903,7 +913,7 @@ class CheckNameAvailabilityRequestBody(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: the name of the bot for which availability needs to be checked. :paramtype name: str @@ -916,7 +926,8 @@ def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, ** class CheckNameAvailabilityResponseBody(_serialization.Model): - """The response body returned for a request to Bot Service Management to check availability of a bot name. + """The response body returned for a request to Bot Service Management to check availability of a + bot name. :ivar valid: indicates if the bot name is valid. :vartype valid: bool @@ -934,8 +945,13 @@ class CheckNameAvailabilityResponseBody(_serialization.Model): } def __init__( - self, *, valid: Optional[bool] = None, message: Optional[str] = None, abs_code: Optional[str] = None, **kwargs - ): + self, + *, + valid: Optional[bool] = None, + message: Optional[str] = None, + abs_code: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword valid: indicates if the bot name is valid. :paramtype valid: bool @@ -968,7 +984,7 @@ class ConnectionItemName(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -1031,8 +1047,8 @@ def __init__( kind: Optional[Union[str, "_models.Kind"]] = None, etag: Optional[str] = None, properties: Optional["_models.ConnectionSettingProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Specifies the location of the resource. :paramtype location: str @@ -1053,7 +1069,8 @@ def __init__( class ConnectionSettingParameter(_serialization.Model): - """Extra Parameter in a Connection Setting Properties to indicate service provider specific properties. + """Extra Parameter in a Connection Setting Properties to indicate service provider specific + properties. :ivar key: Key for the Connection Setting Parameter. :vartype key: str @@ -1066,7 +1083,7 @@ class ConnectionSettingParameter(_serialization.Model): "value": {"key": "value", "type": "str"}, } - def __init__(self, *, key: Optional[str] = None, value: Optional[str] = None, **kwargs): + def __init__(self, *, key: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ :keyword key: Key for the Connection Setting Parameter. :paramtype key: str @@ -1083,6 +1100,10 @@ class ConnectionSettingProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + :ivar id: Id of the Connection Setting. + :vartype id: str + :ivar name: Name of the Connection Setting. + :vartype name: str :ivar client_id: Client Id associated with the Connection Setting. :vartype client_id: str :ivar setting_id: Setting Id set by the service for the Connection Setting. @@ -1107,6 +1128,8 @@ class ConnectionSettingProperties(_serialization.Model): } _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, "client_id": {"key": "clientId", "type": "str"}, "setting_id": {"key": "settingId", "type": "str"}, "client_secret": {"key": "clientSecret", "type": "str"}, @@ -1120,6 +1143,8 @@ class ConnectionSettingProperties(_serialization.Model): def __init__( self, *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, client_id: Optional[str] = None, client_secret: Optional[str] = None, scopes: str = "", @@ -1127,9 +1152,13 @@ def __init__( service_provider_display_name: Optional[str] = None, parameters: Optional[List["_models.ConnectionSettingParameter"]] = None, provisioning_state: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ + :keyword id: Id of the Connection Setting. + :paramtype id: str + :keyword name: Name of the Connection Setting. + :paramtype name: str :keyword client_id: Client Id associated with the Connection Setting. :paramtype client_id: str :keyword client_secret: Client Secret associated with the Connection Setting. @@ -1147,6 +1176,8 @@ def __init__( :paramtype provisioning_state: str """ super().__init__(**kwargs) + self.id = id + self.name = name self.client_id = client_id self.setting_id = None self.client_secret = client_secret @@ -1178,7 +1209,7 @@ class ConnectionSettingResponseList(_serialization.Model): "value": {"key": "value", "type": "[ConnectionSetting]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of bot service connection setting resources. @@ -1217,8 +1248,8 @@ def __init__( *, location: Optional[str] = None, properties: Optional["_models.CreateEmailSignInUrlResponseProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Specifies the location of the resource. :paramtype location: str @@ -1242,7 +1273,7 @@ class CreateEmailSignInUrlResponseProperties(_serialization.Model): "url": {"key": "url", "type": "str"}, } - def __init__(self, *, url: Optional[str] = None, **kwargs): + def __init__(self, *, url: Optional[str] = None, **kwargs: Any) -> None: """ :keyword url: Sign in url. :paramtype url: str @@ -1256,7 +1287,7 @@ class DirectLineChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -1289,8 +1320,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.DirectLineChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -1331,8 +1362,8 @@ def __init__( extension_key1: str = "", extension_key2: str = "", direct_line_embed_code: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword sites: The list of Direct Line sites. :paramtype sites: list[~azure.mgmt.botservice.models.DirectLineSite] @@ -1355,7 +1386,7 @@ class Site(_serialization.Model): # pylint: disable=too-many-instance-attribute Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar tenant_id: Tenant Id. :vartype tenant_id: str @@ -1451,8 +1482,8 @@ def __init__( trusted_origins: Optional[List[str]] = None, is_web_chat_speech_enabled: bool = False, is_webchat_preview_enabled: bool = False, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tenant_id: Tenant Id. :paramtype tenant_id: str @@ -1516,7 +1547,7 @@ class DirectLineSite(Site): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar tenant_id: Tenant Id. :vartype tenant_id: str @@ -1563,119 +1594,13 @@ class DirectLineSite(Site): # pylint: disable=too-many-instance-attributes :vartype is_webchat_preview_enabled: bool """ - _validation = { - "site_id": {"readonly": True}, - "site_name": {"required": True}, - "key": {"readonly": True}, - "key2": {"readonly": True}, - "is_enabled": {"required": True}, - "is_token_enabled": {"readonly": True}, - } - - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "site_id": {"key": "siteId", "type": "str"}, - "site_name": {"key": "siteName", "type": "str"}, - "key": {"key": "key", "type": "str"}, - "key2": {"key": "key2", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "is_token_enabled": {"key": "isTokenEnabled", "type": "bool"}, - "is_endpoint_parameters_enabled": {"key": "isEndpointParametersEnabled", "type": "bool"}, - "is_detailed_logging_enabled": {"key": "isDetailedLoggingEnabled", "type": "bool"}, - "is_block_user_upload_enabled": {"key": "isBlockUserUploadEnabled", "type": "bool"}, - "is_no_storage_enabled": {"key": "isNoStorageEnabled", "type": "bool"}, - "e_tag": {"key": "eTag", "type": "str"}, - "app_id": {"key": "appId", "type": "str"}, - "is_v1_enabled": {"key": "isV1Enabled", "type": "bool"}, - "is_v3_enabled": {"key": "isV3Enabled", "type": "bool"}, - "is_secure_site_enabled": {"key": "isSecureSiteEnabled", "type": "bool"}, - "trusted_origins": {"key": "trustedOrigins", "type": "[str]"}, - "is_web_chat_speech_enabled": {"key": "isWebChatSpeechEnabled", "type": "bool"}, - "is_webchat_preview_enabled": {"key": "isWebchatPreviewEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - site_name: str, - is_enabled: bool, - tenant_id: Optional[str] = None, - is_endpoint_parameters_enabled: Optional[bool] = None, - is_detailed_logging_enabled: Optional[bool] = None, - is_block_user_upload_enabled: Optional[bool] = None, - is_no_storage_enabled: Optional[bool] = None, - e_tag: Optional[str] = None, - app_id: Optional[str] = None, - is_v1_enabled: Optional[bool] = None, - is_v3_enabled: Optional[bool] = None, - is_secure_site_enabled: Optional[bool] = None, - trusted_origins: Optional[List[str]] = None, - is_web_chat_speech_enabled: bool = False, - is_webchat_preview_enabled: bool = False, - **kwargs - ): - """ - :keyword tenant_id: Tenant Id. - :paramtype tenant_id: str - :keyword site_name: Site name. Required. - :paramtype site_name: str - :keyword is_enabled: Whether this site is enabled for DirectLine channel. Required. - :paramtype is_enabled: bool - :keyword is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for - channel. - :paramtype is_endpoint_parameters_enabled: bool - :keyword is_detailed_logging_enabled: Whether this site is disabled detailed logging for. - :paramtype is_detailed_logging_enabled: bool - :keyword is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :paramtype is_block_user_upload_enabled: bool - :keyword is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. - :paramtype is_no_storage_enabled: bool - :keyword e_tag: Entity Tag. - :paramtype e_tag: str - :keyword app_id: DirectLine application id. - :paramtype app_id: str - :keyword is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. - :paramtype is_v1_enabled: bool - :keyword is_v3_enabled: Whether this site is enabled for Bot Framework V3 protocol. - :paramtype is_v3_enabled: bool - :keyword is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :paramtype is_secure_site_enabled: bool - :keyword trusted_origins: List of Trusted Origin URLs for this site. This field is applicable - only if isSecureSiteEnabled is True. - :paramtype trusted_origins: list[str] - :keyword is_web_chat_speech_enabled: Whether this site is enabled for Webchat Speech. - :paramtype is_web_chat_speech_enabled: bool - :keyword is_webchat_preview_enabled: Whether this site is enabled for preview versions of - Webchat. - :paramtype is_webchat_preview_enabled: bool - """ - super().__init__( - tenant_id=tenant_id, - site_name=site_name, - is_enabled=is_enabled, - is_endpoint_parameters_enabled=is_endpoint_parameters_enabled, - is_detailed_logging_enabled=is_detailed_logging_enabled, - is_block_user_upload_enabled=is_block_user_upload_enabled, - is_no_storage_enabled=is_no_storage_enabled, - e_tag=e_tag, - app_id=app_id, - is_v1_enabled=is_v1_enabled, - is_v3_enabled=is_v3_enabled, - is_secure_site_enabled=is_secure_site_enabled, - trusted_origins=trusted_origins, - is_web_chat_speech_enabled=is_web_chat_speech_enabled, - is_webchat_preview_enabled=is_webchat_preview_enabled, - **kwargs - ) - class DirectLineSpeechChannel(Channel): """DirectLine Speech channel definition. 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -1708,8 +1633,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.DirectLineSpeechChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -1764,8 +1689,8 @@ def __init__( custom_voice_deployment_id: Optional[str] = None, custom_speech_model_id: Optional[str] = None, is_default_bot_for_cog_svc_account: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword cognitive_service_resource_id: The cognitive service id with this channel registration. @@ -1800,7 +1725,7 @@ class EmailChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -1833,8 +1758,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.EmailChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -1851,7 +1776,7 @@ def __init__( class EmailChannelProperties(_serialization.Model): """The parameters to provide for the Email channel. - 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 email_address: The email address. Required. :vartype email_address: str @@ -1888,8 +1813,8 @@ def __init__( auth_method: Optional[Union[float, "_models.EmailChannelAuthMethod"]] = None, password: Optional[str] = None, magic_code: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword email_address: The email address. Required. :paramtype email_address: str @@ -1923,7 +1848,7 @@ class Error(_serialization.Model): "error": {"key": "error", "type": "ErrorBody"}, } - def __init__(self, *, error: Optional["_models.ErrorBody"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorBody"] = None, **kwargs: Any) -> None: """ :keyword error: The error body. :paramtype error: ~azure.mgmt.botservice.models.ErrorBody @@ -1932,10 +1857,38 @@ def __init__(self, *, error: Optional["_models.ErrorBody"] = None, **kwargs): self.error = error +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + class ErrorBody(_serialization.Model): """Bot Service error body. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar code: error code. Required. :vartype code: str @@ -1953,7 +1906,7 @@ class ErrorBody(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, *, code: str, message: str, **kwargs): + def __init__(self, *, code: str, message: str, **kwargs: Any) -> None: """ :keyword code: error code. Required. :paramtype code: str @@ -1965,12 +1918,76 @@ def __init__(self, *, code: str, message: str, **kwargs): self.message = message +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.botservice.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.botservice.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.botservice.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.botservice.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + class FacebookChannel(Channel): """Facebook channel definition. 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -2003,8 +2020,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.FacebookChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -2023,7 +2040,7 @@ class FacebookChannelProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar verify_token: Verify token. Value only returned through POST to the action Channel List API, otherwise empty. @@ -2064,8 +2081,8 @@ def __init__( is_enabled: bool, pages: Optional[List["_models.FacebookPage"]] = None, app_secret: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword pages: The list of Facebook pages. :paramtype pages: list[~azure.mgmt.botservice.models.FacebookPage] @@ -2089,7 +2106,7 @@ def __init__( class FacebookPage(_serialization.Model): """A Facebook page for Facebook channel registration. - 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: Page id. Required. :vartype id: str @@ -2107,7 +2124,9 @@ class FacebookPage(_serialization.Model): "access_token": {"key": "accessToken", "type": "str"}, } - def __init__(self, *, id: str, access_token: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin + def __init__( + self, *, id: str, access_token: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin + ) -> None: """ :keyword id: Page id. Required. :paramtype id: str @@ -2121,7 +2140,8 @@ def __init__(self, *, id: str, access_token: Optional[str] = None, **kwargs): # class HostSettingsResponse(_serialization.Model): - """The response body returned for a request to Bot Service Management to check per subscription hostSettings. + """The response body returned for a request to Bot Service Management to check per subscription + hostSettings. :ivar o_auth_url: For in-conversation bot user authentication. :vartype o_auth_url: str @@ -2165,8 +2185,8 @@ def __init__( to_channel_from_bot_o_auth_scope: Optional[str] = None, validate_authority: Optional[bool] = None, bot_open_id_metadata: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword o_auth_url: For in-conversation bot user authentication. :paramtype o_auth_url: str @@ -2203,7 +2223,7 @@ class KikChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -2236,8 +2256,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.KikChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -2254,7 +2274,7 @@ def __init__( class KikChannelProperties(_serialization.Model): """The parameters to provide for the Kik channel. - 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 user_name: The Kik user name. Required. :vartype user_name: str @@ -2286,8 +2306,8 @@ def __init__( is_enabled: bool, api_key: Optional[str] = None, is_validated: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword user_name: The Kik user name. Required. :paramtype user_name: str @@ -2311,7 +2331,7 @@ class LineChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -2344,8 +2364,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.LineChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -2364,7 +2384,7 @@ class LineChannelProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar line_registrations: The list of line channel registrations. Required. :vartype line_registrations: list[~azure.mgmt.botservice.models.LineRegistration] @@ -2386,7 +2406,7 @@ class LineChannelProperties(_serialization.Model): "is_validated": {"key": "isValidated", "type": "bool"}, } - def __init__(self, *, line_registrations: List["_models.LineRegistration"], **kwargs): + def __init__(self, *, line_registrations: List["_models.LineRegistration"], **kwargs: Any) -> None: """ :keyword line_registrations: The list of line channel registrations. Required. :paramtype line_registrations: list[~azure.mgmt.botservice.models.LineRegistration] @@ -2420,7 +2440,9 @@ class LineRegistration(_serialization.Model): "channel_access_token": {"key": "channelAccessToken", "type": "str"}, } - def __init__(self, *, channel_secret: Optional[str] = None, channel_access_token: Optional[str] = None, **kwargs): + def __init__( + self, *, channel_secret: Optional[str] = None, channel_access_token: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword channel_secret: Secret for the line channel registration. :paramtype channel_secret: str @@ -2510,8 +2532,8 @@ def __init__( provisioning_state: Optional[str] = None, entity_tag: Optional[str] = None, changed_time: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Specifies the location of the resource. :paramtype location: str @@ -2550,7 +2572,7 @@ class M365Extensions(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -2574,7 +2596,7 @@ class M365Extensions(Channel): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs): + def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs: Any) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -2590,7 +2612,7 @@ class MsTeamsChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -2623,8 +2645,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.MsTeamsChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -2641,7 +2663,7 @@ def __init__( class MsTeamsChannelProperties(_serialization.Model): """The parameters to provide for the Microsoft Teams channel. - 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 enable_calling: Enable calling for Microsoft Teams channel. :vartype enable_calling: bool @@ -2677,10 +2699,10 @@ def __init__( enable_calling: bool = False, calling_webhook: Optional[str] = None, incoming_call_route: Optional[str] = None, - deployment_environment: str = "FallbackDeploymentEnvironment", + deployment_environment: str = "CommercialDeployment", accepted_terms: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enable_calling: Enable calling for Microsoft Teams channel. :paramtype enable_calling: bool @@ -2704,12 +2726,298 @@ def __init__( self.accepted_terms = accepted_terms +class NetworkSecurityPerimeter(_serialization.Model): + """Information about Network Security Perimeter. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar perimeter_guid: Guid of the Network Security Perimeter. + :vartype perimeter_guid: str + :ivar location: Location of the Network Security Perimeter. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "perimeter_guid": {"key": "perimeterGuid", "type": "str"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, perimeter_guid: Optional[str] = None, location: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword perimeter_guid: Guid of the Network Security Perimeter. + :paramtype perimeter_guid: str + :keyword location: Location of the Network Security Perimeter. + :paramtype location: str + """ + super().__init__(**kwargs) + self.id = None + self.perimeter_guid = perimeter_guid + self.location = location + + +class NetworkSecurityPerimeterConfiguration(_serialization.Model): + """Network Security Perimeter configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource. + :vartype name: str + :ivar type: Type of the resource. + :vartype type: str + :ivar properties: Properties of the Network Security Perimeter configuration. + :vartype properties: + ~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfigurationProperties + """ + + _validation = { + "properties": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "NetworkSecurityPerimeterConfigurationProperties"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Fully qualified identifier of the resource. + :paramtype id: str + :keyword name: Name of the resource. + :paramtype name: str + :keyword type: Type of the resource. + :paramtype type: str + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.properties = None + + +class NetworkSecurityPerimeterConfigurationList(_serialization.Model): # pylint: disable=name-too-long + """Result of the List NetworkSecurityPerimeterConfiguration operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A collection of Network Security Perimeter configurations. + :vartype value: list[~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration] + :ivar next_link: Link to retrieve next page of results. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkSecurityPerimeterConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class NetworkSecurityPerimeterConfigurationProperties(_serialization.Model): # pylint: disable=name-too-long + """Properties of Network Security Perimeter configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Known values are: "Creating", "Updating", "Accepted", "Succeeded", + "Failed", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.botservice.models.ProvisioningState + :ivar provisioning_issues: List of Provisioning Issues if any. + :vartype provisioning_issues: list[~azure.mgmt.botservice.models.ProvisioningIssue] + :ivar network_security_perimeter: Information about Network Security Perimeter. + :vartype network_security_perimeter: ~azure.mgmt.botservice.models.NetworkSecurityPerimeter + :ivar resource_association: Information about resource association. + :vartype resource_association: ~azure.mgmt.botservice.models.ResourceAssociation + :ivar profile: Information about profile. + :vartype profile: ~azure.mgmt.botservice.models.Profile + """ + + _validation = { + "network_security_perimeter": {"readonly": True}, + "resource_association": {"readonly": True}, + "profile": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_issues": {"key": "provisioningIssues", "type": "[ProvisioningIssue]"}, + "network_security_perimeter": {"key": "networkSecurityPerimeter", "type": "NetworkSecurityPerimeter"}, + "resource_association": {"key": "resourceAssociation", "type": "ResourceAssociation"}, + "profile": {"key": "profile", "type": "Profile"}, + } + + def __init__( + self, + *, + provisioning_state: Union[str, "_models.ProvisioningState"] = "Succeeded", + provisioning_issues: Optional[List["_models.ProvisioningIssue"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword provisioning_state: Known values are: "Creating", "Updating", "Accepted", "Succeeded", + "Failed", and "Deleting". + :paramtype provisioning_state: str or ~azure.mgmt.botservice.models.ProvisioningState + :keyword provisioning_issues: List of Provisioning Issues if any. + :paramtype provisioning_issues: list[~azure.mgmt.botservice.models.ProvisioningIssue] + """ + super().__init__(**kwargs) + self.provisioning_state = provisioning_state + self.provisioning_issues = provisioning_issues + self.network_security_perimeter = None + self.resource_association = None + self.profile = None + + +class NspAccessRule(_serialization.Model): + """Information of Access Rule in a profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the access rule. + :vartype name: str + :ivar properties: Properties of Access Rule. + :vartype properties: ~azure.mgmt.botservice.models.NspAccessRuleProperties + """ + + _validation = { + "properties": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "NspAccessRuleProperties"}, + } + + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the access rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + self.properties = None + + +class NspAccessRuleProperties(_serialization.Model): + """Properties of Access Rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar direction: Direction of Access Rule. Known values are: "Inbound" and "Outbound". + :vartype direction: str or ~azure.mgmt.botservice.models.NspAccessRuleDirection + :ivar address_prefixes: Address prefixes in the CIDR format for inbound rules. + :vartype address_prefixes: list[str] + :ivar subscriptions: Subscriptions for inbound rules. + :vartype subscriptions: + list[~azure.mgmt.botservice.models.NspAccessRulePropertiesSubscriptionsItem] + :ivar network_security_perimeters: NetworkSecurityPerimeters for inbound rules. + :vartype network_security_perimeters: + list[~azure.mgmt.botservice.models.NetworkSecurityPerimeter] + :ivar fully_qualified_domain_names: FQDN for outbound rules. + :vartype fully_qualified_domain_names: list[str] + :ivar email_addresses: Email addresses for outbound rules. + :vartype email_addresses: list[str] + :ivar phone_numbers: Phone numbers for outbound rules. + :vartype phone_numbers: list[str] + """ + + _validation = { + "network_security_perimeters": {"readonly": True}, + "fully_qualified_domain_names": {"readonly": True}, + "email_addresses": {"readonly": True}, + "phone_numbers": {"readonly": True}, + } + + _attribute_map = { + "direction": {"key": "direction", "type": "str"}, + "address_prefixes": {"key": "addressPrefixes", "type": "[str]"}, + "subscriptions": {"key": "subscriptions", "type": "[NspAccessRulePropertiesSubscriptionsItem]"}, + "network_security_perimeters": {"key": "networkSecurityPerimeters", "type": "[NetworkSecurityPerimeter]"}, + "fully_qualified_domain_names": {"key": "fullyQualifiedDomainNames", "type": "[str]"}, + "email_addresses": {"key": "emailAddresses", "type": "[str]"}, + "phone_numbers": {"key": "phoneNumbers", "type": "[str]"}, + } + + def __init__( + self, + *, + direction: Optional[Union[str, "_models.NspAccessRuleDirection"]] = None, + address_prefixes: Optional[List[str]] = None, + subscriptions: Optional[List["_models.NspAccessRulePropertiesSubscriptionsItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword direction: Direction of Access Rule. Known values are: "Inbound" and "Outbound". + :paramtype direction: str or ~azure.mgmt.botservice.models.NspAccessRuleDirection + :keyword address_prefixes: Address prefixes in the CIDR format for inbound rules. + :paramtype address_prefixes: list[str] + :keyword subscriptions: Subscriptions for inbound rules. + :paramtype subscriptions: + list[~azure.mgmt.botservice.models.NspAccessRulePropertiesSubscriptionsItem] + """ + super().__init__(**kwargs) + self.direction = direction + self.address_prefixes = address_prefixes + self.subscriptions = subscriptions + self.network_security_perimeters = None + self.fully_qualified_domain_names = None + self.email_addresses = None + self.phone_numbers = None + + +class NspAccessRulePropertiesSubscriptionsItem(_serialization.Model): + """Subscription for inbound rule. + + :ivar id: Fully qualified identifier of subscription. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Fully qualified identifier of subscription. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + class Omnichannel(Channel): """Omnichannel channel definition. 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -2733,7 +3041,7 @@ class Omnichannel(Channel): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs): + def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs: Any) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -2771,8 +3079,8 @@ def __init__( operation: Optional[str] = None, provider: Optional[str] = None, resource: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword description: The description of the operation. :paramtype description: str @@ -2817,8 +3125,8 @@ def __init__( display: Optional["_models.OperationDisplayInfo"] = None, origin: Optional[str] = None, properties: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -2851,8 +3159,8 @@ class OperationEntityListResult(_serialization.Model): } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.OperationEntity"]] = None, **kwargs - ): + self, *, next_link: Optional[str] = None, value: Optional[List["_models.OperationEntity"]] = None, **kwargs: Any + ) -> None: """ :keyword next_link: The link used to get the next page of operations. :paramtype next_link: str @@ -2894,7 +3202,7 @@ class OperationResultsDescription(_serialization.Model): "start_time": {"key": "startTime", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2908,7 +3216,7 @@ class OutlookChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -2932,7 +3240,7 @@ class OutlookChannel(Channel): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs): + def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs: Any) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -2960,7 +3268,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -2972,7 +3280,7 @@ class PrivateLinkResourceBase(_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 @@ -2993,7 +3301,7 @@ class PrivateLinkResourceBase(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -3007,7 +3315,7 @@ class PrivateEndpointConnection(PrivateLinkResourceBase): 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 @@ -3054,8 +3362,8 @@ def __init__( private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, group_ids: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The resource of private end point. :paramtype private_endpoint: ~azure.mgmt.botservice.models.PrivateEndpoint @@ -3084,7 +3392,7 @@ class PrivateEndpointConnectionListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private endpoint connections. :paramtype value: list[~azure.mgmt.botservice.models.PrivateEndpointConnection] @@ -3099,7 +3407,7 @@ class PrivateLinkResource(PrivateLinkResourceBase): 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 @@ -3131,7 +3439,7 @@ class PrivateLinkResource(PrivateLinkResourceBase): "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } - def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs): + def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword required_zone_names: The private link resource Private link DNS zone name. :paramtype required_zone_names: list[str] @@ -3153,7 +3461,7 @@ class PrivateLinkResourceListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private link resources. :paramtype value: list[~azure.mgmt.botservice.models.PrivateLinkResource] @@ -3163,7 +3471,8 @@ def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = Non class PrivateLinkServiceConnectionState(_serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. + """A collection of information about the state of the connection between service consumer and + provider. :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Known values are: "Pending", "Approved", and "Rejected". @@ -3187,8 +3496,8 @@ def __init__( status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Known values are: "Pending", "Approved", and "Rejected". @@ -3205,6 +3514,153 @@ def __init__( self.actions_required = actions_required +class Profile(_serialization.Model): + """Information about profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the profile. + :vartype name: str + :ivar access_rules_version: Current access rules version. + :vartype access_rules_version: int + :ivar access_rules: List of Access Rules. + :vartype access_rules: list[~azure.mgmt.botservice.models.NspAccessRule] + :ivar diagnostic_settings_version: Current diagnostic settings version. + :vartype diagnostic_settings_version: int + :ivar enabled_log_categories: List of log categories. + :vartype enabled_log_categories: list[str] + """ + + _validation = { + "enabled_log_categories": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "access_rules_version": {"key": "accessRulesVersion", "type": "int"}, + "access_rules": {"key": "accessRules", "type": "[NspAccessRule]"}, + "diagnostic_settings_version": {"key": "diagnosticSettingsVersion", "type": "int"}, + "enabled_log_categories": {"key": "enabledLogCategories", "type": "[str]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + access_rules_version: Optional[int] = None, + access_rules: Optional[List["_models.NspAccessRule"]] = None, + diagnostic_settings_version: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the profile. + :paramtype name: str + :keyword access_rules_version: Current access rules version. + :paramtype access_rules_version: int + :keyword access_rules: List of Access Rules. + :paramtype access_rules: list[~azure.mgmt.botservice.models.NspAccessRule] + :keyword diagnostic_settings_version: Current diagnostic settings version. + :paramtype diagnostic_settings_version: int + """ + super().__init__(**kwargs) + self.name = name + self.access_rules_version = access_rules_version + self.access_rules = access_rules + self.diagnostic_settings_version = diagnostic_settings_version + self.enabled_log_categories = None + + +class ProvisioningIssue(_serialization.Model): + """Describes Provisioning issue for given Network Security Perimeter configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the issue. + :vartype name: str + :ivar properties: Properties of Provisioning Issue. + :vartype properties: ~azure.mgmt.botservice.models.ProvisioningIssueProperties + """ + + _validation = { + "properties": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "ProvisioningIssueProperties"}, + } + + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the issue. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + self.properties = None + + +class ProvisioningIssueProperties(_serialization.Model): + """Properties of Provisioning Issue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar issue_type: Type of Issue. + :vartype issue_type: str + :ivar severity: Provisioning state of Network Security Perimeter configuration propagation. + Known values are: "Warning" and "Error". + :vartype severity: str or ~azure.mgmt.botservice.models.Severity + :ivar description: Description of the issue. + :vartype description: str + :ivar suggested_resource_ids: ARM IDs of resources that can be associated to the same perimeter + to remediate the issue. + :vartype suggested_resource_ids: list[str] + :ivar suggested_access_rules: Access rules that can be added to the same profile to remediate + the issue. + :vartype suggested_access_rules: list[~azure.mgmt.botservice.models.NspAccessRule] + """ + + _validation = { + "suggested_resource_ids": {"readonly": True}, + } + + _attribute_map = { + "issue_type": {"key": "issueType", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "suggested_resource_ids": {"key": "suggestedResourceIds", "type": "[str]"}, + "suggested_access_rules": {"key": "suggestedAccessRules", "type": "[NspAccessRule]"}, + } + + def __init__( + self, + *, + issue_type: Optional[str] = None, + severity: Optional[Union[str, "_models.Severity"]] = None, + description: Optional[str] = None, + suggested_access_rules: Optional[List["_models.NspAccessRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword issue_type: Type of Issue. + :paramtype issue_type: str + :keyword severity: Provisioning state of Network Security Perimeter configuration propagation. + Known values are: "Warning" and "Error". + :paramtype severity: str or ~azure.mgmt.botservice.models.Severity + :keyword description: Description of the issue. + :paramtype description: str + :keyword suggested_access_rules: Access rules that can be added to the same profile to + remediate the issue. + :paramtype suggested_access_rules: list[~azure.mgmt.botservice.models.NspAccessRule] + """ + super().__init__(**kwargs) + self.issue_type = issue_type + self.severity = severity + self.description = description + self.suggested_resource_ids = None + self.suggested_access_rules = suggested_access_rules + + class QnAMakerEndpointKeysRequestBody(_serialization.Model): """The request body for a request to Bot Service Management to list QnA Maker endpoint keys. @@ -3219,7 +3675,7 @@ class QnAMakerEndpointKeysRequestBody(_serialization.Model): "authkey": {"key": "authkey", "type": "str"}, } - def __init__(self, *, hostname: Optional[str] = None, authkey: Optional[str] = None, **kwargs): + def __init__(self, *, hostname: Optional[str] = None, authkey: Optional[str] = None, **kwargs: Any) -> None: """ :keyword hostname: the host name of the QnA Maker endpoint. :paramtype hostname: str @@ -3258,8 +3714,8 @@ def __init__( secondary_endpoint_key: Optional[str] = None, installed_version: Optional[str] = None, last_stable_version: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword primary_endpoint_key: Primary Access Key. :paramtype primary_endpoint_key: str @@ -3277,12 +3733,46 @@ def __init__( self.last_stable_version = last_stable_version +class ResourceAssociation(_serialization.Model): + """Information about resource association. + + :ivar name: Name of the resource association. + :vartype name: str + :ivar access_mode: Access Mode of the resource association. Known values are: "Enforced", + "Learning", and "Audit". + :vartype access_mode: str or ~azure.mgmt.botservice.models.AccessMode + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "access_mode": {"key": "accessMode", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + access_mode: Optional[Union[str, "_models.AccessMode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the resource association. + :paramtype name: str + :keyword access_mode: Access Mode of the resource association. Known values are: "Enforced", + "Learning", and "Audit". + :paramtype access_mode: str or ~azure.mgmt.botservice.models.AccessMode + """ + super().__init__(**kwargs) + self.name = name + self.access_mode = access_mode + + class SearchAssistant(Channel): """SearchAssistant definition. 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -3306,7 +3796,7 @@ class SearchAssistant(Channel): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs): + def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs: Any) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -3328,7 +3818,7 @@ class ServiceProvider(_serialization.Model): "properties": {"key": "properties", "type": "ServiceProviderProperties"}, } - def __init__(self, *, properties: Optional["_models.ServiceProviderProperties"] = None, **kwargs): + def __init__(self, *, properties: Optional["_models.ServiceProviderProperties"] = None, **kwargs: Any) -> None: """ :keyword properties: The Properties of a Service Provider Object. :paramtype properties: ~azure.mgmt.botservice.models.ServiceProviderProperties @@ -3378,7 +3868,7 @@ class ServiceProviderParameter(_serialization.Model): "metadata": {"key": "metadata", "type": "ServiceProviderParameterMetadata"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -3402,8 +3892,8 @@ class ServiceProviderParameterMetadata(_serialization.Model): } def __init__( - self, *, constraints: Optional["_models.ServiceProviderParameterMetadataConstraints"] = None, **kwargs - ): + self, *, constraints: Optional["_models.ServiceProviderParameterMetadataConstraints"] = None, **kwargs: Any + ) -> None: """ :keyword constraints: the constraints of the bot meta data. :paramtype constraints: @@ -3413,7 +3903,7 @@ def __init__( self.constraints = constraints -class ServiceProviderParameterMetadataConstraints(_serialization.Model): +class ServiceProviderParameterMetadataConstraints(_serialization.Model): # pylint: disable=name-too-long """the constraints of the bot meta data. :ivar required: Whether required the constraints of the bot meta data. @@ -3424,7 +3914,7 @@ class ServiceProviderParameterMetadataConstraints(_serialization.Model): "required": {"key": "required", "type": "bool"}, } - def __init__(self, *, required: Optional[bool] = None, **kwargs): + def __init__(self, *, required: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword required: Whether required the constraints of the bot meta data. :paramtype required: bool @@ -3469,8 +3959,12 @@ class ServiceProviderProperties(_serialization.Model): } def __init__( - self, *, icon_url: str = "", parameters: Optional[List["_models.ServiceProviderParameter"]] = None, **kwargs - ): + self, + *, + icon_url: str = "", + parameters: Optional[List["_models.ServiceProviderParameter"]] = None, + **kwargs: Any + ) -> None: """ :keyword icon_url: The URL of icon. :paramtype icon_url: str @@ -3506,7 +4000,7 @@ class ServiceProviderResponseList(_serialization.Model): "value": {"key": "value", "type": "[ServiceProvider]"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs): + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: The link used to get the next page of bot service providers. :paramtype next_link: str @@ -3517,9 +4011,10 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs): class SiteInfo(_serialization.Model): - """Site information for WebChat or DirectLine Channels to identify which site to regenerate keys for. + """Site information for WebChat or DirectLine Channels to identify which site to regenerate keys + for. - 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 site_name: The site name. Required. :vartype site_name: str @@ -3538,7 +4033,7 @@ class SiteInfo(_serialization.Model): "key": {"key": "key", "type": "str"}, } - def __init__(self, *, site_name: str, key: Union[str, "_models.Key"], **kwargs): + def __init__(self, *, site_name: str, key: Union[str, "_models.Key"], **kwargs: Any) -> None: """ :keyword site_name: The site name. Required. :paramtype site_name: str @@ -3556,7 +4051,7 @@ class Sku(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The sku name. Required. Known values are: "F0" and "S1". :vartype name: str or ~azure.mgmt.botservice.models.SkuName @@ -3575,7 +4070,7 @@ class Sku(_serialization.Model): "tier": {"key": "tier", "type": "str"}, } - def __init__(self, *, name: Union[str, "_models.SkuName"], **kwargs): + def __init__(self, *, name: Union[str, "_models.SkuName"], **kwargs: Any) -> None: """ :keyword name: The sku name. Required. Known values are: "F0" and "S1". :paramtype name: str or ~azure.mgmt.botservice.models.SkuName @@ -3590,7 +4085,7 @@ class SkypeChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -3623,8 +4118,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.SkypeChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -3641,7 +4136,7 @@ def __init__( class SkypeChannelProperties(_serialization.Model): """The parameters to provide for the Microsoft Teams channel. - 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 enable_messaging: Enable messaging for Skype channel. :vartype enable_messaging: bool @@ -3695,8 +4190,8 @@ def __init__( groups_mode: Optional[str] = None, calling_web_hook: Optional[str] = None, incoming_call_route: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enable_messaging: Enable messaging for Skype channel. :paramtype enable_messaging: bool @@ -3737,7 +4232,7 @@ class SlackChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -3770,8 +4265,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.SlackChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -3790,7 +4285,7 @@ class SlackChannelProperties(_serialization.Model): # pylint: disable=too-many- 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 client_id: The Slack client id. :vartype client_id: str @@ -3851,8 +4346,8 @@ def __init__( landing_page_url: Optional[str] = None, register_before_o_auth_flow: Optional[bool] = None, signing_secret: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword client_id: The Slack client id. :paramtype client_id: str @@ -3893,7 +4388,7 @@ class SmsChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -3926,8 +4421,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.SmsChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -3944,7 +4439,7 @@ def __init__( class SmsChannelProperties(_serialization.Model): """The parameters to provide for the Sms channel. - 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 phone: The Sms phone. Required. :vartype phone: str @@ -3982,8 +4477,8 @@ def __init__( is_enabled: bool, auth_token: Optional[str] = None, is_validated: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword phone: The Sms phone. Required. :paramtype phone: str @@ -4011,7 +4506,7 @@ class TelegramChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -4044,8 +4539,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.TelegramChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -4062,7 +4557,7 @@ def __init__( class TelegramChannelProperties(_serialization.Model): """The parameters to provide for the Telegram channel. - 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 access_token: The Telegram access token. Value only returned through POST to the action Channel List API, otherwise empty. @@ -4084,8 +4579,13 @@ class TelegramChannelProperties(_serialization.Model): } def __init__( - self, *, is_enabled: bool, access_token: Optional[str] = None, is_validated: Optional[bool] = None, **kwargs - ): + self, + *, + is_enabled: bool, + access_token: Optional[str] = None, + is_validated: Optional[bool] = None, + **kwargs: Any + ) -> None: """ :keyword access_token: The Telegram access token. Value only returned through POST to the action Channel List API, otherwise empty. @@ -4106,7 +4606,7 @@ class TelephonyChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -4139,8 +4639,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.TelephonyChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -4194,8 +4694,8 @@ def __init__( default_locale: Optional[str] = None, premium_sku: Optional[str] = None, is_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword phone_numbers: The list of Telephony phone numbers. :paramtype phone_numbers: list[~azure.mgmt.botservice.models.TelephonyPhoneNumbers] @@ -4258,8 +4758,8 @@ def __init__( cognitive_service_region: Optional[str] = None, cognitive_service_resource_id: Optional[str] = None, default_locale: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of config. :paramtype id: str @@ -4334,8 +4834,8 @@ def __init__( cognitive_service_resource_id: Optional[str] = None, default_locale: Optional[str] = None, offer_type: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The element id. :paramtype id: str @@ -4376,7 +4876,7 @@ class WebChatChannel(Channel): 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 channel_name: The channel name. Required. :vartype channel_name: str @@ -4409,8 +4909,8 @@ def __init__( etag: Optional[str] = None, location: str = "global", properties: Optional["_models.WebChatChannelProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword etag: Entity Tag of the resource. :paramtype etag: str @@ -4444,7 +4944,7 @@ class WebChatChannelProperties(_serialization.Model): "sites": {"key": "sites", "type": "[WebChatSite]"}, } - def __init__(self, *, sites: Optional[List["_models.WebChatSite"]] = None, **kwargs): + def __init__(self, *, sites: Optional[List["_models.WebChatSite"]] = None, **kwargs: Any) -> None: """ :keyword sites: The list of Web Chat sites. :paramtype sites: list[~azure.mgmt.botservice.models.WebChatSite] @@ -4459,7 +4959,7 @@ class WebChatSite(Site): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar tenant_id: Tenant Id. :vartype tenant_id: str @@ -4505,109 +5005,3 @@ class WebChatSite(Site): # pylint: disable=too-many-instance-attributes :ivar is_webchat_preview_enabled: Whether this site is enabled for preview versions of Webchat. :vartype is_webchat_preview_enabled: bool """ - - _validation = { - "site_id": {"readonly": True}, - "site_name": {"required": True}, - "key": {"readonly": True}, - "key2": {"readonly": True}, - "is_enabled": {"required": True}, - "is_token_enabled": {"readonly": True}, - } - - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "site_id": {"key": "siteId", "type": "str"}, - "site_name": {"key": "siteName", "type": "str"}, - "key": {"key": "key", "type": "str"}, - "key2": {"key": "key2", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "is_token_enabled": {"key": "isTokenEnabled", "type": "bool"}, - "is_endpoint_parameters_enabled": {"key": "isEndpointParametersEnabled", "type": "bool"}, - "is_detailed_logging_enabled": {"key": "isDetailedLoggingEnabled", "type": "bool"}, - "is_block_user_upload_enabled": {"key": "isBlockUserUploadEnabled", "type": "bool"}, - "is_no_storage_enabled": {"key": "isNoStorageEnabled", "type": "bool"}, - "e_tag": {"key": "eTag", "type": "str"}, - "app_id": {"key": "appId", "type": "str"}, - "is_v1_enabled": {"key": "isV1Enabled", "type": "bool"}, - "is_v3_enabled": {"key": "isV3Enabled", "type": "bool"}, - "is_secure_site_enabled": {"key": "isSecureSiteEnabled", "type": "bool"}, - "trusted_origins": {"key": "trustedOrigins", "type": "[str]"}, - "is_web_chat_speech_enabled": {"key": "isWebChatSpeechEnabled", "type": "bool"}, - "is_webchat_preview_enabled": {"key": "isWebchatPreviewEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - site_name: str, - is_enabled: bool, - tenant_id: Optional[str] = None, - is_endpoint_parameters_enabled: Optional[bool] = None, - is_detailed_logging_enabled: Optional[bool] = None, - is_block_user_upload_enabled: Optional[bool] = None, - is_no_storage_enabled: Optional[bool] = None, - e_tag: Optional[str] = None, - app_id: Optional[str] = None, - is_v1_enabled: Optional[bool] = None, - is_v3_enabled: Optional[bool] = None, - is_secure_site_enabled: Optional[bool] = None, - trusted_origins: Optional[List[str]] = None, - is_web_chat_speech_enabled: bool = False, - is_webchat_preview_enabled: bool = False, - **kwargs - ): - """ - :keyword tenant_id: Tenant Id. - :paramtype tenant_id: str - :keyword site_name: Site name. Required. - :paramtype site_name: str - :keyword is_enabled: Whether this site is enabled for DirectLine channel. Required. - :paramtype is_enabled: bool - :keyword is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for - channel. - :paramtype is_endpoint_parameters_enabled: bool - :keyword is_detailed_logging_enabled: Whether this site is disabled detailed logging for. - :paramtype is_detailed_logging_enabled: bool - :keyword is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :paramtype is_block_user_upload_enabled: bool - :keyword is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. - :paramtype is_no_storage_enabled: bool - :keyword e_tag: Entity Tag. - :paramtype e_tag: str - :keyword app_id: DirectLine application id. - :paramtype app_id: str - :keyword is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. - :paramtype is_v1_enabled: bool - :keyword is_v3_enabled: Whether this site is enabled for Bot Framework V3 protocol. - :paramtype is_v3_enabled: bool - :keyword is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :paramtype is_secure_site_enabled: bool - :keyword trusted_origins: List of Trusted Origin URLs for this site. This field is applicable - only if isSecureSiteEnabled is True. - :paramtype trusted_origins: list[str] - :keyword is_web_chat_speech_enabled: Whether this site is enabled for Webchat Speech. - :paramtype is_web_chat_speech_enabled: bool - :keyword is_webchat_preview_enabled: Whether this site is enabled for preview versions of - Webchat. - :paramtype is_webchat_preview_enabled: bool - """ - super().__init__( - tenant_id=tenant_id, - site_name=site_name, - is_enabled=is_enabled, - is_endpoint_parameters_enabled=is_endpoint_parameters_enabled, - is_detailed_logging_enabled=is_detailed_logging_enabled, - is_block_user_upload_enabled=is_block_user_upload_enabled, - is_no_storage_enabled=is_no_storage_enabled, - e_tag=e_tag, - app_id=app_id, - is_v1_enabled=is_v1_enabled, - is_v3_enabled=is_v3_enabled, - is_secure_site_enabled=is_secure_site_enabled, - trusted_origins=trusted_origins, - is_web_chat_speech_enabled=is_web_chat_speech_enabled, - is_webchat_preview_enabled=is_webchat_preview_enabled, - **kwargs - ) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/__init__.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/__init__.py index 67f6c5b0276c..712f818ea3ec 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/__init__.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/__init__.py @@ -17,6 +17,7 @@ from ._operation_results_operations import OperationResultsOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -34,6 +35,7 @@ "OperationResultsOperations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", + "NetworkSecurityPerimeterConfigurationsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bot_connection_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bot_connection_operations.py index 520490b68b06..7a3a8b152c2a 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bot_connection_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bot_connection_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 ( @@ -28,12 +29,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +46,7 @@ def build_list_service_providers_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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +57,7 @@ def build_list_service_providers_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") @@ -73,7 +74,7 @@ def build_list_with_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +105,7 @@ def build_list_with_secrets_request( "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") @@ -121,7 +122,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -153,7 +154,7 @@ def build_create_request( "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") @@ -172,7 +173,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -204,7 +205,7 @@ def build_update_request( "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") @@ -223,7 +224,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -254,7 +255,7 @@ def build_get_request( "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") @@ -271,7 +272,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,7 +303,7 @@ def build_delete_request( "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") @@ -319,7 +320,7 @@ def build_list_by_bot_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -342,7 +343,7 @@ def build_list_by_bot_service_request( "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") @@ -376,12 +377,11 @@ def __init__(self, *args, **kwargs): def list_service_providers(self, **kwargs: Any) -> _models.ServiceProviderResponseList: """Lists the available Service Providers for creating Connection Settings. - :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceProviderResponseList or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ServiceProviderResponseList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -392,23 +392,21 @@ def list_service_providers(self, **kwargs: Any) -> _models.ServiceProviderRespon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServiceProviderResponseList] = kwargs.pop("cls", None) - request = build_list_service_providers_request( + _request = build_list_service_providers_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_service_providers.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -421,13 +419,9 @@ def list_service_providers(self, **kwargs: Any) -> _models.ServiceProviderRespon deserialized = self._deserialize("ServiceProviderResponseList", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_service_providers.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders" - } + return deserialized # type: ignore @distributed_trace def list_with_secrets( @@ -442,12 +436,11 @@ def list_with_secrets( :type resource_name: str :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -458,26 +451,24 @@ def list_with_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) - request = build_list_with_secrets_request( + _request = build_list_with_secrets_request( resource_group_name=resource_group_name, resource_name=resource_name, connection_name=connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_with_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -490,13 +481,9 @@ def list_with_secrets( deserialized = self._deserialize("ConnectionSetting", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_with_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets" - } + return deserialized # type: ignore @overload def create( @@ -523,7 +510,6 @@ def 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 :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: @@ -535,7 +521,7 @@ def create( resource_group_name: str, resource_name: str, connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -550,11 +536,10 @@ def create( :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str :param parameters: The parameters to provide for creating the Connection Setting. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: @@ -566,7 +551,7 @@ def create( resource_group_name: str, resource_name: str, connection_name: str, - parameters: Union[_models.ConnectionSetting, IO], + parameters: Union[_models.ConnectionSetting, IO[bytes]], **kwargs: Any ) -> _models.ConnectionSetting: """Register a new Auth Connection for a Bot Service. @@ -579,17 +564,13 @@ def create( :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str :param parameters: The parameters to provide for creating the Connection Setting. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting 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 + ConnectionSetting type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting or IO[bytes] :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -600,21 +581,19 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionSetting") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, resource_name=resource_name, connection_name=connection_name, @@ -623,15 +602,15 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -652,10 +631,6 @@ def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } - @overload def update( self, @@ -681,7 +656,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: @@ -693,7 +667,7 @@ def update( resource_group_name: str, resource_name: str, connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -708,11 +682,10 @@ def update( :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str :param parameters: The parameters to provide for updating the Connection Setting. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: @@ -724,7 +697,7 @@ def update( resource_group_name: str, resource_name: str, connection_name: str, - parameters: Union[_models.ConnectionSetting, IO], + parameters: Union[_models.ConnectionSetting, IO[bytes]], **kwargs: Any ) -> _models.ConnectionSetting: """Updates a Connection Setting registration for a Bot Service. @@ -737,17 +710,13 @@ def update( :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str :param parameters: The parameters to provide for updating the Connection Setting. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting 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 + ConnectionSetting type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting or IO[bytes] :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -758,21 +727,19 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ConnectionSetting") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, resource_name=resource_name, connection_name=connection_name, @@ -781,15 +748,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -810,10 +777,6 @@ def update( return deserialized # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } - @distributed_trace def get( self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any @@ -827,12 +790,11 @@ def get( :type resource_name: str :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectionSetting or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -843,26 +805,24 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_name, connection_name=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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -875,13 +835,9 @@ def get( deserialized = self._deserialize("ConnectionSetting", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -896,12 +852,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type resource_name: str :param connection_name: The name of the Bot Service Connection Setting resource. Required. :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -912,26 +867,24 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, connection_name=connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -942,11 +895,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_by_bot_service( @@ -959,7 +908,6 @@ def list_by_bot_service( :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ConnectionSetting or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.ConnectionSetting] :raises ~azure.core.exceptions.HttpResponseError: @@ -967,12 +915,10 @@ def list_by_bot_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectionSettingResponseList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -983,17 +929,16 @@ def list_by_bot_service( def prepare_request(next_link=None): if not next_link: - request = build_list_by_bot_service_request( + _request = build_list_by_bot_service_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_bot_service.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1005,13 +950,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ConnectionSettingResponseList", pipeline_response) @@ -1021,10 +966,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=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1036,7 +982,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_bot_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bots_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bots_operations.py index 25d641921886..e492cd766723 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bots_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bots_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 ( @@ -28,12 +29,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +48,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -71,7 +72,7 @@ def build_create_request( "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") @@ -90,7 +91,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -114,7 +115,7 @@ def build_update_request( "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") @@ -133,7 +134,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +157,7 @@ def build_delete_request( "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") @@ -171,7 +172,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +195,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription "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") @@ -209,7 +210,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,7 +230,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "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") @@ -244,7 +245,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -253,7 +254,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "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") @@ -264,11 +265,11 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_check_name_availability_request(**kwargs: Any) -> HttpRequest: +def build_get_check_name_availability_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -327,7 +328,6 @@ def 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 :return: Bot or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.Bot :raises ~azure.core.exceptions.HttpResponseError: @@ -338,7 +338,7 @@ def create( self, resource_group_name: str, resource_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -351,11 +351,10 @@ def create( :param resource_name: The name of the Bot resource. Required. :type resource_name: str :param parameters: The parameters to provide for the created bot. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Bot or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.Bot :raises ~azure.core.exceptions.HttpResponseError: @@ -363,7 +362,7 @@ def create( @distributed_trace def create( - self, resource_group_name: str, resource_name: str, parameters: Union[_models.Bot, IO], **kwargs: Any + self, resource_group_name: str, resource_name: str, parameters: Union[_models.Bot, IO[bytes]], **kwargs: Any ) -> _models.Bot: """Creates a Bot Service. Bot Service is a resource group wide resource type. @@ -372,18 +371,14 @@ def create( :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :param parameters: The parameters to provide for the created bot. Is either a model type or a - IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.Bot or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: The parameters to provide for the created bot. Is either a Bot type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.Bot or IO[bytes] :return: Bot or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.Bot :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -394,21 +389,19 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Bot] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Bot") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, @@ -416,15 +409,15 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -445,10 +438,6 @@ def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } - @distributed_trace def update( self, @@ -482,12 +471,11 @@ def update( :type etag: str :param properties: The set of properties specific to bot resource. Default value is None. :type properties: ~azure.mgmt.botservice.models.BotProperties - :keyword callable cls: A custom type or function that will be passed the direct response :return: Bot or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.Bot :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -498,31 +486,29 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) cls: ClsType[_models.Bot] = kwargs.pop("cls", None) _parameters = _models.Bot(etag=etag, kind=kind, location=location, properties=properties, sku=sku, tags=tags) _json = self._serialize.body(_parameters, "Bot") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -543,10 +529,6 @@ def update( return deserialized # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, **kwargs: Any @@ -558,12 +540,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -574,25 +555,23 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -603,11 +582,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Bot: @@ -618,12 +593,11 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Bot or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.Bot :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -634,25 +608,23 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Bot] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -665,13 +637,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m deserialized = self._deserialize("Bot", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Bot"]: @@ -680,7 +648,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :param resource_group_name: The name of the Bot resource group in the user subscription. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Bot or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.Bot] :raises ~azure.core.exceptions.HttpResponseError: @@ -688,12 +655,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BotResponseList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -704,16 +669,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -725,13 +689,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("BotResponseList", pipeline_response) @@ -741,10 +705,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=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -757,15 +722,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices" - } - @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Bot"]: """Returns all the resources of a particular type belonging to a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Bot or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.Bot] :raises ~azure.core.exceptions.HttpResponseError: @@ -773,12 +733,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Bot"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BotResponseList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -789,15 +747,14 @@ def list(self, **kwargs: Any) -> Iterable["_models.Bot"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -809,13 +766,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("BotResponseList", pipeline_response) @@ -825,10 +782,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=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -841,8 +799,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices"} - @overload def get_check_name_availability( self, @@ -859,7 +815,6 @@ def get_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: CheckNameAvailabilityResponseBody or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody :raises ~azure.core.exceptions.HttpResponseError: @@ -867,17 +822,16 @@ def get_check_name_availability( @overload def get_check_name_availability( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityResponseBody: """Check whether a bot name is available. :param parameters: The request body parameters to provide for the check name availability request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResponseBody or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody :raises ~azure.core.exceptions.HttpResponseError: @@ -885,22 +839,18 @@ def get_check_name_availability( @distributed_trace def get_check_name_availability( - self, parameters: Union[_models.CheckNameAvailabilityRequestBody, IO], **kwargs: Any + self, parameters: Union[_models.CheckNameAvailabilityRequestBody, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityResponseBody: """Check whether a bot name is available. :param parameters: The request body parameters to provide for the check name availability - request. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.CheckNameAvailabilityRequestBody 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 + request. Is either a CheckNameAvailabilityRequestBody type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.CheckNameAvailabilityRequestBody or IO[bytes] :return: CheckNameAvailabilityResponseBody or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -911,34 +861,32 @@ def get_check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CheckNameAvailabilityResponseBody] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "CheckNameAvailabilityRequestBody") - request = build_get_check_name_availability_request( + _request = build_get_check_name_availability_request( api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.get_check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -951,8 +899,6 @@ def get_check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityResponseBody", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_check_name_availability.metadata = {"url": "/providers/Microsoft.BotService/checkNameAvailability"} + return deserialized # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_channels_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_channels_operations.py index f5d99740aeb9..eaf205eb45e5 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_channels_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_channels_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 ( @@ -28,12 +29,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -76,7 +77,7 @@ def build_create_request( "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") @@ -99,7 +100,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +125,7 @@ def build_update_request( "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") @@ -143,7 +144,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,7 +170,7 @@ def build_delete_request( "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") @@ -186,7 +187,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -212,7 +213,7 @@ def build_get_request( "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") @@ -233,7 +234,7 @@ def build_list_with_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -257,7 +258,7 @@ def build_list_with_keys_request( "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") @@ -274,7 +275,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -297,7 +298,7 @@ def build_list_by_resource_group_request( "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") @@ -356,7 +357,6 @@ def 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 :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: @@ -368,7 +368,7 @@ def create( resource_group_name: str, resource_name: str, channel_name: Union[str, _models.ChannelName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -387,11 +387,10 @@ def create( "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName :param parameters: The parameters to provide for the created bot. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: @@ -403,7 +402,7 @@ def create( resource_group_name: str, resource_name: str, channel_name: Union[str, _models.ChannelName], - parameters: Union[_models.BotChannel, IO], + parameters: Union[_models.BotChannel, IO[bytes]], **kwargs: Any ) -> _models.BotChannel: """Creates a Channel registration for a Bot Service. @@ -419,18 +418,14 @@ def create( "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :param parameters: The parameters to provide for the created bot. Is either a model type or a - IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.BotChannel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: The parameters to provide for the created bot. Is either a BotChannel type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.BotChannel or IO[bytes] :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,21 +436,19 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "BotChannel") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, resource_name=resource_name, channel_name=channel_name, @@ -464,15 +457,15 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -493,10 +486,6 @@ def create( return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } - @distributed_trace def update( self, @@ -538,12 +527,11 @@ def update( :param properties: The set of properties specific to bot channel resource. Default value is None. :type properties: ~azure.mgmt.botservice.models.Channel - :keyword callable cls: A custom type or function that will be passed the direct response :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -554,9 +542,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) @@ -565,7 +551,7 @@ def update( ) _json = self._serialize.body(_parameters, "BotChannel") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, resource_name=resource_name, channel_name=channel_name, @@ -573,15 +559,15 @@ def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -602,10 +588,6 @@ def update( return deserialized # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, channel_name: str, **kwargs: Any @@ -619,12 +601,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type resource_name: str :param channel_name: The name of the Bot resource. Required. :type channel_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -635,26 +616,24 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, channel_name=channel_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -665,11 +644,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get(self, resource_group_name: str, resource_name: str, channel_name: str, **kwargs: Any) -> _models.BotChannel: @@ -682,12 +657,11 @@ def get(self, resource_group_name: str, resource_name: str, channel_name: str, * :type resource_name: str :param channel_name: The name of the Bot resource. Required. :type channel_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -698,26 +672,24 @@ def get(self, resource_group_name: str, resource_name: str, channel_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_name, channel_name=channel_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -730,13 +702,9 @@ def get(self, resource_group_name: str, resource_name: str, channel_name: str, * deserialized = self._deserialize("BotChannel", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } + return deserialized # type: ignore @distributed_trace def list_with_keys( @@ -755,12 +723,11 @@ def list_with_keys( "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListChannelWithKeysResponse or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.ListChannelWithKeysResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -771,26 +738,24 @@ def list_with_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListChannelWithKeysResponse] = kwargs.pop("cls", None) - request = build_list_with_keys_request( + _request = build_list_with_keys_request( resource_group_name=resource_group_name, resource_name=resource_name, channel_name=channel_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_with_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -803,13 +768,9 @@ def list_with_keys( deserialized = self._deserialize("ListChannelWithKeysResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_with_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group( @@ -822,7 +783,6 @@ def list_by_resource_group( :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BotChannel or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.BotChannel] :raises ~azure.core.exceptions.HttpResponseError: @@ -830,12 +790,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ChannelResponseList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -846,17 +804,16 @@ 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, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -868,13 +825,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ChannelResponseList", pipeline_response) @@ -884,10 +841,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=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -899,7 +857,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_direct_line_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_direct_line_operations.py index 6a66d455759f..4e4f7306d332 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_direct_line_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_direct_line_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, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +27,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_regenerate_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -74,7 +75,7 @@ def build_regenerate_keys_request( "channelName": _SERIALIZER.url("channel_name", channel_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") @@ -133,7 +134,6 @@ def regenerate_keys( :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: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: @@ -145,7 +145,7 @@ def regenerate_keys( resource_group_name: str, resource_name: str, channel_name: Union[str, _models.RegenerateKeysChannelName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -162,11 +162,10 @@ def regenerate_keys( Known values are: "WebChatChannel" and "DirectLineChannel". Required. :type channel_name: str or ~azure.mgmt.botservice.models.RegenerateKeysChannelName :param parameters: The parameters to provide for the created bot. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: @@ -178,7 +177,7 @@ def regenerate_keys( resource_group_name: str, resource_name: str, channel_name: Union[str, _models.RegenerateKeysChannelName], - parameters: Union[_models.SiteInfo, IO], + parameters: Union[_models.SiteInfo, IO[bytes]], **kwargs: Any ) -> _models.BotChannel: """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService @@ -192,18 +191,14 @@ def regenerate_keys( :param channel_name: The name of the Channel resource for which keys are to be regenerated. Known values are: "WebChatChannel" and "DirectLineChannel". Required. :type channel_name: str or ~azure.mgmt.botservice.models.RegenerateKeysChannelName - :param parameters: The parameters to provide for the created bot. Is either a model type or a - IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.SiteInfo or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param parameters: The parameters to provide for the created bot. Is either a SiteInfo type or + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.SiteInfo or IO[bytes] :return: BotChannel or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.BotChannel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,21 +209,19 @@ def regenerate_keys( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SiteInfo") - request = build_regenerate_keys_request( + _request = build_regenerate_keys_request( resource_group_name=resource_group_name, resource_name=resource_name, channel_name=channel_name, @@ -237,15 +230,15 @@ def regenerate_keys( content_type=content_type, json=_json, content=_content, - template_url=self.regenerate_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -258,10 +251,6 @@ def regenerate_keys( deserialized = self._deserialize("BotChannel", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - regenerate_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys" - } + return deserialized # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_email_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_email_operations.py index 21f0d359b9bf..81d557795c4b 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_email_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_email_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, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +45,7 @@ def build_create_sign_in_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +68,7 @@ def build_create_sign_in_url_request( "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") @@ -109,12 +109,11 @@ def create_sign_in_url( :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CreateEmailSignInUrlResponse or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.CreateEmailSignInUrlResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -125,25 +124,23 @@ def create_sign_in_url( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CreateEmailSignInUrlResponse] = kwargs.pop("cls", None) - request = build_create_sign_in_url_request( + _request = build_create_sign_in_url_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create_sign_in_url.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -156,10 +153,6 @@ def create_sign_in_url( deserialized = self._deserialize("CreateEmailSignInUrlResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_sign_in_url.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/createEmailSignInUrl" - } + return deserialized # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_host_settings_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_host_settings_operations.py index 8f78f0a89b1b..58994234e665 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_host_settings_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_host_settings_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, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +43,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "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") @@ -86,12 +86,11 @@ def __init__(self, *args, **kwargs): def get(self, **kwargs: Any) -> _models.HostSettingsResponse: """Get per subscription settings needed to host bot in compute resource such as Azure App Service. - :keyword callable cls: A custom type or function that will be passed the direct response :return: HostSettingsResponse or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.HostSettingsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -102,23 +101,21 @@ def get(self, **kwargs: Any) -> _models.HostSettingsResponse: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostSettingsResponse] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,8 +128,6 @@ def get(self, **kwargs: Any) -> _models.HostSettingsResponse: deserialized = self._deserialize("HostSettingsResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings"} + return deserialized # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_network_security_perimeter_configurations_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_network_security_perimeter_configurations_operations.py new file mode 100644 index 000000000000..725e8c1b9f16 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_network_security_perimeter_configurations_operations.py @@ -0,0 +1,484 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union, cast +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", + resource_group_name, + "str", + max_length=64, + min_length=2, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", + ), + "resourceName": _SERIALIZER.url( + "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "networkSecurityPerimeterConfigurationName": _SERIALIZER.url( + "network_security_perimeter_configuration_name", + network_security_perimeter_configuration_name, + "str", + pattern=r".*", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/networkSecurityPerimeterConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", + resource_group_name, + "str", + max_length=64, + min_length=2, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", + ), + "resourceName": _SERIALIZER.url( + "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_reconcile_request( + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}/reconcile", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", + resource_group_name, + "str", + max_length=64, + min_length=2, + pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", + ), + "resourceName": _SERIALIZER.url( + "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "networkSecurityPerimeterConfigurationName": _SERIALIZER.url( + "network_security_perimeter_configuration_name", + network_security_perimeter_configuration_name, + "str", + pattern=r".*", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.AzureBotService`'s + :attr:`network_security_perimeter_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> _models.NetworkSecurityPerimeterConfiguration: + """Gets the specified Network Security Perimeter configuration associated with the Bot. + + :param resource_group_name: The name of the Bot resource group in the user subscription. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param network_security_perimeter_configuration_name: The resource association Name. Composed + of parameter guid and association name. Required. + :type network_security_perimeter_configuration_name: str + :return: NetworkSecurityPerimeterConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkSecurityPerimeterConfiguration"]: + """List Network Security Perimeter configurations associated with the Bot. + + :param resource_group_name: The name of the Bot resource group in the user subscription. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkSecurityPerimeterConfigurationList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkSecurityPerimeterConfigurationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _reconcile_initial( + self, + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> Optional[_models.NetworkSecurityPerimeterConfiguration]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.NetworkSecurityPerimeterConfiguration]] = kwargs.pop("cls", None) + + _request = build_reconcile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_reconcile( + self, + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> LROPoller[_models.NetworkSecurityPerimeterConfiguration]: + """Reconcile the specified Network Security Perimeter configuration associated with the Bot. + + :param resource_group_name: The name of the Bot resource group in the user subscription. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param network_security_perimeter_configuration_name: The resource association Name. Composed + of parameter guid and association name. Required. + :type network_security_perimeter_configuration_name: str + :return: An instance of LROPoller that returns either NetworkSecurityPerimeterConfiguration or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = 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._reconcile_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.NetworkSecurityPerimeterConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NetworkSecurityPerimeterConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operation_results_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operation_results_operations.py index 7e03eed310f7..f754408820f2 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operation_results_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operation_results_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, Optional, TypeVar, Union, cast +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,12 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +45,7 @@ def build_get_request(operation_result_id: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +58,7 @@ def build_get_request(operation_result_id: str, subscription_id: str, **kwargs: "operationResultId": _SERIALIZER.url("operation_result_id", operation_result_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") @@ -89,7 +89,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") def _get_initial(self, operation_result_id: str, **kwargs: Any) -> Optional[_models.OperationResultsDescription]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,24 +100,22 @@ def _get_initial(self, operation_result_id: str, **kwargs: Any) -> Optional[_mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.OperationResultsDescription]] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( operation_result_id=operation_result_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._get_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,13 +130,9 @@ def _get_initial(self, operation_result_id: str, **kwargs: Any) -> Optional[_mod deserialized = self._deserialize("OperationResultsDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _get_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}" - } + return deserialized # type: ignore @distributed_trace def begin_get(self, operation_result_id: str, **kwargs: Any) -> LROPoller[_models.OperationResultsDescription]: @@ -146,14 +140,6 @@ def begin_get(self, operation_result_id: str, **kwargs: Any) -> LROPoller[_model :param operation_result_id: The ID of the operation result to get. Required. :type operation_result_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :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 OperationResultsDescription or the result of cls(response) :rtype: @@ -163,9 +149,7 @@ def begin_get(self, operation_result_id: str, **kwargs: Any) -> LROPoller[_model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationResultsDescription] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -184,7 +168,7 @@ def begin_get(self, operation_result_id: str, **kwargs: Any) -> LROPoller[_model def get_long_running_output(pipeline_response): deserialized = self._deserialize("OperationResultsDescription", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -194,14 +178,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.OperationResultsDescription].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_get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}" - } + return LROPoller[_models.OperationResultsDescription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operations.py index 9461f8808433..39a5831fc82d 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/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. @@ -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 ( @@ -30,10 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +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 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.OperationEntity"]: """Lists all the available BotService operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationEntity or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.OperationEntity] :raises ~azure.core.exceptions.HttpResponseError: @@ -91,12 +90,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationEntity"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationEntityListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -107,14 +104,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationEntity"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -126,13 +122,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OperationEntityListResult", pipeline_response) @@ -142,10 +138,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,5 +154,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.BotService/operations"} diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_endpoint_connections_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_endpoint_connections_operations.py index 8e0391ee845f..7b9fe643e8a7 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_endpoint_connections_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/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, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -28,12 +29,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +48,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +71,7 @@ def build_list_request( "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") @@ -91,7 +92,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +118,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") @@ -138,7 +139,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -165,7 +166,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") @@ -188,7 +189,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-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,7 +215,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") @@ -255,7 +256,6 @@ def list( :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_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: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.PrivateEndpointConnection] @@ -264,12 +264,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -280,17 +278,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -302,13 +299,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -318,10 +315,11 @@ def extract_data(pipeline_response): return 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=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -334,10 +332,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections" - } - @distributed_trace def get( self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -352,12 +346,11 @@ def get( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. 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.botservice.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -368,26 +361,24 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, resource_name=resource_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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,13 +391,9 @@ def get( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload def create( @@ -434,7 +421,6 @@ def 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 :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: @@ -446,7 +432,7 @@ def create( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -462,11 +448,10 @@ def create( with the Azure resource. Required. :type private_endpoint_connection_name: str :param properties: The private endpoint connection properties. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: @@ -478,7 +463,7 @@ def create( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], + properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnection: """Update the state of specified private endpoint connection associated with the Bot. @@ -491,18 +476,14 @@ def create( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Is either a model type or a IO - type. Required. - :type properties: ~azure.mgmt.botservice.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 + :param properties: The private endpoint connection properties. Is either a + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.botservice.models.PrivateEndpointConnection or IO[bytes] :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -513,21 +494,19 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(properties, (IO, bytes)): + if isinstance(properties, (IOBase, bytes)): _content = properties else: _json = self._serialize.body(properties, "PrivateEndpointConnection") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -536,15 +515,15 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,13 +536,9 @@ def create( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -579,12 +554,11 @@ def delete( # pylint: disable=inconsistent-return-statements :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -595,26 +569,24 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -625,8 +597,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_link_resources_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_link_resources_operations.py index 96ea52b415be..01951088dcbb 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_link_resources_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/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, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +45,7 @@ def build_list_by_bot_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +68,7 @@ def build_list_by_bot_resource_request( "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") @@ -109,12 +109,11 @@ def list_by_bot_resource( :type resource_group_name: str :param resource_name: The name of the Bot resource. Required. :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceListResult or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -125,25 +124,23 @@ def list_by_bot_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - request = build_list_by_bot_resource_request( + _request = build_list_by_bot_resource_request( resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_bot_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -156,10 +153,6 @@ def list_by_bot_resource( deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_by_bot_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources" - } + return deserialized # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_qn_amaker_endpoint_keys_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_qn_amaker_endpoint_keys_operations.py index 2b17c3aeac0a..93b71ee172d7 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_qn_amaker_endpoint_keys_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_qn_amaker_endpoint_keys_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, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +27,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +44,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -55,7 +56,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "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") @@ -103,7 +104,6 @@ def get( :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: QnAMakerEndpointKeysResponse or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -111,17 +111,16 @@ def get( @overload def get( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.QnAMakerEndpointKeysResponse: """Lists the QnA Maker endpoint keys. :param parameters: The request body parameters to provide for the check name availability request. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: QnAMakerEndpointKeysResponse or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -129,22 +128,18 @@ def get( @distributed_trace def get( - self, parameters: Union[_models.QnAMakerEndpointKeysRequestBody, IO], **kwargs: Any + self, parameters: Union[_models.QnAMakerEndpointKeysRequestBody, IO[bytes]], **kwargs: Any ) -> _models.QnAMakerEndpointKeysResponse: """Lists the QnA Maker endpoint keys. :param parameters: The request body parameters to provide for the check name availability - request. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody 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 + request. Is either a QnAMakerEndpointKeysRequestBody type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody or IO[bytes] :return: QnAMakerEndpointKeysResponse or the result of cls(response) :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -155,35 +150,33 @@ def get( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.QnAMakerEndpointKeysResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "QnAMakerEndpointKeysRequestBody") - request = build_get_request( + _request = build_get_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -196,8 +189,6 @@ def get( deserialized = self._deserialize("QnAMakerEndpointKeysResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listQnAMakerEndpointKeys"} + return deserialized # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/check_name_availability.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/check_name_availability.py index 918636e90662..d777b97b0e28 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/check_name_availability.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/check_name_availability.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -35,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/CheckNameAvailability.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/create_bot.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/create_bot.py index fb5e1782c217..eb935f36099d 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/create_bot.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/create_bot.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -63,6 +66,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/CreateBot.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/CreateBot.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/create_email_sign_in_url.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/create_email_sign_in_url.py index f794b929353e..0492917dd997 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/create_email_sign_in_url.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/create_email_sign_in_url.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/CreateEmailSignInUrl.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/CreateEmailSignInUrl.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_bot.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_bot.py index 9c313495eee5..d72103a60f99 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_bot.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_bot.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -29,13 +30,12 @@ def main(): subscription_id="subscription-id", ) - response = client.bots.delete( + client.bots.delete( resource_group_name="OneResourceGroupName", resource_name="samplebotname", ) - print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/DeleteBot.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/DeleteBot.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_channel.py index f0395331dfe3..84c106264c78 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_channel.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -29,14 +30,13 @@ def main(): subscription_id="subscription-id", ) - response = client.channels.delete( + client.channels.delete( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="EmailChannel", ) - print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/DeleteChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/DeleteChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_connection.py index 2a0a3c64eba8..d4fc82f696d0 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_connection.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -29,14 +30,13 @@ def main(): subscription_id="subscription-id", ) - response = client.bot_connection.delete( + client.bot_connection.delete( resource_group_name="OneResourceGroupName", resource_name="samplebotname", connection_name="sampleConnection", ) - print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/DeleteConnection.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/DeleteConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_direct_line_speech_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_direct_line_speech_channel.py index 62f39a9ae20f..6d3f800f877c 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_direct_line_speech_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_direct_line_speech_channel.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -29,14 +30,13 @@ def main(): subscription_id="subscription-id", ) - response = client.channels.delete( + client.channels.delete( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="DirectLineSpeechChannel", ) - print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/DeleteDirectLineSpeechChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/DeleteDirectLineSpeechChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_private_endpoint_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_private_endpoint_connection.py index e6f2e627380f..c08388c6f219 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_private_endpoint_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_private_endpoint_connection.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -29,14 +30,13 @@ def main(): subscription_id="{subscription-id}", ) - response = client.private_endpoint_connections.delete( + client.private_endpoint_connections.delete( resource_group_name="res6977", resource_name="sto2527", private_endpoint_connection_name="{privateEndpointConnectionName}", ) - print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/DeletePrivateEndpointConnection.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/DeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/directline_regenerate_keys.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/directline_regenerate_keys.py index 9b44df57868b..7a36b6cd03c0 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/directline_regenerate_keys.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/directline_regenerate_keys.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -38,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/DirectlineRegenerateKeys.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/DirectlineRegenerateKeys.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_alexa_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_alexa_channel.py index 33169eed09bd..b2ae863cdc0b 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_alexa_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_alexa_channel.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetAlexaChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/GetAlexaChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_bot.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_bot.py index cd51da9d6146..b492bb98d02f 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_bot.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_bot.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetBot.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/GetBot.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_channel.py index 6fa96a7a8fee..ce01979c0ae4 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_channel.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/GetChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_connection.py index 6477b532d6ee..07d26fa03787 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_connection.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetConnection.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/GetConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_direct_line_speech_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_direct_line_speech_channel.py index d5bbff2f296a..3710c0cbbf02 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_direct_line_speech_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_direct_line_speech_channel.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetDirectLineSpeechChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/GetDirectLineSpeechChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_host_settings.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_host_settings.py index c1cfabcbb4a6..0d4c328898cb 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_host_settings.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_host_settings.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -33,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetHostSettings.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/GetHostSettings.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_line_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_line_channel.py index 867eb469da2c..89b9c588693c 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_line_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_line_channel.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetLineChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/GetLineChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_network_security_perimeter_configuration.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_network_security_perimeter_configuration.py new file mode 100644 index 000000000000..d9c9ea6c8b30 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_network_security_perimeter_configuration.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.botservice import AzureBotService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-botservice +# USAGE + python get_network_security_perimeter_configuration.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureBotService( + credential=DefaultAzureCredential(), + subscription_id="subId", + ) + + response = client.network_security_perimeter_configurations.get( + resource_group_name="rgName", + resource_name="botId", + network_security_perimeter_configuration_name="00000000-0000-0000-0000-000000000000.associationName", + ) + print(response) + + +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/GetNetworkSecurityPerimeterConfiguration.json +if __name__ == "__main__": + main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_operations.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_operations.py index 5e0d2c24cbce..b3a8fb56ac0f 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_operations.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetOperations.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/GetOperations.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_private_endpoint_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_private_endpoint_connection.py index 606dd6d004eb..55d855d005b2 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_private_endpoint_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_private_endpoint_connection.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetPrivateEndpointConnection.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/GetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_resource_group.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_resource_group.py index ad486f5beed1..636094140476 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_resource_group.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListBotsByResourceGroup.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/ListBotsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_subscription.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_subscription.py index b9a30d883948..8f33253272b0 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_subscription.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListBotsBySubscription.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/ListBotsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channel.py index 473aff1cc087..0d7f0a808c31 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channel.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -37,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/ListChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channels_by_bot_service.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channels_by_bot_service.py index 8df6fc18a628..ed093f329419 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channels_by_bot_service.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channels_by_bot_service.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListChannelsByBotService.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/ListChannelsByBotService.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_connections_by_bot_service.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_connections_by_bot_service.py index c970494b970e..1526b9206d97 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_connections_by_bot_service.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_connections_by_bot_service.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListConnectionsByBotService.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/ListConnectionsByBotService.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_network_security_perimeter_configurations.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_network_security_perimeter_configurations.py new file mode 100644 index 000000000000..40fa3ec2ef4c --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_network_security_perimeter_configurations.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.botservice import AzureBotService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-botservice +# USAGE + python list_network_security_perimeter_configurations.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureBotService( + credential=DefaultAzureCredential(), + subscription_id="subId", + ) + + response = client.network_security_perimeter_configurations.list( + resource_group_name="rgName", + resource_name="botId", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/ListNetworkSecurityPerimeterConfigurations.json +if __name__ == "__main__": + main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_endpoint_connections.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_endpoint_connections.py index c000002ec3cb..bd7ec3d197b2 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_endpoint_connections.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_endpoint_connections.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListPrivateEndpointConnections.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/ListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_link_resources.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_link_resources.py index a58440a0ed08..590b0819f198 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_link_resources.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_link_resources.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListPrivateLinkResources.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/ListPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_qn_amaker_endpoint_keys.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_qn_amaker_endpoint_keys.py index c0666fd5567f..a7e0691212af 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_qn_amaker_endpoint_keys.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_qn_amaker_endpoint_keys.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -35,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListQnAMakerEndpointKeys.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/ListQnAMakerEndpointKeys.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_service_providers.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_service_providers.py index ed4fd43ae2e3..397070ed3a8b 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_service_providers.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_service_providers.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -33,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListServiceProviders.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/ListServiceProviders.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/operation_results_get.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/operation_results_get.py index 9cd2881b0598..029f747110ae 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/operation_results_get.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/operation_results_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/OperationResultsGet.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/OperationResultsGet.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_alexa_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_alexa_channel.py index 7c29b9bc1fa1..a8de6664365a 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_alexa_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_alexa_channel.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -44,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutAlexaChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/PutAlexaChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_channel.py index 73b5c50281a8..1a87b9fd20a4 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_channel.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -44,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/PutChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_connection.py index 5f3a2ae88334..f89fa69603f5 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_connection.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -48,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutConnection.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/PutConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_direct_line_speech_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_direct_line_speech_channel.py index 88e937a1a068..3e2753dbae56 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_direct_line_speech_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_direct_line_speech_channel.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -48,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutDirectLineSpeechChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/PutDirectLineSpeechChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_email_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_email_channel.py index a630d739e26e..f3ad7802a421 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_email_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_email_channel.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -44,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutEmailChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/PutEmailChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_line_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_line_channel.py index 25010e95c991..531ba9cd4bfc 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_line_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_line_channel.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -48,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutLineChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/PutLineChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_private_endpoint_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_private_endpoint_connection.py index e0ef02b8e1ac..6364640cf362 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_private_endpoint_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_private_endpoint_connection.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -40,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutPrivateEndpointConnection.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/PutPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/reconcile_network_security_perimeter_configuration.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/reconcile_network_security_perimeter_configuration.py new file mode 100644 index 000000000000..20477c0b7c2c --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/reconcile_network_security_perimeter_configuration.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.botservice import AzureBotService + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-botservice +# USAGE + python reconcile_network_security_perimeter_configuration.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = AzureBotService( + credential=DefaultAzureCredential(), + subscription_id="subId", + ) + + response = client.network_security_perimeter_configurations.begin_reconcile( + resource_group_name="rgName", + resource_name="botId", + network_security_perimeter_configuration_name="00000000-0000-0000-0000-000000000000.associationName", + ).result() + print(response) + + +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/ReconcileNetworkSecurityPerimeterConfiguration.json +if __name__ == "__main__": + main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_alexa_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_alexa_channel.py index 6fc6fd1d7527..d1ae43d43f29 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_alexa_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_alexa_channel.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -37,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/UpdateAlexaChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/UpdateAlexaChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_bot.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_bot.py index 1dbdc68a70f9..dccafe4d9a68 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_bot.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_bot.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/UpdateBot.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/UpdateBot.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_channel.py index bf92a3d8d339..ea904e326d3e 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_channel.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -37,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/UpdateChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/UpdateChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_connection.py index 51d978197d4c..6209582827c1 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_connection.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService """ @@ -39,6 +42,8 @@ def main(): "properties": { "clientId": "sampleclientid", "clientSecret": "samplesecret", + "id": "sampleId", + "name": "sampleName", "parameters": [{"key": "key1", "value": "value1"}, {"key": "key2", "value": "value2"}], "scopes": "samplescope", "serviceProviderDisplayName": "serviceProviderDisplayName", @@ -49,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/UpdateConnection.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/UpdateConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_direct_line_speech_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_direct_line_speech_channel.py index d87a0b0855cc..ed657a140978 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_direct_line_speech_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_direct_line_speech_channel.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -37,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/UpdateDirectLineSpeechChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/UpdateDirectLineSpeechChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_line_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_line_channel.py index 78fb7b7ee973..5e4fe08edb90 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_line_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_line_channel.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -37,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/UpdateLineChannel.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/UpdateLineChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/web_chat_regenerate_keys.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/web_chat_regenerate_keys.py index f032b7e01ee7..8ee217640adb 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/web_chat_regenerate_keys.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/web_chat_regenerate_keys.py @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.botservice import AzureBotService +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -38,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/WebChatRegenerateKeys.json +# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/preview/2023-09-15-preview/examples/WebChatRegenerateKeys.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/setup.py b/sdk/botservice/azure-mgmt-botservice/setup.py index 553174f56e4e..87480d00d803 100644 --- a/sdk/botservice/azure-mgmt-botservice/setup.py +++ b/sdk/botservice/azure-mgmt-botservice/setup.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import re import os.path @@ -16,64 +16,67 @@ PACKAGE_PPRINT_NAME = "Bot Service" # a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace('-', '/') +package_folder_path = PACKAGE_NAME.replace("-", "/") # a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace('-', '.') +namespace_name = PACKAGE_NAME.replace("-", ".") # 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'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', - fd.read(), re.MULTILINE).group(1) +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"), + "r", +) as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) if not version: - raise RuntimeError('Cannot find version information') + raise RuntimeError("Cannot find version information") -with open('README.md', encoding='utf-8') as f: +with open("README.md", encoding="utf-8") as f: readme = f.read() -with open('CHANGELOG.md', encoding='utf-8') as f: +with open("CHANGELOG.md", encoding="utf-8") as f: changelog = f.read() setup( name=PACKAGE_NAME, version=version, - description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), - long_description=readme + '\n\n' + changelog, - long_description_content_type='text/markdown', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/Azure/azure-sdk-for-python', + description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - 'Development Status :: 4 - Beta', - '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', - 'License :: OSI Approved :: MIT License', + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "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, - packages=find_packages(exclude=[ - 'tests', - # Exclude packages that will be covered by PEP420 or nspkg - 'azure', - 'azure.mgmt', - ]), + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.mgmt", + ] + ), include_package_data=True, package_data={ - 'pytyped': ['py.typed'], + "pytyped": ["py.typed"], }, install_requires=[ - "msrest>=0.7.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", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7" + python_requires=">=3.8", )