From 42769787a4b33d4a4329f0adab334749eeafab02 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 1 Aug 2022 02:28:24 +0000 Subject: [PATCH] CodeGen from PR 19687 in Azure/azure-rest-api-specs Merge 6398a96c9707337cbeaa06e33286abe8023b9248 into 2dcad6d6e9a96882eb6d317e7500a94be007a9c6 --- .../azure-mgmt-botservice/_meta.json | 6 +- .../azure/mgmt/botservice/__init__.py | 13 +- .../mgmt/botservice/_azure_bot_service.py | 63 +- .../azure/mgmt/botservice/_configuration.py | 9 +- .../azure/mgmt/botservice/_metadata.json | 110 -- .../azure/mgmt/botservice/_version.py | 2 +- .../azure/mgmt/botservice/aio/__init__.py | 13 +- .../mgmt/botservice/aio/_azure_bot_service.py | 61 +- .../mgmt/botservice/aio/_configuration.py | 9 +- .../botservice/aio/operations/__init__.py | 9 + .../operations/_bot_connection_operations.py | 213 ++-- .../aio/operations/_bots_operations.py | 235 ++-- .../aio/operations/_channels_operations.py | 204 ++-- .../aio/operations/_direct_line_operations.py | 61 +- .../aio/operations/_email_operations.py | 107 ++ .../operations/_host_settings_operations.py | 58 +- .../_operation_results_operations.py | 89 +- .../botservice/aio/operations/_operations.py | 64 +- .../mgmt/botservice/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 138 ++- .../_private_link_resources_operations.py | 58 +- .../_qn_amaker_endpoint_keys_operations.py | 107 ++ .../azure/mgmt/botservice/models/__init__.py | 18 +- .../models/_azure_bot_service_enums.py | 34 +- .../mgmt/botservice/models/_models_py3.py | 1037 +++++++++++------ .../azure/mgmt/botservice/models/_patch.py | 19 + .../mgmt/botservice/operations/__init__.py | 9 + .../operations/_bot_connection_operations.py | 397 ++++--- .../botservice/operations/_bots_operations.py | 422 ++++--- .../operations/_channels_operations.py | 364 +++--- .../operations/_direct_line_operations.py | 96 +- .../operations/_email_operations.py | 147 +++ .../operations/_host_settings_operations.py | 87 +- .../_operation_results_operations.py | 118 +- .../mgmt/botservice/operations/_operations.py | 90 +- .../mgmt/botservice/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 245 ++-- .../_private_link_resources_operations.py | 87 +- .../_qn_amaker_endpoint_keys_operations.py | 151 +++ 39 files changed, 3340 insertions(+), 1648 deletions(-) delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_metadata.json create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_email_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_patch.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_qn_amaker_endpoint_keys_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_patch.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_email_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_patch.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_qn_amaker_endpoint_keys_operations.py diff --git a/sdk/botservice/azure-mgmt-botservice/_meta.json b/sdk/botservice/azure-mgmt-botservice/_meta.json index 1854c23ceafd..757296ac3ecc 100644 --- a/sdk/botservice/azure-mgmt-botservice/_meta.json +++ b/sdk/botservice/azure-mgmt-botservice/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.12.0", + "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "18a8f9df1c94fdbdac9492099013bb6656d3c95a", + "commit": "d9f299b4fdc0b852516eb80f909af599aa1c559f", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/botservice/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/botservice/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/botservice/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/__init__.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/__init__.py index a4b6bab689ba..cc791a9cff6b 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/__init__.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['AzureBotService'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` 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 -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() 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 93b9ba3a71cd..8cea67ccd51f 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 @@ -7,21 +7,22 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import AzureBotServiceConfiguration -from .operations import BotConnectionOperations, BotsOperations, ChannelsOperations, DirectLineOperations, HostSettingsOperations, OperationResultsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations +from .operations import BotConnectionOperations, BotsOperations, ChannelsOperations, DirectLineOperations, EmailOperations, HostSettingsOperations, OperationResultsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QnAMakerEndpointKeysOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class AzureBotService: +class AzureBotService: # pylint: disable=too-many-instance-attributes """Azure Bot Service is a platform for creating smart conversational agents. :ivar bots: BotsOperations operations @@ -30,10 +31,15 @@ class AzureBotService: :vartype channels: azure.mgmt.botservice.operations.ChannelsOperations :ivar direct_line: DirectLineOperations operations :vartype direct_line: azure.mgmt.botservice.operations.DirectLineOperations + :ivar email: EmailOperations operations + :vartype email: azure.mgmt.botservice.operations.EmailOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.botservice.operations.Operations :ivar bot_connection: BotConnectionOperations operations :vartype bot_connection: azure.mgmt.botservice.operations.BotConnectionOperations + :ivar qn_amaker_endpoint_keys: QnAMakerEndpointKeysOperations operations + :vartype qn_amaker_endpoint_keys: + azure.mgmt.botservice.operations.QnAMakerEndpointKeysOperations :ivar host_settings: HostSettingsOperations operations :vartype host_settings: azure.mgmt.botservice.operations.HostSettingsOperations :ivar operation_results: OperationResultsOperations operations @@ -48,8 +54,11 @@ class AzureBotService: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Azure Subscription ID. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-06-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. """ @@ -68,20 +77,44 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.bots = BotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.channels = ChannelsOperations(self._client, self._config, self._serialize, self._deserialize) - self.direct_line = DirectLineOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.bot_connection = BotConnectionOperations(self._client, self._config, self._serialize, self._deserialize) - self.host_settings = HostSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operation_results = OperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.bots = BotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.channels = ChannelsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.direct_line = DirectLineOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.email = EmailOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bot_connection = BotConnectionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.qn_amaker_endpoint_keys = QnAMakerEndpointKeysOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.host_settings = HostSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operation_results = OperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. 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 c0ef5bf10054..95f8122ac40a 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_configuration.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class AzureBotServiceConfiguration(Configuration): +class AzureBotServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureBotService. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class AzureBotServiceConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Azure Subscription ID. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-06-15-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(AzureBotServiceConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-06-15-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-05-01-preview" + 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._configure(**kwargs) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_metadata.json b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_metadata.json deleted file mode 100644 index ce2d5328325c..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_metadata.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "chosen_version": "2021-05-01-preview", - "total_api_version_list": ["2021-05-01-preview"], - "client": { - "name": "AzureBotService", - "filename": "_azure_bot_service", - "description": "Azure Bot Service is a platform for creating smart conversational agents.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureBotServiceConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureBotServiceConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "Azure Subscription ID.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Azure Subscription ID.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "bots": "BotsOperations", - "channels": "ChannelsOperations", - "direct_line": "DirectLineOperations", - "operations": "Operations", - "bot_connection": "BotConnectionOperations", - "host_settings": "HostSettingsOperations", - "operation_results": "OperationResultsOperations", - "private_endpoint_connections": "PrivateEndpointConnectionsOperations", - "private_link_resources": "PrivateLinkResourcesOperations" - } -} \ No newline at end of file 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 be0a9764bc6d..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.0b3" +VERSION = "0.2.0" diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/__init__.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/__init__.py index 349677150608..9b699c4406b5 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/__init__.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._azure_bot_service import AzureBotService + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['AzureBotService'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` 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 -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() 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 7491c1917704..6446c086d503 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 @@ -7,21 +7,22 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import AzureBotServiceConfiguration -from .operations import BotConnectionOperations, BotsOperations, ChannelsOperations, DirectLineOperations, HostSettingsOperations, OperationResultsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations +from .operations import BotConnectionOperations, BotsOperations, ChannelsOperations, DirectLineOperations, EmailOperations, HostSettingsOperations, OperationResultsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QnAMakerEndpointKeysOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class AzureBotService: +class AzureBotService: # pylint: disable=too-many-instance-attributes """Azure Bot Service is a platform for creating smart conversational agents. :ivar bots: BotsOperations operations @@ -30,10 +31,15 @@ class AzureBotService: :vartype channels: azure.mgmt.botservice.aio.operations.ChannelsOperations :ivar direct_line: DirectLineOperations operations :vartype direct_line: azure.mgmt.botservice.aio.operations.DirectLineOperations + :ivar email: EmailOperations operations + :vartype email: azure.mgmt.botservice.aio.operations.EmailOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.botservice.aio.operations.Operations :ivar bot_connection: BotConnectionOperations operations :vartype bot_connection: azure.mgmt.botservice.aio.operations.BotConnectionOperations + :ivar qn_amaker_endpoint_keys: QnAMakerEndpointKeysOperations operations + :vartype qn_amaker_endpoint_keys: + azure.mgmt.botservice.aio.operations.QnAMakerEndpointKeysOperations :ivar host_settings: HostSettingsOperations operations :vartype host_settings: azure.mgmt.botservice.aio.operations.HostSettingsOperations :ivar operation_results: OperationResultsOperations operations @@ -48,8 +54,11 @@ class AzureBotService: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Azure Subscription ID. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-06-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. """ @@ -68,15 +77,39 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.bots = BotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.channels = ChannelsOperations(self._client, self._config, self._serialize, self._deserialize) - self.direct_line = DirectLineOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.bot_connection = BotConnectionOperations(self._client, self._config, self._serialize, self._deserialize) - self.host_settings = HostSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operation_results = OperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.bots = BotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.channels = ChannelsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.direct_line = DirectLineOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.email = EmailOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bot_connection = BotConnectionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.qn_amaker_endpoint_keys = QnAMakerEndpointKeysOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.host_settings = HostSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operation_results = OperationResultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( 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 3130d740b67c..0f5519d71e16 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 @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AzureBotServiceConfiguration(Configuration): +class AzureBotServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureBotService. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class AzureBotServiceConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Azure Subscription ID. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-06-15-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(AzureBotServiceConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-06-15-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-05-01-preview" + 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._configure(**kwargs) 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 89604c7b3d53..4f1448434ae0 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 @@ -9,21 +9,30 @@ from ._bots_operations import BotsOperations from ._channels_operations import ChannelsOperations from ._direct_line_operations import DirectLineOperations +from ._email_operations import EmailOperations from ._operations import Operations from ._bot_connection_operations import BotConnectionOperations +from ._qn_amaker_endpoint_keys_operations import QnAMakerEndpointKeysOperations from ._host_settings_operations import HostSettingsOperations from ._operation_results_operations import OperationResultsOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'BotsOperations', 'ChannelsOperations', 'DirectLineOperations', + 'EmailOperations', 'Operations', 'BotConnectionOperations', + 'QnAMakerEndpointKeysOperations', 'HostSettingsOperations', 'OperationResultsOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file 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 0edb4459766f..562b860fd8d1 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ 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 ... import models as _models @@ -25,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class BotConnectionOperations: - """BotConnectionOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.AzureBotService`'s + :attr:`bot_connection` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 list_service_providers( self, **kwargs: Any - ) -> "_models.ServiceProviderResponseList": + ) -> _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 @@ -58,21 +56,33 @@ async def list_service_providers( :rtype: ~azure.mgmt.botservice.models.ServiceProviderResponseList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceProviderResponseList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceProviderResponseList] 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -87,7 +97,7 @@ async def list_service_providers( return deserialized - list_service_providers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders'} # type: ignore + list_service_providers.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders"} # type: ignore @distributed_trace_async @@ -97,7 +107,7 @@ async def list_with_secrets( resource_name: str, connection_name: str, **kwargs: Any - ) -> "_models.ConnectionSetting": + ) -> _models.ConnectionSetting: """Get a Connection Setting registration for a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -111,11 +121,16 @@ async def list_with_secrets( :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectionSetting"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionSetting] request = build_list_with_secrets_request( @@ -123,12 +138,19 @@ async def list_with_secrets( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -143,7 +165,7 @@ async def list_with_secrets( return deserialized - list_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets'} # type: ignore + list_with_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets"} # type: ignore @distributed_trace_async @@ -152,9 +174,9 @@ async def create( resource_group_name: str, resource_name: str, connection_name: str, - parameters: "_models.ConnectionSetting", + parameters: _models.ConnectionSetting, **kwargs: Any - ) -> "_models.ConnectionSetting": + ) -> _models.ConnectionSetting: """Register a new Auth Connection for a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -170,13 +192,17 @@ async def create( :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectionSetting"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionSetting] _json = self._serialize.body(parameters, 'ConnectionSetting') @@ -185,14 +211,21 @@ async def create( resource_name=resource_name, connection_name=connection_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -211,7 +244,7 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}"} # type: ignore @distributed_trace_async @@ -220,9 +253,9 @@ async def update( resource_group_name: str, resource_name: str, connection_name: str, - parameters: "_models.ConnectionSetting", + parameters: _models.ConnectionSetting, **kwargs: Any - ) -> "_models.ConnectionSetting": + ) -> _models.ConnectionSetting: """Updates a Connection Setting registration for a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -238,13 +271,17 @@ async def update( :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectionSetting"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionSetting] _json = self._serialize.body(parameters, 'ConnectionSetting') @@ -253,14 +290,21 @@ async def update( resource_name=resource_name, connection_name=connection_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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -279,7 +323,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}"} # type: ignore @distributed_trace_async @@ -289,7 +333,7 @@ async def get( resource_name: str, connection_name: str, **kwargs: Any - ) -> "_models.ConnectionSetting": + ) -> _models.ConnectionSetting: """Get a Connection Setting registration for a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -303,11 +347,16 @@ async def get( :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectionSetting"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionSetting] request = build_get_request( @@ -315,12 +364,19 @@ async def get( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -335,11 +391,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, @@ -359,11 +415,16 @@ async def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -371,12 +432,19 @@ async def delete( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -387,7 +455,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}"} # type: ignore @distributed_trace @@ -396,7 +464,7 @@ def list_by_bot_service( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConnectionSettingResponseList"]: + ) -> AsyncIterable[_models.ConnectionSettingResponseList]: """Returns all the Connection Settings registered to a particular BotService resource. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -410,11 +478,16 @@ def list_by_bot_service( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.ConnectionSettingResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectionSettingResponseList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionSettingResponseList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -422,10 +495,13 @@ def prepare_request(next_link=None): 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.url = self._client.format_url(request.url) # type: ignore else: @@ -433,10 +509,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -450,7 +529,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -464,4 +547,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_bot_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections'} # type: ignore + list_by_bot_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections"} # type: ignore 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 d2b04eff8a5f..a96b203e7df2 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ 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 ... import models as _models @@ -25,35 +25,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class BotsOperations: - """BotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.AzureBotService`'s + :attr:`bots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def create( self, resource_group_name: str, resource_name: str, - parameters: "_models.Bot", + parameters: _models.Bot, **kwargs: Any - ) -> "_models.Bot": + ) -> _models.Bot: """Creates a Bot Service. Bot Service is a resource group wide resource type. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -67,13 +65,17 @@ async def create( :rtype: ~azure.mgmt.botservice.models.Bot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Bot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Bot] _json = self._serialize.body(parameters, 'Bot') @@ -81,14 +83,21 @@ async def create( 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.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -107,7 +116,7 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}"} # type: ignore @distributed_trace_async @@ -117,42 +126,46 @@ async def update( resource_name: str, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, + sku: Optional[_models.Sku] = None, kind: Optional[Union[str, "_models.Kind"]] = None, etag: Optional[str] = None, - properties: Optional["_models.BotProperties"] = None, + properties: Optional[_models.BotProperties] = None, **kwargs: Any - ) -> "_models.Bot": + ) -> _models.Bot: """Updates a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. :type resource_group_name: str :param resource_name: The name of the Bot resource. :type resource_name: str - :param location: Specifies the location of the resource. + :param location: Specifies the location of the resource. Default value is None. :type location: str - :param tags: Contains resource tags defined as key/value pairs. + :param tags: Contains resource tags defined as key/value pairs. Default value is None. :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. + :param sku: Gets or sets the SKU of the resource. Default value is None. :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. + :param kind: Required. Gets or sets the Kind of the resource. Default value is None. :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. + :param etag: Entity Tag. Default value is None. :type etag: str - :param properties: The set of properties specific to bot resource. + :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 """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Bot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Bot] _parameters = _models.Bot(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) _json = self._serialize.body(_parameters, 'Bot') @@ -161,14 +174,21 @@ async def update( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -187,11 +207,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, @@ -208,23 +228,35 @@ async def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -235,7 +267,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}"} # type: ignore @distributed_trace_async @@ -244,7 +276,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Bot": + ) -> _models.Bot: """Returns a BotService specified by the parameters. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -256,23 +288,35 @@ async def get( :rtype: ~azure.mgmt.botservice.models.Bot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Bot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Bot] 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -287,7 +331,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}"} # type: ignore @distributed_trace @@ -295,7 +339,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BotResponseList"]: + ) -> AsyncIterable[_models.BotResponseList]: """Returns all the resources of a particular type belonging to a resource group. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -305,31 +349,42 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.BotResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotResponseList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.BotResponseList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: 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=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -343,7 +398,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -357,13 +416,13 @@ 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'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices"} # type: ignore @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.BotResponseList"]: + ) -> AsyncIterable[_models.BotResponseList]: """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 @@ -371,29 +430,40 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.BotResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotResponseList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.BotResponseList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: 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.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -407,7 +477,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -421,14 +495,14 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices"} # type: ignore @distributed_trace_async async def get_check_name_availability( self, - parameters: "_models.CheckNameAvailabilityRequestBody", + parameters: _models.CheckNameAvailabilityRequestBody, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResponseBody": + ) -> _models.CheckNameAvailabilityResponseBody: """Check whether a bot name is available. :param parameters: The request body parameters to provide for the check name availability @@ -439,25 +513,36 @@ async def get_check_name_availability( :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResponseBody"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResponseBody] _json = self._serialize.body(parameters, 'CheckNameAvailabilityRequestBody') request = build_get_check_name_availability_request( + api_version=api_version, content_type=content_type, json=_json, 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -472,5 +557,5 @@ async def get_check_name_availability( return deserialized - get_check_name_availability.metadata = {'url': '/providers/Microsoft.BotService/checkNameAvailability'} # type: ignore + get_check_name_availability.metadata = {'url': "/providers/Microsoft.BotService/checkNameAvailability"} # 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 ed699ac52b84..9309d092485e 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ 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 ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ChannelsOperations: - """ChannelsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.AzureBotService`'s + :attr:`channels` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def create( @@ -52,9 +50,9 @@ async def create( resource_group_name: str, resource_name: str, channel_name: Union[str, "_models.ChannelName"], - parameters: "_models.BotChannel", + parameters: _models.BotChannel, **kwargs: Any - ) -> "_models.BotChannel": + ) -> _models.BotChannel: """Creates a Channel registration for a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -70,13 +68,17 @@ async def create( :rtype: ~azure.mgmt.botservice.models.BotChannel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotChannel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.BotChannel] _json = self._serialize.body(parameters, 'BotChannel') @@ -85,14 +87,21 @@ async def create( resource_name=resource_name, channel_name=channel_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -111,7 +120,7 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}"} # type: ignore @distributed_trace_async @@ -122,12 +131,12 @@ async def update( channel_name: Union[str, "_models.ChannelName"], location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, + sku: Optional[_models.Sku] = None, kind: Optional[Union[str, "_models.Kind"]] = None, etag: Optional[str] = None, - properties: Optional["_models.Channel"] = None, + properties: Optional[_models.Channel] = None, **kwargs: Any - ) -> "_models.BotChannel": + ) -> _models.BotChannel: """Updates a Channel registration for a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -136,30 +145,35 @@ async def update( :type resource_name: str :param channel_name: The name of the Channel resource. :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :param location: Specifies the location of the resource. + :param location: Specifies the location of the resource. Default value is None. :type location: str - :param tags: Contains resource tags defined as key/value pairs. + :param tags: Contains resource tags defined as key/value pairs. Default value is None. :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. + :param sku: Gets or sets the SKU of the resource. Default value is None. :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. + :param kind: Required. Gets or sets the Kind of the resource. Default value is None. :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. + :param etag: Entity Tag. Default value is None. :type etag: str - :param properties: The set of properties specific to bot channel resource. + :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 """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotChannel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.BotChannel] _parameters = _models.BotChannel(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) _json = self._serialize.body(_parameters, 'BotChannel') @@ -169,14 +183,21 @@ async def update( resource_name=resource_name, channel_name=channel_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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -195,11 +216,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, @@ -219,11 +240,16 @@ async def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -231,12 +257,19 @@ async def delete( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -247,7 +280,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}"} # type: ignore @distributed_trace_async @@ -257,7 +290,7 @@ async def get( resource_name: str, channel_name: str, **kwargs: Any - ) -> "_models.BotChannel": + ) -> _models.BotChannel: """Returns a BotService Channel registration specified by the parameters. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -271,11 +304,16 @@ async def get( :rtype: ~azure.mgmt.botservice.models.BotChannel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotChannel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.BotChannel] request = build_get_request( @@ -283,12 +321,19 @@ async def get( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -303,7 +348,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}"} # type: ignore @distributed_trace_async @@ -313,7 +358,7 @@ async def list_with_keys( resource_name: str, channel_name: Union[str, "_models.ChannelName"], **kwargs: Any - ) -> "_models.ListChannelWithKeysResponse": + ) -> _models.ListChannelWithKeysResponse: """Lists a Channel registration for a Bot Service including secrets. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -327,11 +372,16 @@ async def list_with_keys( :rtype: ~azure.mgmt.botservice.models.ListChannelWithKeysResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListChannelWithKeysResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ListChannelWithKeysResponse] request = build_list_with_keys_request( @@ -339,12 +389,19 @@ async def list_with_keys( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -359,7 +416,7 @@ async def list_with_keys( return deserialized - list_with_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys'} # type: ignore + list_with_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys"} # type: ignore @distributed_trace @@ -368,7 +425,7 @@ def list_by_resource_group( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ChannelResponseList"]: + ) -> AsyncIterable[_models.ChannelResponseList]: """Returns all the Channel registrations of a particular BotService resource. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -381,11 +438,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.ChannelResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ChannelResponseList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ChannelResponseList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -393,10 +455,13 @@ def prepare_request(next_link=None): 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.url = self._client.format_url(request.url) # type: ignore else: @@ -404,10 +469,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -421,7 +489,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -435,4 +507,4 @@ 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/{resourceName}/channels'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels"} # type: ignore 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 6b8a9de7faa4..1fe945659e40 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class DirectLineOperations: - """DirectLineOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.AzureBotService`'s + :attr:`direct_line` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 regenerate_keys( @@ -50,9 +48,9 @@ async def regenerate_keys( resource_group_name: str, resource_name: str, channel_name: Union[str, "_models.RegenerateKeysChannelName"], - parameters: "_models.SiteInfo", + parameters: _models.SiteInfo, **kwargs: Any - ) -> "_models.BotChannel": + ) -> _models.BotChannel: """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService resource. @@ -69,13 +67,17 @@ async def regenerate_keys( :rtype: ~azure.mgmt.botservice.models.BotChannel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotChannel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.BotChannel] _json = self._serialize.body(parameters, 'SiteInfo') @@ -84,14 +86,21 @@ async def regenerate_keys( resource_name=resource_name, subscription_id=self._config.subscription_id, channel_name=channel_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.regenerate_keys.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,5 +115,5 @@ async def regenerate_keys( return deserialized - regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys'} # type: ignore + regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys"} # 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 new file mode 100644 index 000000000000..44cff6dfc1ee --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_email_operations.py @@ -0,0 +1,107 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._email_operations import build_create_sign_in_url_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class EmailOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.AzureBotService`'s + :attr:`email` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace_async + async def create_sign_in_url( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.CreateEmailSignInUrlResponse: + """Creates an email channel sign in url for a Bot Service. + + :param resource_group_name: The name of the Bot resource group in the user subscription. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CreateEmailSignInUrlResponse] + + + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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('CreateEmailSignInUrlResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_sign_in_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/createEmailSignInUrl"} # 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 815d754deccd..3357e7b6db9e 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,32 +23,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class HostSettingsOperations: - """HostSettingsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.AzureBotService`'s + :attr:`host_settings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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, **kwargs: Any - ) -> "_models.HostSettingsResponse": + ) -> _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 @@ -56,21 +54,33 @@ async def get( :rtype: ~azure.mgmt.botservice.models.HostSettingsResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.HostSettingsResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.HostSettingsResponse] 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -85,5 +95,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings"} # 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 1f31698c1006..8809b0b94df8 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,6 +14,7 @@ from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -25,48 +25,58 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class OperationResultsOperations: - """OperationResultsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.AzureBotService`'s + :attr:`operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + async def _get_initial( self, operation_result_id: str, **kwargs: Any - ) -> Optional["_models.OperationResultsDescription"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationResultsDescription"]] + ) -> Optional[_models.OperationResultsDescription]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationResultsDescription]] request = build_get_request_initial( subscription_id=self._config.subscription_id, operation_result_id=operation_result_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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -82,7 +92,7 @@ async def _get_initial( return deserialized - _get_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}'} # type: ignore + _get_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}"} # type: ignore @distributed_trace_async @@ -90,7 +100,7 @@ async def begin_get( self, operation_result_id: str, **kwargs: Any - ) -> AsyncLROPoller["_models.OperationResultsDescription"]: + ) -> AsyncLROPoller[_models.OperationResultsDescription]: """Get the operation result for a long running operation. :param operation_result_id: The ID of the operation result to get. @@ -109,31 +119,43 @@ async def begin_get( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.botservice.models.OperationResultsDescription] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResultsDescription"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationResultsDescription] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._get_initial( + raw_result = await self._get_initial( # type: ignore operation_result_id=operation_result_id, + 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): - response = pipeline_response.http_response deserialized = self._deserialize('OperationResultsDescription', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -142,7 +164,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}'} # type: ignore + begin_get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}"} # 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 224a5286d85b..a2cdc57d685c 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse 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 ... import models as _models @@ -25,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.AzureBotService`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationEntityListResult"]: + ) -> AsyncIterable[_models.OperationEntityListResult]: """Lists all the available BotService operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -60,27 +57,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.OperationEntityListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationEntityListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationEntityListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -94,7 +102,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,4 +120,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.BotService/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.BotService/operations"} # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_patch.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 3339a4910ccd..16e52f24b12b 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ 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 ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.AzureBotService`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 def list( @@ -52,7 +50,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: """List all the private endpoint connections associated with the Bot. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -66,11 +64,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,10 +81,13 @@ def prepare_request(next_link=None): 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.url = self._client.format_url(request.url) # type: ignore else: @@ -89,10 +95,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -106,7 +115,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -120,7 +133,7 @@ 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'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace_async async def get( @@ -129,7 +142,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection associated with the Bot. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -144,11 +157,16 @@ async def get( :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -156,12 +174,19 @@ async def get( resource_name=resource_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -176,7 +201,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async @@ -185,9 +210,9 @@ async def create( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Update the state of specified private endpoint connection associated with the Bot. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -204,13 +229,17 @@ async def create( :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -219,14 +248,21 @@ async def create( resource_name=resource_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -241,11 +277,11 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, @@ -266,11 +302,16 @@ async def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -278,12 +319,19 @@ async def delete( resource_name=resource_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -294,5 +342,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # 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 8bd290fc95a1..3b34f7db0db6 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.AzureBotService`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 list_by_bot_resource( @@ -50,7 +48,7 @@ async def list_by_bot_resource( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources that need to be created for a Bot. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -62,23 +60,35 @@ async def list_by_bot_resource( :rtype: ~azure.mgmt.botservice.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -93,5 +103,5 @@ async def list_by_bot_resource( return deserialized - list_by_bot_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources'} # type: ignore + list_by_bot_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources"} # 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 new file mode 100644 index 000000000000..d43777e274e2 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_qn_amaker_endpoint_keys_operations.py @@ -0,0 +1,107 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._qn_amaker_endpoint_keys_operations import build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QnAMakerEndpointKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.AzureBotService`'s + :attr:`qn_amaker_endpoint_keys` 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, + parameters: _models.QnAMakerEndpointKeysRequestBody, + **kwargs: Any + ) -> _models.QnAMakerEndpointKeysResponse: + """Lists the QnA Maker endpoint keys. + + :param parameters: The request body parameters to provide for the check name availability + request. + :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody + :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 + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.QnAMakerEndpointKeysResponse] + + _json = self._serialize.body(parameters, 'QnAMakerEndpointKeysRequestBody') + + request = build_get_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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('QnAMakerEndpointKeysResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listQnAMakerEndpointKeys"} # 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 ec7694ba4be1..c83f271d1924 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 @@ -22,6 +22,8 @@ from ._models_py3 import ConnectionSettingParameter from ._models_py3 import ConnectionSettingProperties from ._models_py3 import ConnectionSettingResponseList +from ._models_py3 import CreateEmailSignInUrlResponse +from ._models_py3 import CreateEmailSignInUrlResponseProperties from ._models_py3 import DirectLineChannel from ._models_py3 import DirectLineChannelProperties from ._models_py3 import DirectLineSite @@ -47,6 +49,7 @@ from ._models_py3 import OperationEntity from ._models_py3 import OperationEntityListResult from ._models_py3 import OperationResultsDescription +from ._models_py3 import OutlookChannel from ._models_py3 import PrivateEndpoint from ._models_py3 import PrivateEndpointConnection from ._models_py3 import PrivateEndpointConnectionListResult @@ -54,6 +57,8 @@ from ._models_py3 import PrivateLinkResourceBase from ._models_py3 import PrivateLinkResourceListResult from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import QnAMakerEndpointKeysRequestBody +from ._models_py3 import QnAMakerEndpointKeysResponse from ._models_py3 import Resource from ._models_py3 import ServiceProvider from ._models_py3 import ServiceProviderParameter @@ -79,6 +84,7 @@ from ._azure_bot_service_enums import ( ChannelName, + EmailChannelAuthMethod, Key, Kind, MsaAppType, @@ -90,7 +96,9 @@ SkuName, SkuTier, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AlexaChannel', 'AlexaChannelProperties', @@ -108,6 +116,8 @@ 'ConnectionSettingParameter', 'ConnectionSettingProperties', 'ConnectionSettingResponseList', + 'CreateEmailSignInUrlResponse', + 'CreateEmailSignInUrlResponseProperties', 'DirectLineChannel', 'DirectLineChannelProperties', 'DirectLineSite', @@ -133,6 +143,7 @@ 'OperationEntity', 'OperationEntityListResult', 'OperationResultsDescription', + 'OutlookChannel', 'PrivateEndpoint', 'PrivateEndpointConnection', 'PrivateEndpointConnectionListResult', @@ -140,6 +151,8 @@ 'PrivateLinkResourceBase', 'PrivateLinkResourceListResult', 'PrivateLinkServiceConnectionState', + 'QnAMakerEndpointKeysRequestBody', + 'QnAMakerEndpointKeysResponse', 'Resource', 'ServiceProvider', 'ServiceProviderParameter', @@ -162,6 +175,7 @@ 'WebChatChannelProperties', 'WebChatSite', 'ChannelName', + 'EmailChannelAuthMethod', 'Key', 'Kind', 'MsaAppType', @@ -173,3 +187,5 @@ 'SkuName', 'SkuTier', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file 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 a30d6334d97e..cc49426f6941 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 @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ChannelName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ChannelName(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALEXA_CHANNEL = "AlexaChannel" FACEBOOK_CHANNEL = "FacebookChannel" @@ -27,15 +26,26 @@ class ChannelName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LINE_CHANNEL = "LineChannel" DIRECT_LINE_SPEECH_CHANNEL = "DirectLineSpeechChannel" OUTLOOK_CHANNEL = "OutlookChannel" + OMNICHANNEL = "Omnichannel" + TELEPHONY_CHANNEL = "TelephonyChannel" -class Key(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EmailChannelAuthMethod(float, Enum, metaclass=CaseInsensitiveEnumMeta): + """Email channel auth method. 0 Password (Default); 1 Graph. + """ + + #: Basic authentication. + PASSWORD = 0 + #: Modern authentication. + GRAPH = 1 + +class Key(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines which key is to be regenerated """ KEY1 = "key1" KEY2 = "key2" -class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Kind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the type of bot service """ @@ -45,7 +55,7 @@ class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FUNCTION = "function" AZUREBOT = "azurebot" -class MsaAppType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class MsaAppType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Microsoft App Type for the bot """ @@ -53,7 +63,7 @@ class MsaAppType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SINGLE_TENANT = "SingleTenant" MULTI_TENANT = "MultiTenant" -class OperationResultStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OperationResultStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the operation being performed. """ @@ -63,7 +73,7 @@ class OperationResultStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REQUESTED = "Requested" RUNNING = "Running" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -72,7 +82,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private endpoint connection status. """ @@ -80,26 +90,26 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumM APPROVED = "Approved" REJECTED = "Rejected" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether the bot is in an isolated network """ ENABLED = "Enabled" DISABLED = "Disabled" -class RegenerateKeysChannelName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RegenerateKeysChannelName(str, Enum, metaclass=CaseInsensitiveEnumMeta): WEB_CHAT_CHANNEL = "WebChatChannel" DIRECT_LINE_CHANNEL = "DirectLineChannel" -class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of SKU. """ F0 = "F0" S1 = "S1" -class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets the sku tier. This is based on the SKU name. """ 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 fe6a4f60da4d..02d78436f467 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 @@ -6,19 +6,21 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._azure_bot_service_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class Channel(msrest.serialization.Model): """Channel definition. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AlexaChannel, DirectLineChannel, DirectLineSpeechChannel, EmailChannel, FacebookChannel, KikChannel, LineChannel, MsTeamsChannel, SkypeChannel, SlackChannel, SmsChannel, TelegramChannel, WebChatChannel. + sub-classes are: AlexaChannel, DirectLineChannel, DirectLineSpeechChannel, EmailChannel, FacebookChannel, KikChannel, LineChannel, MsTeamsChannel, OutlookChannel, SkypeChannel, SlackChannel, SmsChannel, TelegramChannel, WebChatChannel. Variables are only populated by the server, and will be ignored when sending a request. @@ -47,7 +49,7 @@ class Channel(msrest.serialization.Model): } _subtype_map = { - 'channel_name': {'AlexaChannel': 'AlexaChannel', 'DirectLineChannel': 'DirectLineChannel', 'DirectLineSpeechChannel': 'DirectLineSpeechChannel', 'EmailChannel': 'EmailChannel', 'FacebookChannel': 'FacebookChannel', 'KikChannel': 'KikChannel', 'LineChannel': 'LineChannel', 'MsTeamsChannel': 'MsTeamsChannel', 'SkypeChannel': 'SkypeChannel', 'SlackChannel': 'SlackChannel', 'SmsChannel': 'SmsChannel', 'TelegramChannel': 'TelegramChannel', 'WebChatChannel': 'WebChatChannel'} + 'channel_name': {'AlexaChannel': 'AlexaChannel', 'DirectLineChannel': 'DirectLineChannel', 'DirectLineSpeechChannel': 'DirectLineSpeechChannel', 'EmailChannel': 'EmailChannel', 'FacebookChannel': 'FacebookChannel', 'KikChannel': 'KikChannel', 'LineChannel': 'LineChannel', 'MsTeamsChannel': 'MsTeamsChannel', 'OutlookChannel': 'OutlookChannel', 'SkypeChannel': 'SkypeChannel', 'SlackChannel': 'SlackChannel', 'SmsChannel': 'SmsChannel', 'TelegramChannel': 'TelegramChannel', 'WebChatChannel': 'WebChatChannel'} } def __init__( @@ -107,7 +109,7 @@ def __init__( *, etag: Optional[str] = None, location: Optional[str] = "global", - properties: Optional["AlexaChannelProperties"] = None, + properties: Optional["_models.AlexaChannelProperties"] = None, **kwargs ): """ @@ -191,7 +193,7 @@ class Resource(msrest.serialization.Model): :vartype tags: dict[str, str] :ivar sku: Gets or sets the SKU of the resource. :vartype sku: ~azure.mgmt.botservice.models.Sku - :ivar kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", "designer", "bot", "function", "azurebot". :vartype kind: str or ~azure.mgmt.botservice.models.Kind :ivar etag: Entity Tag. @@ -224,8 +226,8 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["Sku"] = None, - kind: Optional[Union[str, "Kind"]] = None, + sku: Optional["_models.Sku"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, etag: Optional[str] = None, **kwargs ): @@ -236,7 +238,7 @@ def __init__( :paramtype tags: dict[str, str] :keyword sku: Gets or sets the SKU of the resource. :paramtype sku: ~azure.mgmt.botservice.models.Sku - :keyword kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :keyword kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", "designer", "bot", "function", "azurebot". :paramtype kind: str or ~azure.mgmt.botservice.models.Kind :keyword etag: Entity Tag. @@ -271,7 +273,7 @@ class Bot(Resource): :vartype tags: dict[str, str] :ivar sku: Gets or sets the SKU of the resource. :vartype sku: ~azure.mgmt.botservice.models.Sku - :ivar kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", "designer", "bot", "function", "azurebot". :vartype kind: str or ~azure.mgmt.botservice.models.Kind :ivar etag: Entity Tag. @@ -307,10 +309,10 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["Sku"] = None, - kind: Optional[Union[str, "Kind"]] = None, + sku: Optional["_models.Sku"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, etag: Optional[str] = None, - properties: Optional["BotProperties"] = None, + properties: Optional["_models.BotProperties"] = None, **kwargs ): """ @@ -320,7 +322,7 @@ def __init__( :paramtype tags: dict[str, str] :keyword sku: Gets or sets the SKU of the resource. :paramtype sku: ~azure.mgmt.botservice.models.Sku - :keyword kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :keyword kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", "designer", "bot", "function", "azurebot". :paramtype kind: str or ~azure.mgmt.botservice.models.Kind :keyword etag: Entity Tag. @@ -349,7 +351,7 @@ class BotChannel(Resource): :vartype tags: dict[str, str] :ivar sku: Gets or sets the SKU of the resource. :vartype sku: ~azure.mgmt.botservice.models.Sku - :ivar kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", "designer", "bot", "function", "azurebot". :vartype kind: str or ~azure.mgmt.botservice.models.Kind :ivar etag: Entity Tag. @@ -385,10 +387,10 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["Sku"] = None, - kind: Optional[Union[str, "Kind"]] = None, + sku: Optional["_models.Sku"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, etag: Optional[str] = None, - properties: Optional["Channel"] = None, + properties: Optional["_models.Channel"] = None, **kwargs ): """ @@ -398,7 +400,7 @@ def __init__( :paramtype tags: dict[str, str] :keyword sku: Gets or sets the SKU of the resource. :paramtype sku: ~azure.mgmt.botservice.models.Sku - :keyword kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :keyword kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", "designer", "bot", "function", "azurebot". :paramtype kind: str or ~azure.mgmt.botservice.models.Kind :keyword etag: Entity Tag. @@ -433,7 +435,7 @@ class BotProperties(msrest.serialization.Model): :vartype parameters: dict[str, str] :ivar manifest_url: The bot's manifest url. :vartype manifest_url: str - :ivar msa_app_type: Microsoft App Type for the bot. Possible values include: "UserAssignedMSI", + :ivar msa_app_type: Microsoft App Type for the bot. Known values are: "UserAssignedMSI", "SingleTenant", "MultiTenant". :vartype msa_app_type: str or ~azure.mgmt.botservice.models.MsaAppType :ivar msa_app_id: Required. Microsoft App Id for the bot. @@ -462,8 +464,10 @@ class BotProperties(msrest.serialization.Model): :vartype cmek_key_vault_url: str :ivar cmek_encryption_status: The CMK encryption status. :vartype cmek_encryption_status: str - :ivar public_network_access: Whether the bot is in an isolated network. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". + :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", "Disabled". Default value: "Enabled". :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 @@ -531,6 +535,7 @@ class BotProperties(msrest.serialization.Model): 'is_cmek_enabled': {'key': 'isCmekEnabled', 'type': 'bool'}, 'cmek_key_vault_url': {'key': 'cmekKeyVaultUrl', 'type': 'str'}, 'cmek_encryption_status': {'key': 'cmekEncryptionStatus', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, 'is_streaming_supported': {'key': 'isStreamingSupported', 'type': 'bool'}, 'is_developer_app_insights_api_key_set': {'key': 'isDeveloperAppInsightsApiKeySet', 'type': 'bool'}, @@ -552,11 +557,11 @@ def __init__( endpoint: str, msa_app_id: str, description: Optional[str] = None, - icon_url: Optional[str] = None, + icon_url: Optional[str] = "", all_settings: Optional[Dict[str, str]] = None, parameters: Optional[Dict[str, str]] = None, manifest_url: Optional[str] = None, - msa_app_type: Optional[Union[str, "MsaAppType"]] = None, + msa_app_type: Optional[Union[str, "_models.MsaAppType"]] = None, msa_app_tenant_id: Optional[str] = None, msa_app_msi_resource_id: Optional[str] = None, developer_app_insight_key: Optional[str] = None, @@ -564,12 +569,13 @@ def __init__( developer_app_insights_application_id: Optional[str] = None, luis_app_ids: Optional[List[str]] = None, luis_key: Optional[str] = None, - is_cmek_enabled: Optional[bool] = None, + is_cmek_enabled: Optional[bool] = False, cmek_key_vault_url: Optional[str] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", + tenant_id: Optional[str] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = "Enabled", is_streaming_supported: Optional[bool] = False, disable_local_auth: Optional[bool] = None, - schema_transformation_version: Optional[str] = None, + schema_transformation_version: Optional[str] = "0.0", storage_resource_id: Optional[str] = None, open_with_hint: Optional[str] = None, app_password_hint: Optional[str] = None, @@ -591,8 +597,8 @@ def __init__( :paramtype parameters: dict[str, str] :keyword manifest_url: The bot's manifest url. :paramtype manifest_url: str - :keyword msa_app_type: Microsoft App Type for the bot. Possible values include: - "UserAssignedMSI", "SingleTenant", "MultiTenant". + :keyword msa_app_type: Microsoft App Type for the bot. Known values are: "UserAssignedMSI", + "SingleTenant", "MultiTenant". :paramtype msa_app_type: str or ~azure.mgmt.botservice.models.MsaAppType :keyword msa_app_id: Required. Microsoft App Id for the bot. :paramtype msa_app_id: str @@ -614,8 +620,10 @@ def __init__( :paramtype is_cmek_enabled: bool :keyword cmek_key_vault_url: The CMK Url. :paramtype cmek_key_vault_url: str - :keyword public_network_access: Whether the bot is in an isolated network. Possible values - include: "Enabled", "Disabled". Default value: "Enabled". + :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", "Disabled". Default value: "Enabled". :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 @@ -658,6 +666,7 @@ def __init__( self.is_cmek_enabled = is_cmek_enabled self.cmek_key_vault_url = cmek_key_vault_url self.cmek_encryption_status = None + self.tenant_id = tenant_id self.public_network_access = public_network_access self.is_streaming_supported = is_streaming_supported self.is_developer_app_insights_api_key_set = None @@ -673,7 +682,7 @@ def __init__( class BotResponseList(msrest.serialization.Model): - """The list of bot service operation response. + """The list of bot service operation response. Variables are only populated by the server, and will be ignored when sending a request. @@ -745,6 +754,8 @@ def __init__( class ChannelSettings(msrest.serialization.Model): """Channel settings definition. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar extension_key1: The extensionKey1. :vartype extension_key1: str :ivar extension_key2: The extensionKey2. @@ -766,6 +777,11 @@ class ChannelSettings(msrest.serialization.Model): :vartype disable_local_auth: bool """ + _validation = { + 'extension_key1': {'readonly': True}, + 'extension_key2': {'readonly': True}, + } + _attribute_map = { 'extension_key1': {'key': 'extensionKey1', 'type': 'str'}, 'extension_key2': {'key': 'extensionKey2', 'type': 'str'}, @@ -781,9 +797,7 @@ class ChannelSettings(msrest.serialization.Model): def __init__( self, *, - extension_key1: Optional[str] = None, - extension_key2: Optional[str] = None, - sites: Optional[List["Site"]] = None, + sites: Optional[List["_models.Site"]] = None, channel_id: Optional[str] = None, channel_display_name: Optional[str] = None, bot_id: Optional[str] = None, @@ -793,10 +807,6 @@ def __init__( **kwargs ): """ - :keyword extension_key1: The extensionKey1. - :paramtype extension_key1: str - :keyword extension_key2: The extensionKey2. - :paramtype extension_key2: str :keyword sites: The list of sites. :paramtype sites: list[~azure.mgmt.botservice.models.Site] :keyword channel_id: The channel id. @@ -814,8 +824,8 @@ def __init__( :paramtype disable_local_auth: bool """ super(ChannelSettings, self).__init__(**kwargs) - self.extension_key1 = extension_key1 - self.extension_key2 = extension_key2 + self.extension_key1 = None + self.extension_key2 = None self.sites = sites self.channel_id = channel_id self.channel_display_name = channel_display_name @@ -935,7 +945,7 @@ class ConnectionSetting(Resource): :vartype tags: dict[str, str] :ivar sku: Gets or sets the SKU of the resource. :vartype sku: ~azure.mgmt.botservice.models.Sku - :ivar kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", "designer", "bot", "function", "azurebot". :vartype kind: str or ~azure.mgmt.botservice.models.Kind :ivar etag: Entity Tag. @@ -971,10 +981,10 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["Sku"] = None, - kind: Optional[Union[str, "Kind"]] = None, + sku: Optional["_models.Sku"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, etag: Optional[str] = None, - properties: Optional["ConnectionSettingProperties"] = None, + properties: Optional["_models.ConnectionSettingProperties"] = None, **kwargs ): """ @@ -984,7 +994,7 @@ def __init__( :paramtype tags: dict[str, str] :keyword sku: Gets or sets the SKU of the resource. :paramtype sku: ~azure.mgmt.botservice.models.Sku - :keyword kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :keyword kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", "designer", "bot", "function", "azurebot". :paramtype kind: str or ~azure.mgmt.botservice.models.Kind :keyword etag: Entity Tag. @@ -1083,7 +1093,7 @@ def __init__( scopes: Optional[str] = None, service_provider_id: Optional[str] = None, service_provider_display_name: Optional[str] = None, - parameters: Optional[List["ConnectionSettingParameter"]] = None, + parameters: Optional[List["_models.ConnectionSettingParameter"]] = None, provisioning_state: Optional[str] = None, **kwargs ): @@ -1158,6 +1168,73 @@ def __init__( self.value = None +class CreateEmailSignInUrlResponse(msrest.serialization.Model): + """The ARM create email sign in url operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Specifies the resource ID. + :vartype id: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to sign in url. + :vartype properties: ~azure.mgmt.botservice.models.CreateEmailSignInUrlResponseProperties + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CreateEmailSignInUrlResponseProperties'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + properties: Optional["_models.CreateEmailSignInUrlResponseProperties"] = None, + **kwargs + ): + """ + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to sign in url. + :paramtype properties: ~azure.mgmt.botservice.models.CreateEmailSignInUrlResponseProperties + """ + super(CreateEmailSignInUrlResponse, self).__init__(**kwargs) + self.id = None + self.location = location + self.properties = properties + + +class CreateEmailSignInUrlResponseProperties(msrest.serialization.Model): + """The set of properties specific to sign in url. + + :ivar url: Sign in url. + :vartype url: str + """ + + _attribute_map = { + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + **kwargs + ): + """ + :keyword url: Sign in url. + :paramtype url: str + """ + super(CreateEmailSignInUrlResponseProperties, self).__init__(**kwargs) + self.url = url + + class DirectLineChannel(Channel): """Direct Line channel definition. @@ -1195,7 +1272,7 @@ def __init__( *, etag: Optional[str] = None, location: Optional[str] = "global", - properties: Optional["DirectLineChannelProperties"] = None, + properties: Optional["_models.DirectLineChannelProperties"] = None, **kwargs ): """ @@ -1214,21 +1291,34 @@ def __init__( class DirectLineChannelProperties(msrest.serialization.Model): """The parameters to provide for the Direct Line channel. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar sites: The list of Direct Line sites. :vartype sites: list[~azure.mgmt.botservice.models.DirectLineSite] + :ivar extension_key1: The extensionKey1. + :vartype extension_key1: str + :ivar extension_key2: The extensionKey2. + :vartype extension_key2: str :ivar direct_line_embed_code: Direct Line embed code of the resource. :vartype direct_line_embed_code: str """ + _validation = { + 'extension_key1': {'readonly': True}, + 'extension_key2': {'readonly': True}, + } + _attribute_map = { 'sites': {'key': 'sites', 'type': '[DirectLineSite]'}, + 'extension_key1': {'key': 'extensionKey1', 'type': 'str'}, + 'extension_key2': {'key': 'extensionKey2', 'type': 'str'}, 'direct_line_embed_code': {'key': 'DirectLineEmbedCode', 'type': 'str'}, } def __init__( self, *, - sites: Optional[List["DirectLineSite"]] = None, + sites: Optional[List["_models.DirectLineSite"]] = None, direct_line_embed_code: Optional[str] = None, **kwargs ): @@ -1240,11 +1330,13 @@ def __init__( """ super(DirectLineChannelProperties, self).__init__(**kwargs) self.sites = sites + self.extension_key1 = None + self.extension_key2 = None self.direct_line_embed_code = direct_line_embed_code -class DirectLineSite(msrest.serialization.Model): - """A site for the Direct Line channel. +class Site(msrest.serialization.Model): + """A site for the channel. Variables are only populated by the server, and will be ignored when sending a request. @@ -1262,18 +1354,33 @@ class DirectLineSite(msrest.serialization.Model): :vartype key2: str :ivar is_enabled: Required. Whether this site is enabled for DirectLine channel. :vartype is_enabled: bool - :ivar is_v1_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. + :ivar is_token_enabled: Whether this site is token enabled for channel. + :vartype is_token_enabled: bool + :ivar is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for + channel. + :vartype is_endpoint_parameters_enabled: bool + :ivar is_detailed_logging_enabled: Whether this site is disabled detailed logging for. + :vartype is_detailed_logging_enabled: bool + :ivar is_block_user_upload_enabled: Whether this site is enabled for block user upload. + :vartype is_block_user_upload_enabled: bool + :ivar is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. + :vartype is_no_storage_enabled: bool + :ivar e_tag: Entity Tag. + :vartype e_tag: str + :ivar app_id: DirectLine application id. + :vartype app_id: str + :ivar is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. :vartype is_v1_enabled: bool - :ivar is_v3_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. + :ivar is_v3_enabled: Whether this site is enabled for Bot Framework V1 protocol. :vartype is_v3_enabled: bool :ivar is_secure_site_enabled: Whether this site is enabled for authentication with Bot Framework. :vartype is_secure_site_enabled: bool - :ivar is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :vartype is_block_user_upload_enabled: bool :ivar trusted_origins: List of Trusted Origin URLs for this site. This field is applicable only if isSecureSiteEnabled is True. :vartype trusted_origins: list[str] + :ivar is_webchat_preview_enabled: Whether this site is enabled for preview versions of Webchat. + :vartype is_webchat_preview_enabled: bool """ _validation = { @@ -1282,8 +1389,7 @@ class DirectLineSite(msrest.serialization.Model): 'key': {'readonly': True}, 'key2': {'readonly': True}, 'is_enabled': {'required': True}, - 'is_v1_enabled': {'required': True}, - 'is_v3_enabled': {'required': True}, + 'is_token_enabled': {'readonly': True}, } _attribute_map = { @@ -1292,11 +1398,18 @@ class DirectLineSite(msrest.serialization.Model): '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'}, - 'is_block_user_upload_enabled': {'key': 'isBlockUserUploadEnabled', 'type': 'bool'}, 'trusted_origins': {'key': 'trustedOrigins', 'type': '[str]'}, + 'is_webchat_preview_enabled': {'key': 'isWebchatPreviewEnabled', 'type': 'bool'}, } def __init__( @@ -1304,11 +1417,17 @@ def __init__( *, site_name: str, is_enabled: bool, - is_v1_enabled: bool, - is_v3_enabled: bool, - is_secure_site_enabled: Optional[bool] = 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_webchat_preview_enabled: Optional[bool] = False, **kwargs ): """ @@ -1316,30 +1435,181 @@ def __init__( :paramtype site_name: str :keyword is_enabled: Required. Whether this site is enabled for DirectLine channel. :paramtype is_enabled: bool - :keyword is_v1_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. + :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: Required. Whether this site is enabled for Bot Framework V1 protocol. + :keyword is_v3_enabled: Whether this site is enabled for Bot Framework V1 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 is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :paramtype is_block_user_upload_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_webchat_preview_enabled: Whether this site is enabled for preview versions of + Webchat. + :paramtype is_webchat_preview_enabled: bool """ - super(DirectLineSite, self).__init__(**kwargs) + super(Site, self).__init__(**kwargs) self.site_id = None self.site_name = site_name self.key = None self.key2 = None self.is_enabled = is_enabled + self.is_token_enabled = None + self.is_endpoint_parameters_enabled = is_endpoint_parameters_enabled + self.is_detailed_logging_enabled = is_detailed_logging_enabled + self.is_block_user_upload_enabled = is_block_user_upload_enabled + self.is_no_storage_enabled = is_no_storage_enabled + self.e_tag = e_tag + self.app_id = app_id self.is_v1_enabled = is_v1_enabled self.is_v3_enabled = is_v3_enabled self.is_secure_site_enabled = is_secure_site_enabled - self.is_block_user_upload_enabled = is_block_user_upload_enabled self.trusted_origins = trusted_origins + self.is_webchat_preview_enabled = is_webchat_preview_enabled + + +class DirectLineSite(Site): + """A site for the Direct Line 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. + + :ivar site_id: Site Id. + :vartype site_id: str + :ivar site_name: Required. Site name. + :vartype site_name: str + :ivar key: Primary key. Value only returned through POST to the action Channel List API, + otherwise empty. + :vartype key: str + :ivar key2: Secondary key. Value only returned through POST to the action Channel List API, + otherwise empty. + :vartype key2: str + :ivar is_enabled: Required. Whether this site is enabled for DirectLine channel. + :vartype is_enabled: bool + :ivar is_token_enabled: Whether this site is token enabled for channel. + :vartype is_token_enabled: bool + :ivar is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for + channel. + :vartype is_endpoint_parameters_enabled: bool + :ivar is_detailed_logging_enabled: Whether this site is disabled detailed logging for. + :vartype is_detailed_logging_enabled: bool + :ivar is_block_user_upload_enabled: Whether this site is enabled for block user upload. + :vartype is_block_user_upload_enabled: bool + :ivar is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. + :vartype is_no_storage_enabled: bool + :ivar e_tag: Entity Tag. + :vartype e_tag: str + :ivar app_id: DirectLine application id. + :vartype app_id: str + :ivar is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. + :vartype is_v1_enabled: bool + :ivar is_v3_enabled: Whether this site is enabled for Bot Framework V1 protocol. + :vartype is_v3_enabled: bool + :ivar is_secure_site_enabled: Whether this site is enabled for authentication with Bot + Framework. + :vartype is_secure_site_enabled: bool + :ivar trusted_origins: List of Trusted Origin URLs for this site. This field is applicable only + if isSecureSiteEnabled is True. + :vartype trusted_origins: list[str] + :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 = { + '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_webchat_preview_enabled': {'key': 'isWebchatPreviewEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + site_name: str, + is_enabled: bool, + 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_webchat_preview_enabled: Optional[bool] = False, + **kwargs + ): + """ + :keyword site_name: Required. Site name. + :paramtype site_name: str + :keyword is_enabled: Required. Whether this site is enabled for DirectLine channel. + :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 V1 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_webchat_preview_enabled: Whether this site is enabled for preview versions of + Webchat. + :paramtype is_webchat_preview_enabled: bool + """ + super(DirectLineSite, self).__init__(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_webchat_preview_enabled=is_webchat_preview_enabled, **kwargs) class DirectLineSpeechChannel(Channel): @@ -1379,7 +1649,7 @@ def __init__( *, etag: Optional[str] = None, location: Optional[str] = "global", - properties: Optional["DirectLineSpeechChannelProperties"] = None, + properties: Optional["_models.DirectLineSpeechChannelProperties"] = None, **kwargs ): """ @@ -1398,13 +1668,12 @@ def __init__( class DirectLineSpeechChannelProperties(msrest.serialization.Model): """The parameters to provide for the DirectLine Speech channel. - All required parameters must be populated in order to send to Azure. - - :ivar cognitive_service_region: Required. The cognitive service region with this channel - registration. + :ivar cognitive_service_resource_id: The cognitive service id with this channel registration. + :vartype cognitive_service_resource_id: str + :ivar cognitive_service_region: The cognitive service region with this channel registration. :vartype cognitive_service_region: str - :ivar cognitive_service_subscription_key: Required. The cognitive service subscription key to - use with this channel registration. + :ivar cognitive_service_subscription_key: The cognitive service subscription key to use with + this channel registration. :vartype cognitive_service_subscription_key: str :ivar is_enabled: Whether this channel is enabled or not. :vartype is_enabled: bool @@ -1417,12 +1686,8 @@ class DirectLineSpeechChannelProperties(msrest.serialization.Model): :vartype is_default_bot_for_cog_svc_account: bool """ - _validation = { - 'cognitive_service_region': {'required': True}, - 'cognitive_service_subscription_key': {'required': True}, - } - _attribute_map = { + 'cognitive_service_resource_id': {'key': 'cognitiveServiceResourceId', 'type': 'str'}, 'cognitive_service_region': {'key': 'cognitiveServiceRegion', 'type': 'str'}, 'cognitive_service_subscription_key': {'key': 'cognitiveServiceSubscriptionKey', 'type': 'str'}, 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, @@ -1434,8 +1699,9 @@ class DirectLineSpeechChannelProperties(msrest.serialization.Model): def __init__( self, *, - cognitive_service_region: str, - cognitive_service_subscription_key: str, + cognitive_service_resource_id: Optional[str] = None, + cognitive_service_region: Optional[str] = None, + cognitive_service_subscription_key: Optional[str] = None, is_enabled: Optional[bool] = None, custom_voice_deployment_id: Optional[str] = None, custom_speech_model_id: Optional[str] = None, @@ -1443,11 +1709,13 @@ def __init__( **kwargs ): """ - :keyword cognitive_service_region: Required. The cognitive service region with this channel + :keyword cognitive_service_resource_id: The cognitive service id with this channel registration. + :paramtype cognitive_service_resource_id: str + :keyword cognitive_service_region: The cognitive service region with this channel registration. :paramtype cognitive_service_region: str - :keyword cognitive_service_subscription_key: Required. The cognitive service subscription key - to use with this channel registration. + :keyword cognitive_service_subscription_key: The cognitive service subscription key to use with + this channel registration. :paramtype cognitive_service_subscription_key: str :keyword is_enabled: Whether this channel is enabled or not. :paramtype is_enabled: bool @@ -1460,6 +1728,7 @@ def __init__( :paramtype is_default_bot_for_cog_svc_account: bool """ super(DirectLineSpeechChannelProperties, self).__init__(**kwargs) + self.cognitive_service_resource_id = cognitive_service_resource_id self.cognitive_service_region = cognitive_service_region self.cognitive_service_subscription_key = cognitive_service_subscription_key self.is_enabled = is_enabled @@ -1505,7 +1774,7 @@ def __init__( *, etag: Optional[str] = None, location: Optional[str] = "global", - properties: Optional["EmailChannelProperties"] = None, + properties: Optional["_models.EmailChannelProperties"] = None, **kwargs ): """ @@ -1528,9 +1797,14 @@ class EmailChannelProperties(msrest.serialization.Model): :ivar email_address: Required. The email address. :vartype email_address: str + :ivar auth_method: Email channel auth method. 0 Password (Default); 1 Graph. Known values are: + 0, 1. + :vartype auth_method: float or ~azure.mgmt.botservice.models.EmailChannelAuthMethod :ivar password: The password for the email address. Value only returned through POST to the action Channel List API, otherwise empty. :vartype password: str + :ivar magic_code: The magic code for setting up the modern authentication. + :vartype magic_code: str :ivar is_enabled: Required. Whether this channel is enabled for the bot. :vartype is_enabled: bool """ @@ -1542,7 +1816,9 @@ class EmailChannelProperties(msrest.serialization.Model): _attribute_map = { 'email_address': {'key': 'emailAddress', 'type': 'str'}, + 'auth_method': {'key': 'authMethod', 'type': 'float'}, 'password': {'key': 'password', 'type': 'str'}, + 'magic_code': {'key': 'magicCode', 'type': 'str'}, 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, } @@ -1551,21 +1827,30 @@ def __init__( *, email_address: str, is_enabled: bool, + auth_method: Optional[Union[float, "_models.EmailChannelAuthMethod"]] = None, password: Optional[str] = None, + magic_code: Optional[str] = None, **kwargs ): """ :keyword email_address: Required. The email address. :paramtype email_address: str + :keyword auth_method: Email channel auth method. 0 Password (Default); 1 Graph. Known values + are: 0, 1. + :paramtype auth_method: float or ~azure.mgmt.botservice.models.EmailChannelAuthMethod :keyword password: The password for the email address. Value only returned through POST to the action Channel List API, otherwise empty. :paramtype password: str + :keyword magic_code: The magic code for setting up the modern authentication. + :paramtype magic_code: str :keyword is_enabled: Required. Whether this channel is enabled for the bot. :paramtype is_enabled: bool """ super(EmailChannelProperties, self).__init__(**kwargs) self.email_address = email_address + self.auth_method = auth_method self.password = password + self.magic_code = magic_code self.is_enabled = is_enabled @@ -1583,7 +1868,7 @@ class Error(msrest.serialization.Model): def __init__( self, *, - error: Optional["ErrorBody"] = None, + error: Optional["_models.ErrorBody"] = None, **kwargs ): """ @@ -1670,7 +1955,7 @@ def __init__( *, etag: Optional[str] = None, location: Optional[str] = "global", - properties: Optional["FacebookChannelProperties"] = None, + properties: Optional["_models.FacebookChannelProperties"] = None, **kwargs ): """ @@ -1730,7 +2015,7 @@ def __init__( *, app_id: str, is_enabled: bool, - pages: Optional[List["FacebookPage"]] = None, + pages: Optional[List["_models.FacebookPage"]] = None, app_secret: Optional[str] = None, **kwargs ): @@ -1909,7 +2194,7 @@ def __init__( *, etag: Optional[str] = None, location: Optional[str] = "global", - properties: Optional["KikChannelProperties"] = None, + properties: Optional["_models.KikChannelProperties"] = None, **kwargs ): """ @@ -2017,7 +2302,7 @@ def __init__( *, etag: Optional[str] = None, location: Optional[str] = "global", - properties: Optional["LineChannelProperties"] = None, + properties: Optional["_models.LineChannelProperties"] = None, **kwargs ): """ @@ -2063,7 +2348,7 @@ class LineChannelProperties(msrest.serialization.Model): def __init__( self, *, - line_registrations: List["LineRegistration"], + line_registrations: List["_models.LineRegistration"], **kwargs ): """ @@ -2135,7 +2420,7 @@ class ListChannelWithKeysResponse(BotChannel): :vartype tags: dict[str, str] :ivar sku: Gets or sets the SKU of the resource. :vartype sku: ~azure.mgmt.botservice.models.Sku - :ivar kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", "designer", "bot", "function", "azurebot". :vartype kind: str or ~azure.mgmt.botservice.models.Kind :ivar etag: Entity Tag. @@ -2186,12 +2471,12 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["Sku"] = None, - kind: Optional[Union[str, "Kind"]] = None, + sku: Optional["_models.Sku"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, etag: Optional[str] = None, - properties: Optional["Channel"] = None, - resource: Optional["Channel"] = None, - setting: Optional["ChannelSettings"] = None, + properties: Optional["_models.Channel"] = None, + resource: Optional["_models.Channel"] = None, + setting: Optional["_models.ChannelSettings"] = None, provisioning_state: Optional[str] = None, entity_tag: Optional[str] = None, changed_time: Optional[str] = None, @@ -2204,7 +2489,7 @@ def __init__( :paramtype tags: dict[str, str] :keyword sku: Gets or sets the SKU of the resource. :paramtype sku: ~azure.mgmt.botservice.models.Sku - :keyword kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :keyword kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", "designer", "bot", "function", "azurebot". :paramtype kind: str or ~azure.mgmt.botservice.models.Kind :keyword etag: Entity Tag. @@ -2267,7 +2552,7 @@ def __init__( *, etag: Optional[str] = None, location: Optional[str] = "global", - properties: Optional["MsTeamsChannelProperties"] = None, + properties: Optional["_models.MsTeamsChannelProperties"] = None, **kwargs ): """ @@ -2290,8 +2575,8 @@ class MsTeamsChannelProperties(msrest.serialization.Model): :ivar enable_calling: Enable calling for Microsoft Teams channel. :vartype enable_calling: bool - :ivar calling_web_hook: Webhook for Microsoft Teams channel calls. - :vartype calling_web_hook: str + :ivar calling_webhook: Webhook for Microsoft Teams channel calls. + :vartype calling_webhook: str :ivar is_enabled: Required. Whether this channel is enabled for the bot. :vartype is_enabled: bool :ivar incoming_call_route: Webhook for Microsoft Teams channel calls. @@ -2308,7 +2593,7 @@ class MsTeamsChannelProperties(msrest.serialization.Model): _attribute_map = { 'enable_calling': {'key': 'enableCalling', 'type': 'bool'}, - 'calling_web_hook': {'key': 'callingWebHook', 'type': 'str'}, + 'calling_webhook': {'key': 'callingWebhook', 'type': 'str'}, 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, 'incoming_call_route': {'key': 'incomingCallRoute', 'type': 'str'}, 'deployment_environment': {'key': 'deploymentEnvironment', 'type': 'str'}, @@ -2319,18 +2604,18 @@ def __init__( self, *, is_enabled: bool, - enable_calling: Optional[bool] = None, - calling_web_hook: Optional[str] = None, + enable_calling: Optional[bool] = False, + calling_webhook: Optional[str] = None, incoming_call_route: Optional[str] = None, - deployment_environment: Optional[str] = None, + deployment_environment: Optional[str] = "FallbackDeploymentEnvironment", accepted_terms: Optional[bool] = None, **kwargs ): """ :keyword enable_calling: Enable calling for Microsoft Teams channel. :paramtype enable_calling: bool - :keyword calling_web_hook: Webhook for Microsoft Teams channel calls. - :paramtype calling_web_hook: str + :keyword calling_webhook: Webhook for Microsoft Teams channel calls. + :paramtype calling_webhook: str :keyword is_enabled: Required. Whether this channel is enabled for the bot. :paramtype is_enabled: bool :keyword incoming_call_route: Webhook for Microsoft Teams channel calls. @@ -2342,7 +2627,7 @@ def __init__( """ super(MsTeamsChannelProperties, self).__init__(**kwargs) self.enable_calling = enable_calling - self.calling_web_hook = calling_web_hook + self.calling_webhook = calling_webhook self.is_enabled = is_enabled self.incoming_call_route = incoming_call_route self.deployment_environment = deployment_environment @@ -2419,7 +2704,7 @@ def __init__( self, *, name: Optional[str] = None, - display: Optional["OperationDisplayInfo"] = None, + display: Optional["_models.OperationDisplayInfo"] = None, origin: Optional[str] = None, properties: Optional[Any] = None, **kwargs @@ -2459,7 +2744,7 @@ def __init__( self, *, next_link: Optional[str] = None, - value: Optional[List["OperationEntity"]] = None, + value: Optional[List["_models.OperationEntity"]] = None, **kwargs ): """ @@ -2482,7 +2767,7 @@ class OperationResultsDescription(msrest.serialization.Model): :vartype id: str :ivar name: The name of the operation result. :vartype name: str - :ivar status: The status of the operation being performed. Possible values include: "Canceled", + :ivar status: The status of the operation being performed. Known values are: "Canceled", "Succeeded", "Failed", "Requested", "Running". :vartype status: str or ~azure.mgmt.botservice.models.OperationResultStatus :ivar start_time: The time that the operation was started. @@ -2516,6 +2801,52 @@ def __init__( self.start_time = None +class OutlookChannel(Channel): + """Outlook 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. + + :ivar channel_name: Required. The channel name.Constant filled by server. + :vartype channel_name: str + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + """ + + _validation = { + 'channel_name': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'channel_name': {'key': 'channelName', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = "global", + **kwargs + ): + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + """ + super(OutlookChannel, self).__init__(etag=etag, location=location, **kwargs) + self.channel_name = 'OutlookChannel' # type: str + + class PrivateEndpoint(msrest.serialization.Model): """The Private Endpoint resource. @@ -2602,7 +2933,7 @@ class PrivateEndpointConnection(PrivateLinkResourceBase): :vartype private_link_service_connection_state: ~azure.mgmt.botservice.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.botservice.models.PrivateEndpointConnectionProvisioningState """ @@ -2626,8 +2957,8 @@ class PrivateEndpointConnection(PrivateLinkResourceBase): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -2658,7 +2989,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -2737,7 +3068,7 @@ class PrivateLinkResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -2752,7 +3083,7 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """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. Possible values include: "Pending", "Approved", "Rejected". + of the service. Known values are: "Pending", "Approved", "Rejected". :vartype status: str or ~azure.mgmt.botservice.models.PrivateEndpointServiceConnectionStatus :ivar description: The reason for approval/rejection of the connection. :vartype description: str @@ -2770,14 +3101,14 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, actions_required: Optional[str] = None, **kwargs ): """ :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Possible values include: "Pending", "Approved", "Rejected". + owner of the service. Known values are: "Pending", "Approved", "Rejected". :paramtype status: str or ~azure.mgmt.botservice.models.PrivateEndpointServiceConnectionStatus :keyword description: The reason for approval/rejection of the connection. :paramtype description: str @@ -2791,33 +3122,111 @@ def __init__( self.actions_required = actions_required -class ServiceProvider(msrest.serialization.Model): - """Service Provider Definition. +class QnAMakerEndpointKeysRequestBody(msrest.serialization.Model): + """The request body for a request to Bot Service Management to list QnA Maker endpoint keys. - :ivar properties: The Properties of a Service Provider Object. - :vartype properties: ~azure.mgmt.botservice.models.ServiceProviderProperties + :ivar hostname: the host name of the QnA Maker endpoint. + :vartype hostname: str + :ivar authkey: Subscription key which provides access to this API. + :vartype authkey: str """ _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ServiceProviderProperties'}, + 'hostname': {'key': 'hostname', 'type': 'str'}, + 'authkey': {'key': 'authkey', 'type': 'str'}, } def __init__( self, *, - properties: Optional["ServiceProviderProperties"] = None, + hostname: Optional[str] = None, + authkey: Optional[str] = None, **kwargs ): """ - :keyword properties: The Properties of a Service Provider Object. - :paramtype properties: ~azure.mgmt.botservice.models.ServiceProviderProperties + :keyword hostname: the host name of the QnA Maker endpoint. + :paramtype hostname: str + :keyword authkey: Subscription key which provides access to this API. + :paramtype authkey: str """ - super(ServiceProvider, self).__init__(**kwargs) - self.properties = properties + super(QnAMakerEndpointKeysRequestBody, self).__init__(**kwargs) + self.hostname = hostname + self.authkey = authkey -class ServiceProviderParameter(msrest.serialization.Model): - """Extra Parameters specific to each Service Provider. +class QnAMakerEndpointKeysResponse(msrest.serialization.Model): + """Schema for EndpointKeys generate/refresh operations. + + :ivar primary_endpoint_key: Primary Access Key. + :vartype primary_endpoint_key: str + :ivar secondary_endpoint_key: Secondary Access Key. + :vartype secondary_endpoint_key: str + :ivar installed_version: Current version of runtime. + :vartype installed_version: str + :ivar last_stable_version: Latest version of runtime. + :vartype last_stable_version: str + """ + + _attribute_map = { + 'primary_endpoint_key': {'key': 'primaryEndpointKey', 'type': 'str'}, + 'secondary_endpoint_key': {'key': 'secondaryEndpointKey', 'type': 'str'}, + 'installed_version': {'key': 'installedVersion', 'type': 'str'}, + 'last_stable_version': {'key': 'lastStableVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + primary_endpoint_key: Optional[str] = None, + secondary_endpoint_key: Optional[str] = None, + installed_version: Optional[str] = None, + last_stable_version: Optional[str] = None, + **kwargs + ): + """ + :keyword primary_endpoint_key: Primary Access Key. + :paramtype primary_endpoint_key: str + :keyword secondary_endpoint_key: Secondary Access Key. + :paramtype secondary_endpoint_key: str + :keyword installed_version: Current version of runtime. + :paramtype installed_version: str + :keyword last_stable_version: Latest version of runtime. + :paramtype last_stable_version: str + """ + super(QnAMakerEndpointKeysResponse, self).__init__(**kwargs) + self.primary_endpoint_key = primary_endpoint_key + self.secondary_endpoint_key = secondary_endpoint_key + self.installed_version = installed_version + self.last_stable_version = last_stable_version + + +class ServiceProvider(msrest.serialization.Model): + """Service Provider Definition. + + :ivar properties: The Properties of a Service Provider Object. + :vartype properties: ~azure.mgmt.botservice.models.ServiceProviderProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'ServiceProviderProperties'}, + } + + def __init__( + self, + *, + properties: Optional["_models.ServiceProviderProperties"] = None, + **kwargs + ): + """ + :keyword properties: The Properties of a Service Provider Object. + :paramtype properties: ~azure.mgmt.botservice.models.ServiceProviderProperties + """ + super(ServiceProvider, self).__init__(**kwargs) + self.properties = properties + + +class ServiceProviderParameter(msrest.serialization.Model): + """Extra Parameters specific to each Service Provider. Variables are only populated by the server, and will be ignored when sending a request. @@ -2887,7 +3296,7 @@ class ServiceProviderParameterMetadata(msrest.serialization.Model): def __init__( self, *, - constraints: Optional["ServiceProviderParameterMetadataConstraints"] = None, + constraints: Optional["_models.ServiceProviderParameterMetadataConstraints"] = None, **kwargs ): """ @@ -2963,7 +3372,7 @@ class ServiceProviderProperties(msrest.serialization.Model): def __init__( self, *, - parameters: Optional[List["ServiceProviderParameter"]] = None, + parameters: Optional[List["_models.ServiceProviderParameter"]] = None, **kwargs ): """ @@ -3014,199 +3423,6 @@ def __init__( self.value = None -class WebChatSite(msrest.serialization.Model): - """A site for the Webchat 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. - - :ivar site_id: Site Id. - :vartype site_id: str - :ivar site_name: Required. Site name. - :vartype site_name: str - :ivar key: Primary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key: str - :ivar key2: Secondary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key2: str - :ivar is_enabled: Required. Whether this site is enabled for DirectLine channel. - :vartype is_enabled: bool - :ivar is_webchat_preview_enabled: Required. 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_webchat_preview_enabled': {'required': True}, - } - - _attribute_map = { - '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_webchat_preview_enabled': {'key': 'isWebchatPreviewEnabled', 'type': 'bool'}, - } - - def __init__( - self, - *, - site_name: str, - is_enabled: bool, - is_webchat_preview_enabled: bool, - **kwargs - ): - """ - :keyword site_name: Required. Site name. - :paramtype site_name: str - :keyword is_enabled: Required. Whether this site is enabled for DirectLine channel. - :paramtype is_enabled: bool - :keyword is_webchat_preview_enabled: Required. Whether this site is enabled for preview - versions of Webchat. - :paramtype is_webchat_preview_enabled: bool - """ - super(WebChatSite, self).__init__(**kwargs) - self.site_id = None - self.site_name = site_name - self.key = None - self.key2 = None - self.is_enabled = is_enabled - self.is_webchat_preview_enabled = is_webchat_preview_enabled - - -class Site(WebChatSite, DirectLineSite): - """A site for the 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. - - :ivar is_v1_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :vartype is_v1_enabled: bool - :ivar is_v3_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :vartype is_v3_enabled: bool - :ivar is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :vartype is_secure_site_enabled: bool - :ivar is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :vartype is_block_user_upload_enabled: bool - :ivar trusted_origins: List of Trusted Origin URLs for this site. This field is applicable only - if isSecureSiteEnabled is True. - :vartype trusted_origins: list[str] - :ivar site_id: Site Id. - :vartype site_id: str - :ivar site_name: Required. Site name. - :vartype site_name: str - :ivar key: Primary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key: str - :ivar key2: Secondary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key2: str - :ivar is_enabled: Required. Whether this site is enabled for DirectLine channel. - :vartype is_enabled: bool - :ivar is_webchat_preview_enabled: Required. Whether this site is enabled for preview versions - of Webchat. - :vartype is_webchat_preview_enabled: bool - :ivar is_token_enabled: Whether this site is token enabled for channel. - :vartype is_token_enabled: bool - :ivar e_tag: Entity Tag. - :vartype e_tag: str - """ - - _validation = { - 'is_v1_enabled': {'required': True}, - 'is_v3_enabled': {'required': True}, - 'site_id': {'readonly': True}, - 'site_name': {'required': True}, - 'key': {'readonly': True}, - 'key2': {'readonly': True}, - 'is_enabled': {'required': True}, - 'is_webchat_preview_enabled': {'required': True}, - } - - _attribute_map = { - 'is_v1_enabled': {'key': 'isV1Enabled', 'type': 'bool'}, - 'is_v3_enabled': {'key': 'isV3Enabled', 'type': 'bool'}, - 'is_secure_site_enabled': {'key': 'isSecureSiteEnabled', 'type': 'bool'}, - 'is_block_user_upload_enabled': {'key': 'isBlockUserUploadEnabled', 'type': 'bool'}, - 'trusted_origins': {'key': 'trustedOrigins', '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_webchat_preview_enabled': {'key': 'isWebchatPreviewEnabled', 'type': 'bool'}, - 'is_token_enabled': {'key': 'isTokenEnabled', 'type': 'bool'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, - } - - def __init__( - self, - *, - is_v1_enabled: bool, - is_v3_enabled: bool, - site_name: str, - is_enabled: bool, - is_webchat_preview_enabled: bool, - is_secure_site_enabled: Optional[bool] = None, - is_block_user_upload_enabled: Optional[bool] = None, - trusted_origins: Optional[List[str]] = None, - is_token_enabled: Optional[bool] = None, - e_tag: Optional[str] = None, - **kwargs - ): - """ - :keyword is_v1_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :paramtype is_v1_enabled: bool - :keyword is_v3_enabled: Required. Whether this site is enabled for Bot Framework V1 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 is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :paramtype is_block_user_upload_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 site_name: Required. Site name. - :paramtype site_name: str - :keyword is_enabled: Required. Whether this site is enabled for DirectLine channel. - :paramtype is_enabled: bool - :keyword is_webchat_preview_enabled: Required. Whether this site is enabled for preview - versions of Webchat. - :paramtype is_webchat_preview_enabled: bool - :keyword is_token_enabled: Whether this site is token enabled for channel. - :paramtype is_token_enabled: bool - :keyword e_tag: Entity Tag. - :paramtype e_tag: str - """ - super(Site, self).__init__(site_name=site_name, is_enabled=is_enabled, is_webchat_preview_enabled=is_webchat_preview_enabled, is_v1_enabled=is_v1_enabled, is_v3_enabled=is_v3_enabled, is_secure_site_enabled=is_secure_site_enabled, is_block_user_upload_enabled=is_block_user_upload_enabled, trusted_origins=trusted_origins, **kwargs) - self.is_v1_enabled = is_v1_enabled - self.is_v3_enabled = is_v3_enabled - self.is_secure_site_enabled = is_secure_site_enabled - self.is_block_user_upload_enabled = is_block_user_upload_enabled - self.trusted_origins = trusted_origins - self.is_token_enabled = is_token_enabled - self.e_tag = e_tag - self.site_id = None - self.site_name = site_name - self.key = None - self.key2 = None - self.is_enabled = is_enabled - self.is_webchat_preview_enabled = is_webchat_preview_enabled - self.is_token_enabled = is_token_enabled - self.e_tag = e_tag - - class SiteInfo(msrest.serialization.Model): """Site information for WebChat or DirectLine Channels to identify which site to regenerate keys for. @@ -3214,8 +3430,8 @@ class SiteInfo(msrest.serialization.Model): :ivar site_name: Required. The site name. :vartype site_name: str - :ivar key: Required. Determines which key is to be regenerated. Possible values include: - "key1", "key2". + :ivar key: Required. Determines which key is to be regenerated. Known values are: "key1", + "key2". :vartype key: str or ~azure.mgmt.botservice.models.Key """ @@ -3233,14 +3449,14 @@ def __init__( self, *, site_name: str, - key: Union[str, "Key"], + key: Union[str, "_models.Key"], **kwargs ): """ :keyword site_name: Required. The site name. :paramtype site_name: str - :keyword key: Required. Determines which key is to be regenerated. Possible values include: - "key1", "key2". + :keyword key: Required. Determines which key is to be regenerated. Known values are: "key1", + "key2". :paramtype key: str or ~azure.mgmt.botservice.models.Key """ super(SiteInfo, self).__init__(**kwargs) @@ -3255,9 +3471,9 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Required. The sku name. Possible values include: "F0", "S1". + :ivar name: Required. The sku name. Known values are: "F0", "S1". :vartype name: str or ~azure.mgmt.botservice.models.SkuName - :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: "Free", + :ivar tier: Gets the sku tier. This is based on the SKU name. Known values are: "Free", "Standard". :vartype tier: str or ~azure.mgmt.botservice.models.SkuTier """ @@ -3275,11 +3491,11 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - name: Union[str, "SkuName"], + name: Union[str, "_models.SkuName"], **kwargs ): """ - :keyword name: Required. The sku name. Possible values include: "F0", "S1". + :keyword name: Required. The sku name. Known values are: "F0", "S1". :paramtype name: str or ~azure.mgmt.botservice.models.SkuName """ super(Sku, self).__init__(**kwargs) @@ -3324,7 +3540,7 @@ def __init__( *, etag: Optional[str] = None, location: Optional[str] = "global", - properties: Optional["SkypeChannelProperties"] = None, + properties: Optional["_models.SkypeChannelProperties"] = None, **kwargs ): """ @@ -3391,7 +3607,7 @@ def __init__( enable_messaging: Optional[bool] = None, enable_media_cards: Optional[bool] = None, enable_video: Optional[bool] = None, - enable_calling: Optional[bool] = None, + enable_calling: Optional[bool] = False, enable_screen_sharing: Optional[bool] = None, enable_groups: Optional[bool] = None, groups_mode: Optional[str] = None, @@ -3471,7 +3687,7 @@ def __init__( *, etag: Optional[str] = None, location: Optional[str] = "global", - properties: Optional["SlackChannelProperties"] = None, + properties: Optional["_models.SlackChannelProperties"] = None, **kwargs ): """ @@ -3524,7 +3740,6 @@ class SlackChannelProperties(msrest.serialization.Model): _validation = { 'redirect_action': {'readonly': True}, 'last_submission_id': {'readonly': True}, - 'register_before_o_auth_flow': {'readonly': True}, 'is_validated': {'readonly': True}, 'is_enabled': {'required': True}, } @@ -3552,6 +3767,7 @@ def __init__( verification_token: Optional[str] = None, scopes: Optional[str] = None, landing_page_url: Optional[str] = None, + register_before_o_auth_flow: Optional[bool] = None, signing_secret: Optional[str] = None, **kwargs ): @@ -3568,6 +3784,9 @@ def __init__( :paramtype scopes: str :keyword landing_page_url: The Slack landing page Url. :paramtype landing_page_url: str + :keyword register_before_o_auth_flow: Whether to register the settings before OAuth validation + is performed. Recommended to True. + :paramtype register_before_o_auth_flow: bool :keyword signing_secret: The Slack signing secret. :paramtype signing_secret: str :keyword is_enabled: Required. Whether this channel is enabled for the bot. @@ -3581,7 +3800,7 @@ def __init__( self.landing_page_url = landing_page_url self.redirect_action = None self.last_submission_id = None - self.register_before_o_auth_flow = None + self.register_before_o_auth_flow = register_before_o_auth_flow self.is_validated = None self.signing_secret = signing_secret self.is_enabled = is_enabled @@ -3624,7 +3843,7 @@ def __init__( *, etag: Optional[str] = None, location: Optional[str] = "global", - properties: Optional["SmsChannelProperties"] = None, + properties: Optional["_models.SmsChannelProperties"] = None, **kwargs ): """ @@ -3742,7 +3961,7 @@ def __init__( *, etag: Optional[str] = None, location: Optional[str] = "global", - properties: Optional["TelegramChannelProperties"] = None, + properties: Optional["_models.TelegramChannelProperties"] = None, **kwargs ): """ @@ -3842,7 +4061,7 @@ def __init__( *, etag: Optional[str] = None, location: Optional[str] = "global", - properties: Optional["WebChatChannelProperties"] = None, + properties: Optional["_models.WebChatChannelProperties"] = None, **kwargs ): """ @@ -3881,7 +4100,7 @@ class WebChatChannelProperties(msrest.serialization.Model): def __init__( self, *, - sites: Optional[List["WebChatSite"]] = None, + sites: Optional[List["_models.WebChatSite"]] = None, **kwargs ): """ @@ -3891,3 +4110,133 @@ def __init__( super(WebChatChannelProperties, self).__init__(**kwargs) self.web_chat_embed_code = None self.sites = sites + + +class WebChatSite(Site): + """A site for the Webchat 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. + + :ivar site_id: Site Id. + :vartype site_id: str + :ivar site_name: Required. Site name. + :vartype site_name: str + :ivar key: Primary key. Value only returned through POST to the action Channel List API, + otherwise empty. + :vartype key: str + :ivar key2: Secondary key. Value only returned through POST to the action Channel List API, + otherwise empty. + :vartype key2: str + :ivar is_enabled: Required. Whether this site is enabled for DirectLine channel. + :vartype is_enabled: bool + :ivar is_token_enabled: Whether this site is token enabled for channel. + :vartype is_token_enabled: bool + :ivar is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for + channel. + :vartype is_endpoint_parameters_enabled: bool + :ivar is_detailed_logging_enabled: Whether this site is disabled detailed logging for. + :vartype is_detailed_logging_enabled: bool + :ivar is_block_user_upload_enabled: Whether this site is enabled for block user upload. + :vartype is_block_user_upload_enabled: bool + :ivar is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. + :vartype is_no_storage_enabled: bool + :ivar e_tag: Entity Tag. + :vartype e_tag: str + :ivar app_id: DirectLine application id. + :vartype app_id: str + :ivar is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. + :vartype is_v1_enabled: bool + :ivar is_v3_enabled: Whether this site is enabled for Bot Framework V1 protocol. + :vartype is_v3_enabled: bool + :ivar is_secure_site_enabled: Whether this site is enabled for authentication with Bot + Framework. + :vartype is_secure_site_enabled: bool + :ivar trusted_origins: List of Trusted Origin URLs for this site. This field is applicable only + if isSecureSiteEnabled is True. + :vartype trusted_origins: list[str] + :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 = { + '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_webchat_preview_enabled': {'key': 'isWebchatPreviewEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + site_name: str, + is_enabled: bool, + 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_webchat_preview_enabled: Optional[bool] = False, + **kwargs + ): + """ + :keyword site_name: Required. Site name. + :paramtype site_name: str + :keyword is_enabled: Required. Whether this site is enabled for DirectLine channel. + :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 V1 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_webchat_preview_enabled: Whether this site is enabled for preview versions of + Webchat. + :paramtype is_webchat_preview_enabled: bool + """ + super(WebChatSite, self).__init__(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_webchat_preview_enabled=is_webchat_preview_enabled, **kwargs) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_patch.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 89604c7b3d53..4f1448434ae0 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 @@ -9,21 +9,30 @@ from ._bots_operations import BotsOperations from ._channels_operations import ChannelsOperations from ._direct_line_operations import DirectLineOperations +from ._email_operations import EmailOperations from ._operations import Operations from ._bot_connection_operations import BotConnectionOperations +from ._qn_amaker_endpoint_keys_operations import QnAMakerEndpointKeysOperations from ._host_settings_operations import HostSettingsOperations from ._operation_results_operations import OperationResultsOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'BotsOperations', 'ChannelsOperations', 'DirectLineOperations', + 'EmailOperations', 'Operations', 'BotConnectionOperations', + 'QnAMakerEndpointKeysOperations', 'HostSettingsOperations', 'OperationResultsOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file 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 a9701d3153c8..cac944014a2a 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,29 +31,31 @@ def build_list_service_providers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -65,10 +67,14 @@ def build_list_with_secrets_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -76,21 +82,19 @@ def build_list_with_secrets_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -101,16 +105,19 @@ def build_create_request( connection_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.ConnectionSetting] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2021-05-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -118,23 +125,21 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -147,16 +152,19 @@ def build_update_request( connection_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.ConnectionSetting] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2021-05-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -164,23 +172,21 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -194,10 +200,14 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -205,21 +215,19 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -231,10 +239,14 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -242,21 +254,19 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -267,61 +277,61 @@ def build_list_by_bot_service_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class BotConnectionOperations(object): - """BotConnectionOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class BotConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.AzureBotService`'s + :attr:`bot_connection` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 list_service_providers( self, **kwargs: Any - ) -> "_models.ServiceProviderResponseList": + ) -> _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 @@ -329,21 +339,33 @@ def list_service_providers( :rtype: ~azure.mgmt.botservice.models.ServiceProviderResponseList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceProviderResponseList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceProviderResponseList] 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -358,7 +380,7 @@ def list_service_providers( return deserialized - list_service_providers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders'} # type: ignore + list_service_providers.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders"} # type: ignore @distributed_trace @@ -368,7 +390,7 @@ def list_with_secrets( resource_name: str, connection_name: str, **kwargs: Any - ) -> "_models.ConnectionSetting": + ) -> _models.ConnectionSetting: """Get a Connection Setting registration for a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -382,11 +404,16 @@ def list_with_secrets( :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectionSetting"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionSetting] request = build_list_with_secrets_request( @@ -394,12 +421,19 @@ def list_with_secrets( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -414,7 +448,7 @@ def list_with_secrets( return deserialized - list_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets'} # type: ignore + list_with_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets"} # type: ignore @distributed_trace @@ -423,9 +457,9 @@ def create( resource_group_name: str, resource_name: str, connection_name: str, - parameters: "_models.ConnectionSetting", + parameters: _models.ConnectionSetting, **kwargs: Any - ) -> "_models.ConnectionSetting": + ) -> _models.ConnectionSetting: """Register a new Auth Connection for a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -441,13 +475,17 @@ def create( :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectionSetting"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionSetting] _json = self._serialize.body(parameters, 'ConnectionSetting') @@ -456,14 +494,21 @@ def create( resource_name=resource_name, connection_name=connection_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -482,7 +527,7 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}"} # type: ignore @distributed_trace @@ -491,9 +536,9 @@ def update( resource_group_name: str, resource_name: str, connection_name: str, - parameters: "_models.ConnectionSetting", + parameters: _models.ConnectionSetting, **kwargs: Any - ) -> "_models.ConnectionSetting": + ) -> _models.ConnectionSetting: """Updates a Connection Setting registration for a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -509,13 +554,17 @@ def update( :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectionSetting"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionSetting] _json = self._serialize.body(parameters, 'ConnectionSetting') @@ -524,14 +573,21 @@ def update( resource_name=resource_name, connection_name=connection_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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -550,7 +606,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}"} # type: ignore @distributed_trace @@ -560,7 +616,7 @@ def get( resource_name: str, connection_name: str, **kwargs: Any - ) -> "_models.ConnectionSetting": + ) -> _models.ConnectionSetting: """Get a Connection Setting registration for a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -574,11 +630,16 @@ def get( :rtype: ~azure.mgmt.botservice.models.ConnectionSetting :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectionSetting"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionSetting] request = build_get_request( @@ -586,12 +647,19 @@ def get( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -606,11 +674,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, @@ -630,11 +698,16 @@ def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -642,12 +715,19 @@ def delete( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -658,7 +738,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}"} # type: ignore @distributed_trace @@ -667,7 +747,7 @@ def list_by_bot_service( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.ConnectionSettingResponseList"]: + ) -> Iterable[_models.ConnectionSettingResponseList]: """Returns all the Connection Settings registered to a particular BotService resource. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -681,11 +761,16 @@ def list_by_bot_service( ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.ConnectionSettingResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectionSettingResponseList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionSettingResponseList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -693,10 +778,13 @@ def prepare_request(next_link=None): 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.url = self._client.format_url(request.url) # type: ignore else: @@ -704,10 +792,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -721,7 +812,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -735,4 +830,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_bot_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections'} # type: ignore + list_by_bot_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections"} # type: ignore 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 20afa260f2ed..1d2b7811dcff 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -32,39 +32,40 @@ def build_create_request( resource_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.Bot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2021-05-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -76,39 +77,40 @@ def build_update_request( resource_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.Bot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2021-05-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -121,31 +123,33 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -156,31 +160,33 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -190,30 +196,32 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -222,96 +230,97 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) def build_get_check_name_availability_request( *, - json: JSONType = None, + json: Optional[_models.CheckNameAvailabilityRequestBody] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2021-05-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.BotService/checkNameAvailability') + _url = kwargs.pop("template_url", "/providers/Microsoft.BotService/checkNameAvailability") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class BotsOperations(object): - """BotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class BotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.AzureBotService`'s + :attr:`bots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def create( self, resource_group_name: str, resource_name: str, - parameters: "_models.Bot", + parameters: _models.Bot, **kwargs: Any - ) -> "_models.Bot": + ) -> _models.Bot: """Creates a Bot Service. Bot Service is a resource group wide resource type. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -325,13 +334,17 @@ def create( :rtype: ~azure.mgmt.botservice.models.Bot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Bot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Bot] _json = self._serialize.body(parameters, 'Bot') @@ -339,14 +352,21 @@ def create( 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.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -365,7 +385,7 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}"} # type: ignore @distributed_trace @@ -375,42 +395,46 @@ def update( resource_name: str, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, + sku: Optional[_models.Sku] = None, kind: Optional[Union[str, "_models.Kind"]] = None, etag: Optional[str] = None, - properties: Optional["_models.BotProperties"] = None, + properties: Optional[_models.BotProperties] = None, **kwargs: Any - ) -> "_models.Bot": + ) -> _models.Bot: """Updates a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. :type resource_group_name: str :param resource_name: The name of the Bot resource. :type resource_name: str - :param location: Specifies the location of the resource. + :param location: Specifies the location of the resource. Default value is None. :type location: str - :param tags: Contains resource tags defined as key/value pairs. + :param tags: Contains resource tags defined as key/value pairs. Default value is None. :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. + :param sku: Gets or sets the SKU of the resource. Default value is None. :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. + :param kind: Required. Gets or sets the Kind of the resource. Default value is None. :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. + :param etag: Entity Tag. Default value is None. :type etag: str - :param properties: The set of properties specific to bot resource. + :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 """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Bot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Bot] _parameters = _models.Bot(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) _json = self._serialize.body(_parameters, 'Bot') @@ -419,14 +443,21 @@ def update( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -445,11 +476,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, @@ -466,23 +497,35 @@ def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -493,7 +536,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}"} # type: ignore @distributed_trace @@ -502,7 +545,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Bot": + ) -> _models.Bot: """Returns a BotService specified by the parameters. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -514,23 +557,35 @@ def get( :rtype: ~azure.mgmt.botservice.models.Bot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Bot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Bot] 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -545,7 +600,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}"} # type: ignore @distributed_trace @@ -553,7 +608,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.BotResponseList"]: + ) -> Iterable[_models.BotResponseList]: """Returns all the resources of a particular type belonging to a resource group. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -563,31 +618,42 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.BotResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotResponseList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.BotResponseList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: 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=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -601,7 +667,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -615,13 +685,13 @@ 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'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices"} # type: ignore @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.BotResponseList"]: + ) -> Iterable[_models.BotResponseList]: """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 @@ -629,29 +699,40 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.BotResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotResponseList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.BotResponseList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: 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.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -665,7 +746,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -679,14 +764,14 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices"} # type: ignore @distributed_trace def get_check_name_availability( self, - parameters: "_models.CheckNameAvailabilityRequestBody", + parameters: _models.CheckNameAvailabilityRequestBody, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResponseBody": + ) -> _models.CheckNameAvailabilityResponseBody: """Check whether a bot name is available. :param parameters: The request body parameters to provide for the check name availability @@ -697,25 +782,36 @@ def get_check_name_availability( :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResponseBody"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResponseBody] _json = self._serialize.body(parameters, 'CheckNameAvailabilityRequestBody') request = build_get_check_name_availability_request( + api_version=api_version, content_type=content_type, json=_json, 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -730,5 +826,5 @@ def get_check_name_availability( return deserialized - get_check_name_availability.metadata = {'url': '/providers/Microsoft.BotService/checkNameAvailability'} # type: ignore + get_check_name_availability.metadata = {'url': "/providers/Microsoft.BotService/checkNameAvailability"} # 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 e8b4724c3771..2d77548d17f2 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,16 +33,19 @@ def build_create_request( channel_name: Union[str, "_models.ChannelName"], subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.BotChannel] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2021-05-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -50,23 +53,21 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -79,16 +80,19 @@ def build_update_request( channel_name: Union[str, "_models.ChannelName"], subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.BotChannel] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2021-05-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -96,23 +100,21 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -126,10 +128,14 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -137,21 +143,19 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -163,10 +167,14 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -174,21 +182,19 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -200,10 +206,14 @@ def build_list_with_keys_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -211,21 +221,19 @@ def build_list_with_keys_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -236,55 +244,55 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class ChannelsOperations(object): - """ChannelsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ChannelsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.AzureBotService`'s + :attr:`channels` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def create( @@ -292,9 +300,9 @@ def create( resource_group_name: str, resource_name: str, channel_name: Union[str, "_models.ChannelName"], - parameters: "_models.BotChannel", + parameters: _models.BotChannel, **kwargs: Any - ) -> "_models.BotChannel": + ) -> _models.BotChannel: """Creates a Channel registration for a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -310,13 +318,17 @@ def create( :rtype: ~azure.mgmt.botservice.models.BotChannel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotChannel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.BotChannel] _json = self._serialize.body(parameters, 'BotChannel') @@ -325,14 +337,21 @@ def create( resource_name=resource_name, channel_name=channel_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -351,7 +370,7 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}"} # type: ignore @distributed_trace @@ -362,12 +381,12 @@ def update( channel_name: Union[str, "_models.ChannelName"], location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, + sku: Optional[_models.Sku] = None, kind: Optional[Union[str, "_models.Kind"]] = None, etag: Optional[str] = None, - properties: Optional["_models.Channel"] = None, + properties: Optional[_models.Channel] = None, **kwargs: Any - ) -> "_models.BotChannel": + ) -> _models.BotChannel: """Updates a Channel registration for a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -376,30 +395,35 @@ def update( :type resource_name: str :param channel_name: The name of the Channel resource. :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :param location: Specifies the location of the resource. + :param location: Specifies the location of the resource. Default value is None. :type location: str - :param tags: Contains resource tags defined as key/value pairs. + :param tags: Contains resource tags defined as key/value pairs. Default value is None. :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. + :param sku: Gets or sets the SKU of the resource. Default value is None. :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. + :param kind: Required. Gets or sets the Kind of the resource. Default value is None. :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. + :param etag: Entity Tag. Default value is None. :type etag: str - :param properties: The set of properties specific to bot channel resource. + :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 """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotChannel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.BotChannel] _parameters = _models.BotChannel(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) _json = self._serialize.body(_parameters, 'BotChannel') @@ -409,14 +433,21 @@ def update( resource_name=resource_name, channel_name=channel_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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -435,11 +466,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, @@ -459,11 +490,16 @@ def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -471,12 +507,19 @@ def delete( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -487,7 +530,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}"} # type: ignore @distributed_trace @@ -497,7 +540,7 @@ def get( resource_name: str, channel_name: str, **kwargs: Any - ) -> "_models.BotChannel": + ) -> _models.BotChannel: """Returns a BotService Channel registration specified by the parameters. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -511,11 +554,16 @@ def get( :rtype: ~azure.mgmt.botservice.models.BotChannel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotChannel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.BotChannel] request = build_get_request( @@ -523,12 +571,19 @@ def get( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -543,7 +598,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}"} # type: ignore @distributed_trace @@ -553,7 +608,7 @@ def list_with_keys( resource_name: str, channel_name: Union[str, "_models.ChannelName"], **kwargs: Any - ) -> "_models.ListChannelWithKeysResponse": + ) -> _models.ListChannelWithKeysResponse: """Lists a Channel registration for a Bot Service including secrets. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -567,11 +622,16 @@ def list_with_keys( :rtype: ~azure.mgmt.botservice.models.ListChannelWithKeysResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ListChannelWithKeysResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ListChannelWithKeysResponse] request = build_list_with_keys_request( @@ -579,12 +639,19 @@ def list_with_keys( 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,7 +666,7 @@ def list_with_keys( return deserialized - list_with_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys'} # type: ignore + list_with_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys"} # type: ignore @distributed_trace @@ -608,7 +675,7 @@ def list_by_resource_group( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.ChannelResponseList"]: + ) -> Iterable[_models.ChannelResponseList]: """Returns all the Channel registrations of a particular BotService resource. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -620,11 +687,16 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.ChannelResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ChannelResponseList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ChannelResponseList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -632,10 +704,13 @@ def prepare_request(next_link=None): 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.url = self._client.format_url(request.url) # type: ignore else: @@ -643,10 +718,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -660,7 +738,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -674,4 +756,4 @@ 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/{resourceName}/channels'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels"} # type: ignore 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 0de65a0f3fd0..ec87b4d83ff4 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -32,16 +32,19 @@ def build_regenerate_keys_request( subscription_id: str, channel_name: Union[str, "_models.RegenerateKeysChannelName"], *, - json: JSONType = None, + json: Optional[_models.SiteInfo] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2021-05-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -49,49 +52,45 @@ def build_regenerate_keys_request( "channelName": _SERIALIZER.url("channel_name", channel_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class DirectLineOperations(object): - """DirectLineOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class DirectLineOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.AzureBotService`'s + :attr:`direct_line` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 regenerate_keys( @@ -99,9 +98,9 @@ def regenerate_keys( resource_group_name: str, resource_name: str, channel_name: Union[str, "_models.RegenerateKeysChannelName"], - parameters: "_models.SiteInfo", + parameters: _models.SiteInfo, **kwargs: Any - ) -> "_models.BotChannel": + ) -> _models.BotChannel: """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService resource. @@ -118,13 +117,17 @@ def regenerate_keys( :rtype: ~azure.mgmt.botservice.models.BotChannel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotChannel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.BotChannel] _json = self._serialize.body(parameters, 'SiteInfo') @@ -133,14 +136,21 @@ def regenerate_keys( resource_name=resource_name, subscription_id=self._config.subscription_id, channel_name=channel_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.regenerate_keys.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -155,5 +165,5 @@ def regenerate_keys( return deserialized - regenerate_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys'} # type: ignore + regenerate_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys"} # 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 new file mode 100644 index 000000000000..b0eeef9882d6 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_email_operations.py @@ -0,0 +1,147 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +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 .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_sign_in_url_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/createEmailSignInUrl") # pylint: disable=line-too-long + path_format_arguments = { + "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_.-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 EmailOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.AzureBotService`'s + :attr:`email` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def create_sign_in_url( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.CreateEmailSignInUrlResponse: + """Creates an email channel sign in url for a Bot Service. + + :param resource_group_name: The name of the Bot resource group in the user subscription. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CreateEmailSignInUrlResponse] + + + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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('CreateEmailSignInUrlResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_sign_in_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/createEmailSignInUrl"} # 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 45a14abce945..e24913392c1d 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -29,59 +30,59 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class HostSettingsOperations(object): - """HostSettingsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class HostSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.AzureBotService`'s + :attr:`host_settings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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, **kwargs: Any - ) -> "_models.HostSettingsResponse": + ) -> _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 @@ -89,21 +90,33 @@ def get( :rtype: ~azure.mgmt.botservice.models.HostSettingsResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.HostSettingsResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.HostSettingsResponse] 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -118,5 +131,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings"} # 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 a3e071a80c6c..7050bc00d992 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,9 +16,9 @@ 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,76 +33,88 @@ def build_get_request_initial( operation_result_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "operationResultId": _SERIALIZER.url("operation_result_id", operation_result_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class OperationResultsOperations(object): - """OperationResultsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class OperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.AzureBotService`'s + :attr:`operation_results` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + def _get_initial( self, operation_result_id: str, **kwargs: Any - ) -> Optional["_models.OperationResultsDescription"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationResultsDescription"]] + ) -> Optional[_models.OperationResultsDescription]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.OperationResultsDescription]] request = build_get_request_initial( subscription_id=self._config.subscription_id, operation_result_id=operation_result_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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -117,7 +130,7 @@ def _get_initial( return deserialized - _get_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}'} # type: ignore + _get_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}"} # type: ignore @distributed_trace @@ -125,7 +138,7 @@ def begin_get( self, operation_result_id: str, **kwargs: Any - ) -> LROPoller["_models.OperationResultsDescription"]: + ) -> LROPoller[_models.OperationResultsDescription]: """Get the operation result for a long running operation. :param operation_result_id: The ID of the operation result to get. @@ -144,31 +157,43 @@ def begin_get( ~azure.core.polling.LROPoller[~azure.mgmt.botservice.models.OperationResultsDescription] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResultsDescription"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationResultsDescription] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._get_initial( + raw_result = self._get_initial( # type: ignore operation_result_id=operation_result_id, + 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): - response = pipeline_response.http_response deserialized = self._deserialize('OperationResultsDescription', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -177,7 +202,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}'} # type: ignore + begin_get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}"} # 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 0974357b9f2f..c8b9019f3bf2 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,8 +16,8 @@ from azure.core.pipeline.transport import HttpResponse 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,54 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.BotService/operations') + _url = kwargs.pop("template_url", "/providers/Microsoft.BotService/operations") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.AzureBotService`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 list( self, **kwargs: Any - ) -> Iterable["_models.OperationEntityListResult"]: + ) -> Iterable[_models.OperationEntityListResult]: """Lists all the available BotService operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -85,27 +86,38 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.OperationEntityListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationEntityListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationEntityListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -119,7 +131,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -133,4 +149,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.BotService/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.BotService/operations"} # type: ignore diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_patch.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 d0f7bac87b99..61d12b76498b 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,31 +33,33 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -69,10 +71,14 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -80,21 +86,19 @@ def build_get_request( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -105,16 +109,19 @@ def build_create_request( subscription_id: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2021-05-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -122,23 +129,21 @@ def build_create_request( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -152,10 +157,14 @@ def build_delete_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), @@ -163,45 +172,41 @@ def build_delete_request( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.AzureBotService`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 list( @@ -209,7 +214,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: + ) -> Iterable[_models.PrivateEndpointConnectionListResult]: """List all the private endpoint connections associated with the Bot. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -223,11 +228,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -235,10 +245,13 @@ def prepare_request(next_link=None): 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.url = self._client.format_url(request.url) # type: ignore else: @@ -246,10 +259,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, resource_name=resource_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -263,7 +279,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -277,7 +297,7 @@ 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'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections"} # type: ignore @distributed_trace def get( @@ -286,7 +306,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection associated with the Bot. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -301,11 +321,16 @@ def get( :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -313,12 +338,19 @@ def get( resource_name=resource_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -333,7 +365,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace @@ -342,9 +374,9 @@ def create( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Update the state of specified private endpoint connection associated with the Bot. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -361,13 +393,17 @@ def create( :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -376,14 +412,21 @@ def create( resource_name=resource_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -398,11 +441,11 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, @@ -423,11 +466,16 @@ def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -435,12 +483,19 @@ def delete( resource_name=resource_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -451,5 +506,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # 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 736789dec443..99b52e5d4bfe 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,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse 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 msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,55 +32,55 @@ def build_list_by_bot_resource_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { "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_.-]*$'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.botservice.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.AzureBotService`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 list_by_bot_resource( @@ -87,7 +88,7 @@ def list_by_bot_resource( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources that need to be created for a Bot. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -99,23 +100,35 @@ def list_by_bot_resource( :rtype: ~azure.mgmt.botservice.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] 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.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,5 +143,5 @@ def list_by_bot_resource( return deserialized - list_by_bot_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources'} # type: ignore + list_by_bot_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources"} # 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 new file mode 100644 index 000000000000..831805498afd --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_qn_amaker_endpoint_keys_operations.py @@ -0,0 +1,151 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +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 .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + *, + json: Optional[_models.QnAMakerEndpointKeysRequestBody] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listQnAMakerEndpointKeys") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + +class QnAMakerEndpointKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.AzureBotService`'s + :attr:`qn_amaker_endpoint_keys` 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, + parameters: _models.QnAMakerEndpointKeysRequestBody, + **kwargs: Any + ) -> _models.QnAMakerEndpointKeysResponse: + """Lists the QnA Maker endpoint keys. + + :param parameters: The request body parameters to provide for the check name availability + request. + :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody + :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 + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-15-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.QnAMakerEndpointKeysResponse] + + _json = self._serialize.body(parameters, 'QnAMakerEndpointKeysRequestBody') + + request = build_get_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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('QnAMakerEndpointKeysResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listQnAMakerEndpointKeys"} # type: ignore +