From d8a0b8ff7ce1c3081da18fd8a6fb7ad4fe479361 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 10 Jan 2022 08:16:42 +0000 Subject: [PATCH] CodeGen from PR 17294 in Azure/azure-rest-api-specs Merge 167d08d4a6b57fa1d26d4c6ea5eaf9e1c9ee65ee into 2fd8d844ff4be936d818b7ec7c1b4bd668bbeddb --- .../azure-mgmt-botservice/_meta.json | 10 +- .../azure/mgmt/botservice/__init__.py | 9 +- .../mgmt/botservice/_azure_bot_service.py | 112 +- .../azure/mgmt/botservice/_configuration.py | 21 +- .../azure/mgmt/botservice/_metadata.json | 32 +- .../azure/mgmt/botservice/_patch.py | 31 + .../azure/mgmt/botservice/_vendor.py | 27 + .../azure/mgmt/botservice/_version.py | 2 +- .../azure/mgmt/botservice/aio/__init__.py | 5 + .../mgmt/botservice/aio/_azure_bot_service.py | 98 +- .../mgmt/botservice/aio/_configuration.py | 8 +- .../azure/mgmt/botservice/aio/_patch.py | 31 + .../botservice/aio/operations/__init__.py | 6 + .../operations/_bot_connection_operations.py | 283 +- .../aio/operations/_bots_operations.py | 286 +- .../aio/operations/_channels_operations.py | 264 +- .../aio/operations/_direct_line_operations.py | 51 +- .../operations/_host_settings_operations.py | 37 +- .../_operation_results_operations.py | 148 + .../botservice/aio/operations/_operations.py | 50 +- ...private_endpoint_connections_operations.py | 298 ++ .../_private_link_resources_operations.py | 97 + .../azure/mgmt/botservice/models/__init__.py | 207 +- .../models/_azure_bot_service_enums.py | 73 +- .../azure/mgmt/botservice/models/_models.py | 2075 ------------- .../mgmt/botservice/models/_models_py3.py | 2573 +++++++++++++---- .../mgmt/botservice/operations/__init__.py | 6 + .../operations/_bot_connection_operations.py | 637 ++-- .../botservice/operations/_bots_operations.py | 623 ++-- .../operations/_channels_operations.py | 587 ++-- .../operations/_direct_line_operations.py | 123 +- .../operations/_host_settings_operations.py | 85 +- .../_operation_results_operations.py | 183 ++ .../mgmt/botservice/operations/_operations.py | 88 +- ...private_endpoint_connections_operations.py | 455 +++ .../_private_link_resources_operations.py | 134 + 36 files changed, 5668 insertions(+), 4087 deletions(-) create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_patch.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_vendor.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_patch.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operation_results_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_link_resources_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operation_results_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_link_resources_operations.py diff --git a/sdk/botservice/azure-mgmt-botservice/_meta.json b/sdk/botservice/azure-mgmt-botservice/_meta.json index 1a49081aec34..b31c8886e14d 100644 --- a/sdk/botservice/azure-mgmt-botservice/_meta.json +++ b/sdk/botservice/azure-mgmt-botservice/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.0", - "@autorest/modelerfour@4.19.1" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "e23a53d64f46db42df2886989a3436f7431168f4", + "commit": "174b454df8982c72dc13afb798699e1d90583b5e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/botservice/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/modelerfour@4.19.1 --version=3.4.2", + "autorest_command": "autorest specification/botservice/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.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 33209443154e..a4b6bab689ba 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/__init__.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AzureBotService'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._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() 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 2f436d87a47a..93b9ba3a71cd 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 @@ -6,29 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +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 + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import AzureBotServiceConfiguration -from .operations import BotsOperations -from .operations import ChannelsOperations -from .operations import DirectLineOperations -from .operations import Operations -from .operations import BotConnectionOperations -from .operations import HostSettingsOperations -from . import models - -class AzureBotService(object): +class AzureBotService: """Azure Bot Service is a platform for creating smart conversational agents. :ivar bots: BotsOperations operations @@ -43,61 +36,74 @@ class AzureBotService(object): :vartype bot_connection: azure.mgmt.botservice.operations.BotConnectionOperations :ivar host_settings: HostSettingsOperations operations :vartype host_settings: azure.mgmt.botservice.operations.HostSettingsOperations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: azure.mgmt.botservice.operations.OperationResultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.botservice.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.botservice.operations.PrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Azure Subscription ID. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AzureBotServiceConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureBotServiceConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - 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) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + 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) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None 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 1ea61826a5b3..c0ef5bf10054 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_configuration.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,20 +33,19 @@ class AzureBotServiceConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AzureBotServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AzureBotServiceConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-03-01" + self.api_version = "2021-05-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-botservice/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **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 index b0d2e5632170..ce2d5328325c 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_metadata.json +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2021-03-01", - "total_api_version_list": ["2021-03-01"], + "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.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, - "has_lro_operations": false, + "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\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"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\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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", @@ -103,6 +102,9 @@ "direct_line": "DirectLineOperations", "operations": "Operations", "bot_connection": "BotConnectionOperations", - "host_settings": "HostSettingsOperations" + "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/_patch.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_vendor.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_version.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_version.py index c47f66669f1b..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 = "1.0.0" +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 99b4a4669306..349677150608 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 @@ -8,3 +8,8 @@ from ._azure_bot_service import AzureBotService __all__ = ['AzureBotService'] + +# `._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() 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 38d15c8325bb..7491c1917704 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 @@ -6,27 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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 + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import AzureBotServiceConfiguration -from .operations import BotsOperations -from .operations import ChannelsOperations -from .operations import DirectLineOperations -from .operations import Operations -from .operations import BotConnectionOperations -from .operations import HostSettingsOperations -from .. import models - - -class AzureBotService(object): +class AzureBotService: """Azure Bot Service is a platform for creating smart conversational agents. :ivar bots: BotsOperations operations @@ -41,59 +36,74 @@ class AzureBotService(object): :vartype bot_connection: azure.mgmt.botservice.aio.operations.BotConnectionOperations :ivar host_settings: HostSettingsOperations operations :vartype host_settings: azure.mgmt.botservice.aio.operations.HostSettingsOperations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: azure.mgmt.botservice.aio.operations.OperationResultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.botservice.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.botservice.aio.operations.PrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Azure Subscription ID. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AzureBotServiceConfiguration(credential, subscription_id, **kwargs) + self._config = AzureBotServiceConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False 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.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) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() 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 dd20f20ff3cc..3130d740b67c 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 @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,15 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AzureBotServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AzureBotServiceConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-03-01" + self.api_version = "2021-05-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-botservice/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_patch.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file 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 57b1265e4d3f..89604c7b3d53 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 @@ -12,6 +12,9 @@ from ._operations import Operations from ._bot_connection_operations import BotConnectionOperations 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 __all__ = [ 'BotsOperations', @@ -20,4 +23,7 @@ 'Operations', 'BotConnectionOperations', 'HostSettingsOperations', + 'OperationResultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', ] 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 b3f52991b370..0edb4459766f 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 @@ -5,17 +5,22 @@ # 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 azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bot_connection_operations import build_create_request, build_delete_request, build_get_request, build_list_by_bot_service_request, build_list_service_providers_request, build_list_with_secrets_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_service_providers( self, **kwargs: Any @@ -57,31 +63,21 @@ async def list_service_providers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.list_service_providers.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_service_providers_request( + subscription_id=self._config.subscription_id, + template_url=self.list_service_providers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceProviderResponseList', pipeline_response) @@ -90,8 +86,11 @@ async def list_service_providers( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_providers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders'} # type: ignore + + @distributed_trace_async async def list_with_secrets( self, resource_group_name: str, @@ -117,34 +116,24 @@ async def list_with_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.list_with_secrets.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'connectionName': self._serialize.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_with_secrets_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + template_url=self.list_with_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConnectionSetting', pipeline_response) @@ -153,8 +142,11 @@ async def list_with_secrets( return cls(pipeline_response, deserialized, {}) return deserialized + list_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -183,39 +175,29 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'connectionName': self._serialize.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ConnectionSetting') + + request = build_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ConnectionSetting') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -228,8 +210,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -258,39 +243,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'connectionName': self._serialize.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ConnectionSetting') + + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ConnectionSetting') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -303,8 +278,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -330,34 +308,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'connectionName': self._serialize.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConnectionSetting', pipeline_response) @@ -366,8 +334,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -393,34 +364,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'connectionName': self._serialize.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -428,6 +389,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + + @distributed_trace def list_by_bot_service( self, resource_group_name: str, @@ -441,8 +404,10 @@ def list_by_bot_service( :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: An iterator like instance of either ConnectionSettingResponseList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.ConnectionSettingResponseList] + :return: An iterator like instance of either ConnectionSettingResponseList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.ConnectionSettingResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectionSettingResponseList"] @@ -450,36 +415,33 @@ def list_by_bot_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_bot_service.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_bot_service_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_bot_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_bot_service_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ConnectionSettingResponseList', pipeline_response) + deserialized = self._deserialize("ConnectionSettingResponseList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -492,12 +454,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 f4aeb496f22e..d2b04eff8a5f 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 @@ -5,17 +5,22 @@ # 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 azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bots_operations import build_create_request, build_delete_request, build_get_check_name_availability_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -66,38 +72,28 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Bot') + + request = build_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Bot') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -110,8 +106,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -153,39 +152,28 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) - _parameters = _models.Bot(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _parameters = _models.Bot(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) + _json = self._serialize.body(_parameters, 'Bot') + + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'Bot') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -198,8 +186,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -222,33 +213,23 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -256,6 +237,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -278,33 +261,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Bot', pipeline_response) @@ -313,8 +286,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -334,35 +310,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BotResponseList', pipeline_response) + deserialized = self._deserialize("BotResponseList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -375,17 +347,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -402,34 +376,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BotResponseList', pipeline_response) + deserialized = self._deserialize("BotResponseList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -442,17 +411,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices'} # type: ignore + @distributed_trace_async async def get_check_name_availability( self, parameters: "_models.CheckNameAvailabilityRequestBody", @@ -473,32 +444,25 @@ async def get_check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_check_name_availability.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityRequestBody') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CheckNameAvailabilityRequestBody') + + request = build_get_check_name_availability_request( + content_type=content_type, + json=_json, + template_url=self.get_check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityResponseBody', pipeline_response) @@ -507,4 +471,6 @@ async def get_check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + 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 a67700e64ffb..ed699ac52b84 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 @@ -5,17 +5,22 @@ # 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 azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._channels_operations import build_create_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_with_keys_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -69,39 +75,29 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'channelName': self._serialize.url("channel_name", channel_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BotChannel') + + request = build_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BotChannel') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -114,8 +110,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -160,40 +159,29 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) - _parameters = _models.BotChannel(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'channelName': self._serialize.url("channel_name", channel_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _parameters = _models.BotChannel(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) + _json = self._serialize.body(_parameters, 'BotChannel') + + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'BotChannel') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -206,8 +194,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -233,34 +224,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'channelName': self._serialize.url("channel_name", channel_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -268,6 +249,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -293,34 +276,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'channelName': self._serialize.url("channel_name", channel_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BotChannel', pipeline_response) @@ -329,15 +302,18 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + + @distributed_trace_async async def list_with_keys( self, resource_group_name: str, resource_name: str, channel_name: Union[str, "_models.ChannelName"], **kwargs: Any - ) -> "_models.BotChannel": + ) -> "_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. @@ -347,53 +323,46 @@ async def list_with_keys( :param channel_name: The name of the Channel resource. :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel, or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel + :return: ListChannelWithKeysResponse, or the result of cls(response) + :rtype: ~azure.mgmt.botservice.models.ListChannelWithKeysResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotChannel"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListChannelWithKeysResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.list_with_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'channelName': self._serialize.url("channel_name", channel_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_with_keys_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + template_url=self.list_with_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BotChannel', pipeline_response) + deserialized = self._deserialize('ListChannelWithKeysResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized + list_with_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -408,7 +377,8 @@ def list_by_resource_group( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ChannelResponseList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.ChannelResponseList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.ChannelResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ChannelResponseList"] @@ -416,36 +386,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ChannelResponseList', pipeline_response) + deserialized = self._deserialize("ChannelResponseList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -458,12 +425,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 8476401cb3d2..6b8a9de7faa4 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 @@ -5,16 +5,20 @@ # 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 azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._direct_line_operations import build_regenerate_keys_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def regenerate_keys( self, resource_group_name: str, @@ -69,39 +74,29 @@ async def regenerate_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'channelName': self._serialize.url("channel_name", channel_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SiteInfo') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + channel_name=channel_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SiteInfo') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BotChannel', pipeline_response) @@ -110,4 +105,6 @@ async def regenerate_keys( return cls(pipeline_response, deserialized, {}) return deserialized + 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/_host_settings_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_host_settings_operations.py index adb542bfc081..815d754deccd 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 @@ -5,16 +5,20 @@ # 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 azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._host_settings_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, **kwargs: Any @@ -56,31 +61,21 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('HostSettingsResponse', pipeline_response) @@ -89,4 +84,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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 new file mode 100644 index 000000000000..1f31698c1006 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operation_results_operations.py @@ -0,0 +1,148 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operation_results_operations import build_get_request_initial +T = TypeVar('T') +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. + + :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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _get_initial( + self, + operation_result_id: str, + **kwargs: Any + ) -> Optional["_models.OperationResultsDescription"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationResultsDescription"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request_initial( + subscription_id=self._config.subscription_id, + operation_result_id=operation_result_id, + template_url=self._get_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationResultsDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}'} # type: ignore + + + @distributed_trace_async + async def begin_get( + self, + operation_result_id: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.OperationResultsDescription"]: + """Get the operation result for a long running operation. + + :param operation_result_id: The ID of the operation result to get. + :type operation_result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationResultsDescription or the + result of cls(response) + :rtype: + ~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"] + 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( + operation_result_id=operation_result_id, + cls=lambda x,y,z: x, + **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() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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 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 2c6d92928bd5..224a5286d85b 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 @@ -5,17 +5,22 @@ # 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 azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Lists all the available BotService operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationEntityListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.OperationEntityListResult] + :return: An iterator like instance of either OperationEntityListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.OperationEntityListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationEntityListResult"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationEntityListResult', pipeline_response) + deserialized = self._deserialize("OperationEntityListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) 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 new file mode 100644 index 000000000000..3339a4910ccd --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,298 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +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 import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_create_request, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +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. + + :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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> 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. + :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: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_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. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_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. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. + :type properties: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified private endpoint connection associated with the Bot. + + :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 private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + 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 new file mode 100644 index 000000000000..8bd290fc95a1 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,97 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_list_by_bot_resource_request +T = TypeVar('T') +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. + + :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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def list_by_bot_resource( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_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. + :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: PrivateLinkResourceListResult, or the result of cls(response) + :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', {})) + + + request = build_list_by_bot_resource_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_bot_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(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('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + 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/models/__init__.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py index bd46a4fa483c..ec7694ba4be1 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 @@ -6,125 +6,86 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AlexaChannel - from ._models_py3 import AlexaChannelProperties - from ._models_py3 import Bot - from ._models_py3 import BotChannel - from ._models_py3 import BotProperties - from ._models_py3 import BotResponseList - from ._models_py3 import Channel - from ._models_py3 import ChannelResponseList - from ._models_py3 import CheckNameAvailabilityRequestBody - from ._models_py3 import CheckNameAvailabilityResponseBody - from ._models_py3 import ConnectionItemName - from ._models_py3 import ConnectionSetting - from ._models_py3 import ConnectionSettingParameter - from ._models_py3 import ConnectionSettingProperties - from ._models_py3 import ConnectionSettingResponseList - from ._models_py3 import DirectLineChannel - from ._models_py3 import DirectLineChannelProperties - from ._models_py3 import DirectLineSite - from ._models_py3 import DirectLineSpeechChannel - from ._models_py3 import DirectLineSpeechChannelProperties - from ._models_py3 import EmailChannel - from ._models_py3 import EmailChannelProperties - from ._models_py3 import Error - from ._models_py3 import ErrorBody - from ._models_py3 import FacebookChannel - from ._models_py3 import FacebookChannelProperties - from ._models_py3 import FacebookPage - from ._models_py3 import HostSettingsResponse - from ._models_py3 import KikChannel - from ._models_py3 import KikChannelProperties - from ._models_py3 import LineChannel - from ._models_py3 import LineChannelProperties - from ._models_py3 import LineRegistration - from ._models_py3 import MsTeamsChannel - from ._models_py3 import MsTeamsChannelProperties - from ._models_py3 import OperationDisplayInfo - from ._models_py3 import OperationEntity - from ._models_py3 import OperationEntityListResult - from ._models_py3 import Resource - from ._models_py3 import ServiceProvider - from ._models_py3 import ServiceProviderParameter - from ._models_py3 import ServiceProviderProperties - from ._models_py3 import ServiceProviderResponseList - from ._models_py3 import SiteInfo - from ._models_py3 import Sku - from ._models_py3 import SkypeChannel - from ._models_py3 import SkypeChannelProperties - from ._models_py3 import SlackChannel - from ._models_py3 import SlackChannelProperties - from ._models_py3 import SmsChannel - from ._models_py3 import SmsChannelProperties - from ._models_py3 import TelegramChannel - from ._models_py3 import TelegramChannelProperties - from ._models_py3 import WebChatChannel - from ._models_py3 import WebChatChannelProperties - from ._models_py3 import WebChatSite -except (SyntaxError, ImportError): - from ._models import AlexaChannel # type: ignore - from ._models import AlexaChannelProperties # type: ignore - from ._models import Bot # type: ignore - from ._models import BotChannel # type: ignore - from ._models import BotProperties # type: ignore - from ._models import BotResponseList # type: ignore - from ._models import Channel # type: ignore - from ._models import ChannelResponseList # type: ignore - from ._models import CheckNameAvailabilityRequestBody # type: ignore - from ._models import CheckNameAvailabilityResponseBody # type: ignore - from ._models import ConnectionItemName # type: ignore - from ._models import ConnectionSetting # type: ignore - from ._models import ConnectionSettingParameter # type: ignore - from ._models import ConnectionSettingProperties # type: ignore - from ._models import ConnectionSettingResponseList # type: ignore - from ._models import DirectLineChannel # type: ignore - from ._models import DirectLineChannelProperties # type: ignore - from ._models import DirectLineSite # type: ignore - from ._models import DirectLineSpeechChannel # type: ignore - from ._models import DirectLineSpeechChannelProperties # type: ignore - from ._models import EmailChannel # type: ignore - from ._models import EmailChannelProperties # type: ignore - from ._models import Error # type: ignore - from ._models import ErrorBody # type: ignore - from ._models import FacebookChannel # type: ignore - from ._models import FacebookChannelProperties # type: ignore - from ._models import FacebookPage # type: ignore - from ._models import HostSettingsResponse # type: ignore - from ._models import KikChannel # type: ignore - from ._models import KikChannelProperties # type: ignore - from ._models import LineChannel # type: ignore - from ._models import LineChannelProperties # type: ignore - from ._models import LineRegistration # type: ignore - from ._models import MsTeamsChannel # type: ignore - from ._models import MsTeamsChannelProperties # type: ignore - from ._models import OperationDisplayInfo # type: ignore - from ._models import OperationEntity # type: ignore - from ._models import OperationEntityListResult # type: ignore - from ._models import Resource # type: ignore - from ._models import ServiceProvider # type: ignore - from ._models import ServiceProviderParameter # type: ignore - from ._models import ServiceProviderProperties # type: ignore - from ._models import ServiceProviderResponseList # type: ignore - from ._models import SiteInfo # type: ignore - from ._models import Sku # type: ignore - from ._models import SkypeChannel # type: ignore - from ._models import SkypeChannelProperties # type: ignore - from ._models import SlackChannel # type: ignore - from ._models import SlackChannelProperties # type: ignore - from ._models import SmsChannel # type: ignore - from ._models import SmsChannelProperties # type: ignore - from ._models import TelegramChannel # type: ignore - from ._models import TelegramChannelProperties # type: ignore - from ._models import WebChatChannel # type: ignore - from ._models import WebChatChannelProperties # type: ignore - from ._models import WebChatSite # type: ignore +from ._models_py3 import AlexaChannel +from ._models_py3 import AlexaChannelProperties +from ._models_py3 import Bot +from ._models_py3 import BotChannel +from ._models_py3 import BotProperties +from ._models_py3 import BotResponseList +from ._models_py3 import Channel +from ._models_py3 import ChannelResponseList +from ._models_py3 import ChannelSettings +from ._models_py3 import CheckNameAvailabilityRequestBody +from ._models_py3 import CheckNameAvailabilityResponseBody +from ._models_py3 import ConnectionItemName +from ._models_py3 import ConnectionSetting +from ._models_py3 import ConnectionSettingParameter +from ._models_py3 import ConnectionSettingProperties +from ._models_py3 import ConnectionSettingResponseList +from ._models_py3 import DirectLineChannel +from ._models_py3 import DirectLineChannelProperties +from ._models_py3 import DirectLineSite +from ._models_py3 import DirectLineSpeechChannel +from ._models_py3 import DirectLineSpeechChannelProperties +from ._models_py3 import EmailChannel +from ._models_py3 import EmailChannelProperties +from ._models_py3 import Error +from ._models_py3 import ErrorBody +from ._models_py3 import FacebookChannel +from ._models_py3 import FacebookChannelProperties +from ._models_py3 import FacebookPage +from ._models_py3 import HostSettingsResponse +from ._models_py3 import KikChannel +from ._models_py3 import KikChannelProperties +from ._models_py3 import LineChannel +from ._models_py3 import LineChannelProperties +from ._models_py3 import LineRegistration +from ._models_py3 import ListChannelWithKeysResponse +from ._models_py3 import MsTeamsChannel +from ._models_py3 import MsTeamsChannelProperties +from ._models_py3 import OperationDisplayInfo +from ._models_py3 import OperationEntity +from ._models_py3 import OperationEntityListResult +from ._models_py3 import OperationResultsDescription +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceBase +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Resource +from ._models_py3 import ServiceProvider +from ._models_py3 import ServiceProviderParameter +from ._models_py3 import ServiceProviderParameterMetadata +from ._models_py3 import ServiceProviderParameterMetadataConstraints +from ._models_py3 import ServiceProviderProperties +from ._models_py3 import ServiceProviderResponseList +from ._models_py3 import Site +from ._models_py3 import SiteInfo +from ._models_py3 import Sku +from ._models_py3 import SkypeChannel +from ._models_py3 import SkypeChannelProperties +from ._models_py3 import SlackChannel +from ._models_py3 import SlackChannelProperties +from ._models_py3 import SmsChannel +from ._models_py3 import SmsChannelProperties +from ._models_py3 import TelegramChannel +from ._models_py3 import TelegramChannelProperties +from ._models_py3 import WebChatChannel +from ._models_py3 import WebChatChannelProperties +from ._models_py3 import WebChatSite + from ._azure_bot_service_enums import ( ChannelName, Key, Kind, + MsaAppType, + OperationResultStatus, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + PublicNetworkAccess, RegenerateKeysChannelName, SkuName, SkuTier, @@ -139,6 +100,7 @@ 'BotResponseList', 'Channel', 'ChannelResponseList', + 'ChannelSettings', 'CheckNameAvailabilityRequestBody', 'CheckNameAvailabilityResponseBody', 'ConnectionItemName', @@ -164,16 +126,28 @@ 'LineChannel', 'LineChannelProperties', 'LineRegistration', + 'ListChannelWithKeysResponse', 'MsTeamsChannel', 'MsTeamsChannelProperties', 'OperationDisplayInfo', 'OperationEntity', 'OperationEntityListResult', + 'OperationResultsDescription', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourceBase', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', 'Resource', 'ServiceProvider', 'ServiceProviderParameter', + 'ServiceProviderParameterMetadata', + 'ServiceProviderParameterMetadataConstraints', 'ServiceProviderProperties', 'ServiceProviderResponseList', + 'Site', 'SiteInfo', 'Sku', 'SkypeChannel', @@ -190,6 +164,11 @@ 'ChannelName', 'Key', 'Kind', + 'MsaAppType', + 'OperationResultStatus', + 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', + 'PublicNetworkAccess', 'RegenerateKeysChannelName', 'SkuName', 'SkuTier', diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_azure_bot_service_enums.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_azure_bot_service_enums.py index 68217ec6aa3e..617880d40374 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 @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ChannelName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ChannelName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALEXA_CHANNEL = "AlexaChannel" FACEBOOK_CHANNEL = "FacebookChannel" @@ -42,14 +27,14 @@ class ChannelName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LINE_CHANNEL = "LineChannel" DIRECT_LINE_SPEECH_CHANNEL = "DirectLineSpeechChannel" -class Key(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Key(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Determines which key is to be regenerated """ KEY1 = "key1" KEY2 = "key2" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates the type of bot service """ @@ -59,19 +44,61 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FUNCTION = "function" AZUREBOT = "azurebot" -class RegenerateKeysChannelName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MsaAppType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Microsoft App Type for the bot + """ + + USER_ASSIGNED_MSI = "UserAssignedMSI" + SINGLE_TENANT = "SingleTenant" + MULTI_TENANT = "MultiTenant" + +class OperationResultStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The status of the operation being performed. + """ + + CANCELED = "Canceled" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + REQUESTED = "Requested" + RUNNING = "Running" + +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The private endpoint connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Whether the bot is in an isolated network + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class RegenerateKeysChannelName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): WEB_CHAT_CHANNEL = "WebChatChannel" DIRECT_LINE_CHANNEL = "DirectLineChannel" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The name of SKU. """ F0 = "F0" S1 = "S1" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the sku tier. This is based on the SKU name. """ diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models.py deleted file mode 100644 index e6e002c38513..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models.py +++ /dev/null @@ -1,2075 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -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. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - } - - _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'} - } - - def __init__( - self, - **kwargs - ): - super(Channel, self).__init__(**kwargs) - self.channel_name = None # type: Optional[str] - - -class AlexaChannel(Channel): - """Alexa channel definition. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Alexa channel resource. - :type properties: ~azure.mgmt.botservice.models.AlexaChannelProperties - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'AlexaChannelProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AlexaChannel, self).__init__(**kwargs) - self.channel_name = 'AlexaChannel' # type: str - self.properties = kwargs.get('properties', None) - - -class AlexaChannelProperties(msrest.serialization.Model): - """The parameters to provide for the Alexa 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. - - :param alexa_skill_id: Required. The Alexa skill Id. - :type alexa_skill_id: str - :ivar url_fragment: Url fragment used in part of the Uri configured in Alexa. - :vartype url_fragment: str - :ivar service_endpoint_uri: Full Uri used to configured the skill in Alexa. - :vartype service_endpoint_uri: str - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool - """ - - _validation = { - 'alexa_skill_id': {'required': True}, - 'url_fragment': {'readonly': True}, - 'service_endpoint_uri': {'readonly': True}, - 'is_enabled': {'required': True}, - } - - _attribute_map = { - 'alexa_skill_id': {'key': 'alexaSkillId', 'type': 'str'}, - 'url_fragment': {'key': 'urlFragment', 'type': 'str'}, - 'service_endpoint_uri': {'key': 'serviceEndpointUri', 'type': 'str'}, - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(AlexaChannelProperties, self).__init__(**kwargs) - self.alexa_skill_id = kwargs['alexa_skill_id'] - self.url_fragment = None - self.service_endpoint_uri = None - self.is_enabled = kwargs['is_enabled'] - - -class Resource(msrest.serialization.Model): - """Azure resource. - - 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 name: Specifies the name of the resource. - :vartype name: str - :param location: Specifies the location of the resource. - :type location: str - :ivar type: Specifies the type of the resource. - :vartype type: str - :param tags: A set of tags. Contains resource tags defined as key/value pairs. - :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. - :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", - "designer", "bot", "function", "azurebot". - :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. - :type etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.location = kwargs.get('location', None) - self.type = None - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.kind = kwargs.get('kind', None) - self.etag = kwargs.get('etag', None) - - -class Bot(Resource): - """Bot resource definition. - - 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 name: Specifies the name of the resource. - :vartype name: str - :param location: Specifies the location of the resource. - :type location: str - :ivar type: Specifies the type of the resource. - :vartype type: str - :param tags: A set of tags. Contains resource tags defined as key/value pairs. - :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. - :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", - "designer", "bot", "function", "azurebot". - :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. - :type etag: str - :param properties: The set of properties specific to bot resource. - :type properties: ~azure.mgmt.botservice.models.BotProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'BotProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Bot, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class BotChannel(Resource): - """Bot channel resource definition. - - 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 name: Specifies the name of the resource. - :vartype name: str - :param location: Specifies the location of the resource. - :type location: str - :ivar type: Specifies the type of the resource. - :vartype type: str - :param tags: A set of tags. Contains resource tags defined as key/value pairs. - :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. - :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", - "designer", "bot", "function", "azurebot". - :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. - :type etag: str - :param properties: The set of properties specific to bot channel resource. - :type properties: ~azure.mgmt.botservice.models.Channel - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'Channel'}, - } - - def __init__( - self, - **kwargs - ): - super(BotChannel, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class BotProperties(msrest.serialization.Model): - """The parameters to provide for the Bot. - - 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. - - :param display_name: Required. The Name of the bot. - :type display_name: str - :param description: The description of the bot. - :type description: str - :param icon_url: The Icon Url of the bot. - :type icon_url: str - :param endpoint: Required. The bot's endpoint. - :type endpoint: str - :ivar endpoint_version: The bot's endpoint version. - :vartype endpoint_version: str - :param msa_app_id: Required. Microsoft App Id for the bot. - :type msa_app_id: str - :ivar configured_channels: Collection of channels for which the bot is configured. - :vartype configured_channels: list[str] - :ivar enabled_channels: Collection of channels for which the bot is enabled. - :vartype enabled_channels: list[str] - :param developer_app_insight_key: The Application Insights key. - :type developer_app_insight_key: str - :param developer_app_insights_api_key: The Application Insights Api Key. - :type developer_app_insights_api_key: str - :param developer_app_insights_application_id: The Application Insights App Id. - :type developer_app_insights_application_id: str - :param luis_app_ids: Collection of LUIS App Ids. - :type luis_app_ids: list[str] - :param luis_key: The LUIS Key. - :type luis_key: str - :param is_cmek_enabled: Whether Cmek is enabled. - :type is_cmek_enabled: bool - :param cmek_key_vault_url: The CMK Url. - :type cmek_key_vault_url: str - :param is_isolated: Whether the bot is in an isolated network. - :type is_isolated: bool - :param schema_transformation_version: The channel schema transformation version for the bot. - :type schema_transformation_version: str - """ - - _validation = { - 'display_name': {'required': True}, - 'endpoint': {'required': True}, - 'endpoint_version': {'readonly': True}, - 'msa_app_id': {'required': True}, - 'configured_channels': {'readonly': True}, - 'enabled_channels': {'readonly': True}, - } - - _attribute_map = { - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'icon_url': {'key': 'iconUrl', 'type': 'str'}, - 'endpoint': {'key': 'endpoint', 'type': 'str'}, - 'endpoint_version': {'key': 'endpointVersion', 'type': 'str'}, - 'msa_app_id': {'key': 'msaAppId', 'type': 'str'}, - 'configured_channels': {'key': 'configuredChannels', 'type': '[str]'}, - 'enabled_channels': {'key': 'enabledChannels', 'type': '[str]'}, - 'developer_app_insight_key': {'key': 'developerAppInsightKey', 'type': 'str'}, - 'developer_app_insights_api_key': {'key': 'developerAppInsightsApiKey', 'type': 'str'}, - 'developer_app_insights_application_id': {'key': 'developerAppInsightsApplicationId', 'type': 'str'}, - 'luis_app_ids': {'key': 'luisAppIds', 'type': '[str]'}, - 'luis_key': {'key': 'luisKey', 'type': 'str'}, - 'is_cmek_enabled': {'key': 'isCmekEnabled', 'type': 'bool'}, - 'cmek_key_vault_url': {'key': 'cmekKeyVaultUrl', 'type': 'str'}, - 'is_isolated': {'key': 'isIsolated', 'type': 'bool'}, - 'schema_transformation_version': {'key': 'schemaTransformationVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BotProperties, self).__init__(**kwargs) - self.display_name = kwargs['display_name'] - self.description = kwargs.get('description', None) - self.icon_url = kwargs.get('icon_url', None) - self.endpoint = kwargs['endpoint'] - self.endpoint_version = None - self.msa_app_id = kwargs['msa_app_id'] - self.configured_channels = None - self.enabled_channels = None - self.developer_app_insight_key = kwargs.get('developer_app_insight_key', None) - self.developer_app_insights_api_key = kwargs.get('developer_app_insights_api_key', None) - self.developer_app_insights_application_id = kwargs.get('developer_app_insights_application_id', None) - self.luis_app_ids = kwargs.get('luis_app_ids', None) - self.luis_key = kwargs.get('luis_key', None) - self.is_cmek_enabled = kwargs.get('is_cmek_enabled', None) - self.cmek_key_vault_url = kwargs.get('cmek_key_vault_url', None) - self.is_isolated = kwargs.get('is_isolated', None) - self.schema_transformation_version = kwargs.get('schema_transformation_version', None) - - -class BotResponseList(msrest.serialization.Model): - """The list of bot service operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param next_link: The link used to get the next page of bot service resources. - :type next_link: str - :ivar value: Gets the list of bot service results and their properties. - :vartype value: list[~azure.mgmt.botservice.models.Bot] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[Bot]'}, - } - - def __init__( - self, - **kwargs - ): - super(BotResponseList, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = None - - -class ChannelResponseList(msrest.serialization.Model): - """The list of bot service channel operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param next_link: The link used to get the next page of bot service channel resources. - :type next_link: str - :ivar value: Gets the list of bot service channel results and their properties. - :vartype value: list[~azure.mgmt.botservice.models.BotChannel] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[BotChannel]'}, - } - - def __init__( - self, - **kwargs - ): - super(ChannelResponseList, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = None - - -class CheckNameAvailabilityRequestBody(msrest.serialization.Model): - """The request body for a request to Bot Service Management to check availability of a bot name. - - :param name: the name of the bot for which availability needs to be checked. - :type name: str - :param type: the type of the bot for which availability needs to be checked. - :type type: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityRequestBody, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class CheckNameAvailabilityResponseBody(msrest.serialization.Model): - """The response body returned for a request to Bot Service Management to check availability of a bot name. - - :param valid: indicates if the bot name is valid. - :type valid: bool - :param message: additional message from the bot management api showing why a bot name is not - available. - :type message: str - """ - - _attribute_map = { - 'valid': {'key': 'valid', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResponseBody, self).__init__(**kwargs) - self.valid = kwargs.get('valid', None) - self.message = kwargs.get('message', None) - - -class ConnectionItemName(msrest.serialization.Model): - """The display name of a connection Item Setting registered with the Bot. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Connection Item name that has been added in the API. - :vartype name: str - """ - - _validation = { - 'name': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectionItemName, self).__init__(**kwargs) - self.name = None - - -class ConnectionSetting(Resource): - """Bot channel resource definition. - - 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 name: Specifies the name of the resource. - :vartype name: str - :param location: Specifies the location of the resource. - :type location: str - :ivar type: Specifies the type of the resource. - :vartype type: str - :param tags: A set of tags. Contains resource tags defined as key/value pairs. - :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. - :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", - "designer", "bot", "function", "azurebot". - :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. - :type etag: str - :param properties: The set of properties specific to bot channel resource. - :type properties: ~azure.mgmt.botservice.models.ConnectionSettingProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ConnectionSettingProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectionSetting, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ConnectionSettingParameter(msrest.serialization.Model): - """Extra Parameter in a Connection Setting Properties to indicate service provider specific properties. - - :param key: Key for the Connection Setting Parameter. - :type key: str - :param value: Value associated with the Connection Setting Parameter. - :type value: str - """ - - _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectionSettingParameter, self).__init__(**kwargs) - self.key = kwargs.get('key', None) - self.value = kwargs.get('value', None) - - -class ConnectionSettingProperties(msrest.serialization.Model): - """Properties for a Connection Setting Item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param client_id: Client Id associated with the Connection Setting. - :type client_id: str - :ivar setting_id: Setting Id set by the service for the Connection Setting. - :vartype setting_id: str - :param client_secret: Client Secret associated with the Connection Setting. - :type client_secret: str - :param scopes: Scopes associated with the Connection Setting. - :type scopes: str - :param service_provider_id: Service Provider Id associated with the Connection Setting. - :type service_provider_id: str - :param service_provider_display_name: Service Provider Display Name associated with the - Connection Setting. - :type service_provider_display_name: str - :param parameters: Service Provider Parameters associated with the Connection Setting. - :type parameters: list[~azure.mgmt.botservice.models.ConnectionSettingParameter] - """ - - _validation = { - 'setting_id': {'readonly': True}, - } - - _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'setting_id': {'key': 'settingId', 'type': 'str'}, - 'client_secret': {'key': 'clientSecret', 'type': 'str'}, - 'scopes': {'key': 'scopes', 'type': 'str'}, - 'service_provider_id': {'key': 'serviceProviderId', 'type': 'str'}, - 'service_provider_display_name': {'key': 'serviceProviderDisplayName', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '[ConnectionSettingParameter]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectionSettingProperties, self).__init__(**kwargs) - self.client_id = kwargs.get('client_id', None) - self.setting_id = None - self.client_secret = kwargs.get('client_secret', None) - self.scopes = kwargs.get('scopes', None) - self.service_provider_id = kwargs.get('service_provider_id', None) - self.service_provider_display_name = kwargs.get('service_provider_display_name', None) - self.parameters = kwargs.get('parameters', None) - - -class ConnectionSettingResponseList(msrest.serialization.Model): - """The list of bot service connection settings response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param next_link: The link used to get the next page of bot service connection setting - resources. - :type next_link: str - :ivar value: Gets the list of bot service connection settings and their properties. - :vartype value: list[~azure.mgmt.botservice.models.ConnectionSetting] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ConnectionSetting]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectionSettingResponseList, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = None - - -class DirectLineChannel(Channel): - """Direct Line channel definition. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Direct Line channel resource. - :type properties: ~azure.mgmt.botservice.models.DirectLineChannelProperties - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'DirectLineChannelProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(DirectLineChannel, self).__init__(**kwargs) - self.channel_name = 'DirectLineChannel' # type: str - self.properties = kwargs.get('properties', None) - - -class DirectLineChannelProperties(msrest.serialization.Model): - """The parameters to provide for the Direct Line channel. - - :param sites: The list of Direct Line sites. - :type sites: list[~azure.mgmt.botservice.models.DirectLineSite] - """ - - _attribute_map = { - 'sites': {'key': 'sites', 'type': '[DirectLineSite]'}, - } - - def __init__( - self, - **kwargs - ): - super(DirectLineChannelProperties, self).__init__(**kwargs) - self.sites = kwargs.get('sites', None) - - -class DirectLineSite(msrest.serialization.Model): - """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 - :param site_name: Required. Site name. - :type 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 - :param is_enabled: Required. Whether this site is enabled for DirectLine channel. - :type is_enabled: bool - :param is_v1_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :type is_v1_enabled: bool - :param is_v3_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :type is_v3_enabled: bool - :param is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :type is_secure_site_enabled: bool - :param trusted_origins: List of Trusted Origin URLs for this site. This field is applicable - only if isSecureSiteEnabled is True. - :type trusted_origins: list[str] - """ - - _validation = { - 'site_id': {'readonly': True}, - 'site_name': {'required': True}, - 'key': {'readonly': True}, - 'key2': {'readonly': True}, - 'is_enabled': {'required': True}, - 'is_v1_enabled': {'required': True}, - 'is_v3_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_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]'}, - } - - def __init__( - self, - **kwargs - ): - super(DirectLineSite, self).__init__(**kwargs) - self.site_id = None - self.site_name = kwargs['site_name'] - self.key = None - self.key2 = None - self.is_enabled = kwargs['is_enabled'] - self.is_v1_enabled = kwargs['is_v1_enabled'] - self.is_v3_enabled = kwargs['is_v3_enabled'] - self.is_secure_site_enabled = kwargs.get('is_secure_site_enabled', None) - self.trusted_origins = kwargs.get('trusted_origins', None) - - -class DirectLineSpeechChannel(Channel): - """DirectLine Speech channel definition. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to DirectLine Speech channel resource. - :type properties: ~azure.mgmt.botservice.models.DirectLineSpeechChannelProperties - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'DirectLineSpeechChannelProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(DirectLineSpeechChannel, self).__init__(**kwargs) - self.channel_name = 'DirectLineSpeechChannel' # type: str - self.properties = kwargs.get('properties', None) - - -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. - - :param cognitive_services_subscription_id: Required. The cognitive service subscription ID to - use with this channel registration. - :type cognitive_services_subscription_id: str - :param is_enabled: Whether this channel is enabled or not. - :type is_enabled: bool - :param custom_voice_deployment_id: Custom speech model id (optional). - :type custom_voice_deployment_id: str - :param custom_speech_model_id: Custom voice deployment id (optional). - :type custom_speech_model_id: str - :param is_default_bot_for_cog_svc_account: Make this a default bot for chosen cognitive service - account. - :type is_default_bot_for_cog_svc_account: bool - """ - - _validation = { - 'cognitive_services_subscription_id': {'required': True}, - } - - _attribute_map = { - 'cognitive_services_subscription_id': {'key': 'cognitiveServicesSubscriptionId', 'type': 'str'}, - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - 'custom_voice_deployment_id': {'key': 'customVoiceDeploymentId', 'type': 'str'}, - 'custom_speech_model_id': {'key': 'customSpeechModelId', 'type': 'str'}, - 'is_default_bot_for_cog_svc_account': {'key': 'isDefaultBotForCogSvcAccount', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DirectLineSpeechChannelProperties, self).__init__(**kwargs) - self.cognitive_services_subscription_id = kwargs['cognitive_services_subscription_id'] - self.is_enabled = kwargs.get('is_enabled', None) - self.custom_voice_deployment_id = kwargs.get('custom_voice_deployment_id', None) - self.custom_speech_model_id = kwargs.get('custom_speech_model_id', None) - self.is_default_bot_for_cog_svc_account = kwargs.get('is_default_bot_for_cog_svc_account', None) - - -class EmailChannel(Channel): - """Email channel definition. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to email channel resource. - :type properties: ~azure.mgmt.botservice.models.EmailChannelProperties - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'EmailChannelProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(EmailChannel, self).__init__(**kwargs) - self.channel_name = 'EmailChannel' # type: str - self.properties = kwargs.get('properties', None) - - -class EmailChannelProperties(msrest.serialization.Model): - """The parameters to provide for the Email channel. - - All required parameters must be populated in order to send to Azure. - - :param email_address: Required. The email address. - :type email_address: str - :param password: The password for the email address. Value only returned through POST to the - action Channel List API, otherwise empty. - :type password: str - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool - """ - - _validation = { - 'email_address': {'required': True}, - 'is_enabled': {'required': True}, - } - - _attribute_map = { - 'email_address': {'key': 'emailAddress', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(EmailChannelProperties, self).__init__(**kwargs) - self.email_address = kwargs['email_address'] - self.password = kwargs.get('password', None) - self.is_enabled = kwargs['is_enabled'] - - -class Error(msrest.serialization.Model): - """Bot Service error object. - - :param error: The error body. - :type error: ~azure.mgmt.botservice.models.ErrorBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorBody'}, - } - - def __init__( - self, - **kwargs - ): - super(Error, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorBody(msrest.serialization.Model): - """Bot Service error body. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorBody, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - - -class FacebookChannel(Channel): - """Facebook channel definition. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to bot facebook channel. - :type properties: ~azure.mgmt.botservice.models.FacebookChannelProperties - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'FacebookChannelProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(FacebookChannel, self).__init__(**kwargs) - self.channel_name = 'FacebookChannel' # type: str - self.properties = kwargs.get('properties', None) - - -class FacebookChannelProperties(msrest.serialization.Model): - """The parameters to provide for the Facebook 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 verify_token: Verify token. Value only returned through POST to the action Channel List - API, otherwise empty. - :vartype verify_token: str - :param pages: The list of Facebook pages. - :type pages: list[~azure.mgmt.botservice.models.FacebookPage] - :param app_id: Required. Facebook application id. - :type app_id: str - :param app_secret: Facebook application secret. Value only returned through POST to the action - Channel List API, otherwise empty. - :type app_secret: str - :ivar callback_url: Callback Url. - :vartype callback_url: str - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool - """ - - _validation = { - 'verify_token': {'readonly': True}, - 'app_id': {'required': True}, - 'callback_url': {'readonly': True}, - 'is_enabled': {'required': True}, - } - - _attribute_map = { - 'verify_token': {'key': 'verifyToken', 'type': 'str'}, - 'pages': {'key': 'pages', 'type': '[FacebookPage]'}, - 'app_id': {'key': 'appId', 'type': 'str'}, - 'app_secret': {'key': 'appSecret', 'type': 'str'}, - 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(FacebookChannelProperties, self).__init__(**kwargs) - self.verify_token = None - self.pages = kwargs.get('pages', None) - self.app_id = kwargs['app_id'] - self.app_secret = kwargs.get('app_secret', None) - self.callback_url = None - self.is_enabled = kwargs['is_enabled'] - - -class FacebookPage(msrest.serialization.Model): - """A Facebook page for Facebook channel registration. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. Page id. - :type id: str - :param access_token: Facebook application access token. Value only returned through POST to the - action Channel List API, otherwise empty. - :type access_token: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'access_token': {'key': 'accessToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FacebookPage, self).__init__(**kwargs) - self.id = kwargs['id'] - self.access_token = kwargs.get('access_token', None) - - -class HostSettingsResponse(msrest.serialization.Model): - """The response body returned for a request to Bot Service Management to check per subscription hostSettings. - - :param o_auth_url: For in-conversation bot user authentication. - :type o_auth_url: str - :param to_bot_from_channel_open_id_metadata_url: For verifying incoming tokens from the - channels. - :type to_bot_from_channel_open_id_metadata_url: str - :param to_bot_from_channel_token_issuer: For verifying incoming tokens from the channels. - :type to_bot_from_channel_token_issuer: str - :param to_bot_from_emulator_open_id_metadata_url: For verifying incoming tokens from bot - emulator. - :type to_bot_from_emulator_open_id_metadata_url: str - :param to_channel_from_bot_login_url: For getting access token to channels from bot host. - :type to_channel_from_bot_login_url: str - :param to_channel_from_bot_o_auth_scope: For getting access token to channels from bot host. - :type to_channel_from_bot_o_auth_scope: str - :param validate_authority: Per cloud OAuth setting on whether authority is validated. - :type validate_authority: bool - :param bot_open_id_metadata: Same as ToBotFromChannelOpenIdMetadataUrl, used by SDK < v4.12. - :type bot_open_id_metadata: str - """ - - _attribute_map = { - 'o_auth_url': {'key': 'OAuthUrl', 'type': 'str'}, - 'to_bot_from_channel_open_id_metadata_url': {'key': 'ToBotFromChannelOpenIdMetadataUrl', 'type': 'str'}, - 'to_bot_from_channel_token_issuer': {'key': 'ToBotFromChannelTokenIssuer', 'type': 'str'}, - 'to_bot_from_emulator_open_id_metadata_url': {'key': 'ToBotFromEmulatorOpenIdMetadataUrl', 'type': 'str'}, - 'to_channel_from_bot_login_url': {'key': 'ToChannelFromBotLoginUrl', 'type': 'str'}, - 'to_channel_from_bot_o_auth_scope': {'key': 'ToChannelFromBotOAuthScope', 'type': 'str'}, - 'validate_authority': {'key': 'ValidateAuthority', 'type': 'bool'}, - 'bot_open_id_metadata': {'key': 'BotOpenIdMetadata', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HostSettingsResponse, self).__init__(**kwargs) - self.o_auth_url = kwargs.get('o_auth_url', None) - self.to_bot_from_channel_open_id_metadata_url = kwargs.get('to_bot_from_channel_open_id_metadata_url', None) - self.to_bot_from_channel_token_issuer = kwargs.get('to_bot_from_channel_token_issuer', None) - self.to_bot_from_emulator_open_id_metadata_url = kwargs.get('to_bot_from_emulator_open_id_metadata_url', None) - self.to_channel_from_bot_login_url = kwargs.get('to_channel_from_bot_login_url', None) - self.to_channel_from_bot_o_auth_scope = kwargs.get('to_channel_from_bot_o_auth_scope', None) - self.validate_authority = kwargs.get('validate_authority', None) - self.bot_open_id_metadata = kwargs.get('bot_open_id_metadata', None) - - -class KikChannel(Channel): - """Kik channel definition. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Kik channel resource. - :type properties: ~azure.mgmt.botservice.models.KikChannelProperties - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'KikChannelProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(KikChannel, self).__init__(**kwargs) - self.channel_name = 'KikChannel' # type: str - self.properties = kwargs.get('properties', None) - - -class KikChannelProperties(msrest.serialization.Model): - """The parameters to provide for the Kik channel. - - All required parameters must be populated in order to send to Azure. - - :param user_name: Required. The Kik user name. - :type user_name: str - :param api_key: Kik API key. Value only returned through POST to the action Channel List API, - otherwise empty. - :type api_key: str - :param is_validated: Whether this channel is validated for the bot. - :type is_validated: bool - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool - """ - - _validation = { - 'user_name': {'required': True}, - 'is_enabled': {'required': True}, - } - - _attribute_map = { - 'user_name': {'key': 'userName', 'type': 'str'}, - 'api_key': {'key': 'apiKey', 'type': 'str'}, - 'is_validated': {'key': 'isValidated', 'type': 'bool'}, - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(KikChannelProperties, self).__init__(**kwargs) - self.user_name = kwargs['user_name'] - self.api_key = kwargs.get('api_key', None) - self.is_validated = kwargs.get('is_validated', None) - self.is_enabled = kwargs['is_enabled'] - - -class LineChannel(Channel): - """Line channel definition. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to line channel resource. - :type properties: ~azure.mgmt.botservice.models.LineChannelProperties - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'LineChannelProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(LineChannel, self).__init__(**kwargs) - self.channel_name = 'LineChannel' # type: str - self.properties = kwargs.get('properties', None) - - -class LineChannelProperties(msrest.serialization.Model): - """The parameters to provide for the 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. - - :param line_registrations: Required. The list of line channel registrations. - :type line_registrations: list[~azure.mgmt.botservice.models.LineRegistration] - :ivar callback_url: Callback Url to enter in line registration. - :vartype callback_url: str - :ivar is_validated: Whether this channel is validated for the bot. - :vartype is_validated: bool - """ - - _validation = { - 'line_registrations': {'required': True}, - 'callback_url': {'readonly': True}, - 'is_validated': {'readonly': True}, - } - - _attribute_map = { - 'line_registrations': {'key': 'lineRegistrations', 'type': '[LineRegistration]'}, - 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, - 'is_validated': {'key': 'isValidated', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(LineChannelProperties, self).__init__(**kwargs) - self.line_registrations = kwargs['line_registrations'] - self.callback_url = None - self.is_validated = None - - -class LineRegistration(msrest.serialization.Model): - """The properties corresponding to a line channel registration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar generated_id: Id generated for the line channel registration. - :vartype generated_id: str - :param channel_secret: Secret for the line channel registration. - :type channel_secret: str - :param channel_access_token: Access token for the line channel registration. - :type channel_access_token: str - """ - - _validation = { - 'generated_id': {'readonly': True}, - } - - _attribute_map = { - 'generated_id': {'key': 'generatedId', 'type': 'str'}, - 'channel_secret': {'key': 'channelSecret', 'type': 'str'}, - 'channel_access_token': {'key': 'channelAccessToken', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LineRegistration, self).__init__(**kwargs) - self.generated_id = None - self.channel_secret = kwargs.get('channel_secret', None) - self.channel_access_token = kwargs.get('channel_access_token', None) - - -class MsTeamsChannel(Channel): - """Microsoft Teams channel definition. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Microsoft Teams channel resource. - :type properties: ~azure.mgmt.botservice.models.MsTeamsChannelProperties - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'MsTeamsChannelProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(MsTeamsChannel, self).__init__(**kwargs) - self.channel_name = 'MsTeamsChannel' # type: str - self.properties = kwargs.get('properties', None) - - -class MsTeamsChannelProperties(msrest.serialization.Model): - """The parameters to provide for the Microsoft Teams channel. - - All required parameters must be populated in order to send to Azure. - - :param enable_calling: Enable calling for Microsoft Teams channel. - :type enable_calling: bool - :param calling_web_hook: Webhook for Microsoft Teams channel calls. - :type calling_web_hook: str - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool - """ - - _validation = { - 'is_enabled': {'required': True}, - } - - _attribute_map = { - 'enable_calling': {'key': 'enableCalling', 'type': 'bool'}, - 'calling_web_hook': {'key': 'callingWebHook', 'type': 'str'}, - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(MsTeamsChannelProperties, self).__init__(**kwargs) - self.enable_calling = kwargs.get('enable_calling', None) - self.calling_web_hook = kwargs.get('calling_web_hook', None) - self.is_enabled = kwargs['is_enabled'] - - -class OperationDisplayInfo(msrest.serialization.Model): - """The operation supported by Bot Service Management. - - :param description: The description of the operation. - :type description: str - :param operation: The action that users can perform, based on their permission level. - :type operation: str - :param provider: Service provider: Microsoft Bot Service. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - """ - - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplayInfo, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.operation = kwargs.get('operation', None) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - - -class OperationEntity(msrest.serialization.Model): - """The operations supported by Bot Service Management. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The operation supported by Bot Service Management. - :type display: ~azure.mgmt.botservice.models.OperationDisplayInfo - :param origin: The origin of the operation. - :type origin: str - :param properties: Additional properties. - :type properties: any - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplayInfo'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationEntity, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -class OperationEntityListResult(msrest.serialization.Model): - """The list of bot service operation response. - - :param next_link: The link used to get the next page of operations. - :type next_link: str - :param value: The list of operations. - :type value: list[~azure.mgmt.botservice.models.OperationEntity] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[OperationEntity]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationEntityListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class ServiceProvider(msrest.serialization.Model): - """Service Provider Definition. - - :param properties: The Properties of a Service Provider Object. - :type properties: ~azure.mgmt.botservice.models.ServiceProviderProperties - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ServiceProviderProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceProvider, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -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. - - :ivar name: Name of the Service Provider. - :vartype name: str - :ivar type: Type of the Service Provider. - :vartype type: str - :ivar display_name: Display Name of the Service Provider. - :vartype display_name: str - :ivar description: Description of the Service Provider. - :vartype description: str - :ivar help_url: Help Url for the Service Provider. - :vartype help_url: str - :ivar default: Default Name for the Service Provider. - :vartype default: str - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'display_name': {'readonly': True}, - 'description': {'readonly': True}, - 'help_url': {'readonly': True}, - 'default': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'help_url': {'key': 'helpUrl', 'type': 'str'}, - 'default': {'key': 'default', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceProviderParameter, self).__init__(**kwargs) - self.name = None - self.type = None - self.display_name = None - self.description = None - self.help_url = None - self.default = None - - -class ServiceProviderProperties(msrest.serialization.Model): - """The Object used to describe a Service Provider supported by Bot Service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Id for Service Provider. - :vartype id: str - :ivar display_name: Display Name of the Service Provider. - :vartype display_name: str - :ivar service_provider_name: Display Name of the Service Provider. - :vartype service_provider_name: str - :ivar dev_portal_url: Display Name of the Service Provider. - :vartype dev_portal_url: str - :ivar icon_url: Display Name of the Service Provider. - :vartype icon_url: str - :param parameters: The list of parameters for the Service Provider. - :type parameters: list[~azure.mgmt.botservice.models.ServiceProviderParameter] - """ - - _validation = { - 'id': {'readonly': True}, - 'display_name': {'readonly': True}, - 'service_provider_name': {'readonly': True}, - 'dev_portal_url': {'readonly': True}, - 'icon_url': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'service_provider_name': {'key': 'serviceProviderName', 'type': 'str'}, - 'dev_portal_url': {'key': 'devPortalUrl', 'type': 'str'}, - 'icon_url': {'key': 'iconUrl', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '[ServiceProviderParameter]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceProviderProperties, self).__init__(**kwargs) - self.id = None - self.display_name = None - self.service_provider_name = None - self.dev_portal_url = None - self.icon_url = None - self.parameters = kwargs.get('parameters', None) - - -class ServiceProviderResponseList(msrest.serialization.Model): - """The list of bot service providers response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param next_link: The link used to get the next page of bot service providers. - :type next_link: str - :ivar value: Gets the list of bot service providers and their properties. - :vartype value: list[~azure.mgmt.botservice.models.ServiceProvider] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ServiceProvider]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceProviderResponseList, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = None - - -class SiteInfo(msrest.serialization.Model): - """Site information for WebChat or DirectLine Channels to identify which site to regenerate keys for. - - All required parameters must be populated in order to send to Azure. - - :param site_name: Required. The site name. - :type site_name: str - :param key: Required. Determines which key is to be regenerated. Possible values include: - "key1", "key2". - :type key: str or ~azure.mgmt.botservice.models.Key - """ - - _validation = { - 'site_name': {'required': True}, - 'key': {'required': True}, - } - - _attribute_map = { - 'site_name': {'key': 'siteName', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SiteInfo, self).__init__(**kwargs) - self.site_name = kwargs['site_name'] - self.key = kwargs['key'] - - -class Sku(msrest.serialization.Model): - """The SKU of the cognitive services account. - - 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. - - :param name: Required. The sku name. Possible values include: "F0", "S1". - :type 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", - "Standard". - :vartype tier: str or ~azure.mgmt.botservice.models.SkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None - - -class SkypeChannel(Channel): - """Skype channel definition. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Skype channel resource. - :type properties: ~azure.mgmt.botservice.models.SkypeChannelProperties - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'SkypeChannelProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(SkypeChannel, self).__init__(**kwargs) - self.channel_name = 'SkypeChannel' # type: str - self.properties = kwargs.get('properties', None) - - -class SkypeChannelProperties(msrest.serialization.Model): - """The parameters to provide for the Microsoft Teams channel. - - All required parameters must be populated in order to send to Azure. - - :param enable_messaging: Enable messaging for Skype channel. - :type enable_messaging: bool - :param enable_media_cards: Enable media cards for Skype channel. - :type enable_media_cards: bool - :param enable_video: Enable video for Skype channel. - :type enable_video: bool - :param enable_calling: Enable calling for Skype channel. - :type enable_calling: bool - :param enable_screen_sharing: Enable screen sharing for Skype channel. - :type enable_screen_sharing: bool - :param enable_groups: Enable groups for Skype channel. - :type enable_groups: bool - :param groups_mode: Group mode for Skype channel. - :type groups_mode: str - :param calling_web_hook: Calling web hook for Skype channel. - :type calling_web_hook: str - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool - """ - - _validation = { - 'is_enabled': {'required': True}, - } - - _attribute_map = { - 'enable_messaging': {'key': 'enableMessaging', 'type': 'bool'}, - 'enable_media_cards': {'key': 'enableMediaCards', 'type': 'bool'}, - 'enable_video': {'key': 'enableVideo', 'type': 'bool'}, - 'enable_calling': {'key': 'enableCalling', 'type': 'bool'}, - 'enable_screen_sharing': {'key': 'enableScreenSharing', 'type': 'bool'}, - 'enable_groups': {'key': 'enableGroups', 'type': 'bool'}, - 'groups_mode': {'key': 'groupsMode', 'type': 'str'}, - 'calling_web_hook': {'key': 'callingWebHook', 'type': 'str'}, - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SkypeChannelProperties, self).__init__(**kwargs) - self.enable_messaging = kwargs.get('enable_messaging', None) - self.enable_media_cards = kwargs.get('enable_media_cards', None) - self.enable_video = kwargs.get('enable_video', None) - self.enable_calling = kwargs.get('enable_calling', None) - self.enable_screen_sharing = kwargs.get('enable_screen_sharing', None) - self.enable_groups = kwargs.get('enable_groups', None) - self.groups_mode = kwargs.get('groups_mode', None) - self.calling_web_hook = kwargs.get('calling_web_hook', None) - self.is_enabled = kwargs['is_enabled'] - - -class SlackChannel(Channel): - """Slack channel definition. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Slack channel resource. - :type properties: ~azure.mgmt.botservice.models.SlackChannelProperties - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'SlackChannelProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(SlackChannel, self).__init__(**kwargs) - self.channel_name = 'SlackChannel' # type: str - self.properties = kwargs.get('properties', None) - - -class SlackChannelProperties(msrest.serialization.Model): - """The parameters to provide for the Slack 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. - - :param client_id: The Slack client id. - :type client_id: str - :param client_secret: The Slack client secret. Value only returned through POST to the action - Channel List API, otherwise empty. - :type client_secret: str - :param verification_token: The Slack verification token. Value only returned through POST to - the action Channel List API, otherwise empty. - :type verification_token: str - :param landing_page_url: The Slack landing page Url. - :type landing_page_url: str - :ivar redirect_action: The Slack redirect action. - :vartype redirect_action: str - :ivar last_submission_id: The Sms auth token. - :vartype last_submission_id: str - :ivar register_before_o_auth_flow: Whether to register the settings before OAuth validation is - performed. Recommended to True. - :vartype register_before_o_auth_flow: bool - :ivar is_validated: Whether this channel is validated for the bot. - :vartype is_validated: bool - :param signing_secret: The Slack signing secret. - :type signing_secret: str - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool - """ - - _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}, - } - - _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'client_secret': {'key': 'clientSecret', 'type': 'str'}, - 'verification_token': {'key': 'verificationToken', 'type': 'str'}, - 'landing_page_url': {'key': 'landingPageUrl', 'type': 'str'}, - 'redirect_action': {'key': 'redirectAction', 'type': 'str'}, - 'last_submission_id': {'key': 'lastSubmissionId', 'type': 'str'}, - 'register_before_o_auth_flow': {'key': 'registerBeforeOAuthFlow', 'type': 'bool'}, - 'is_validated': {'key': 'isValidated', 'type': 'bool'}, - 'signing_secret': {'key': 'signingSecret', 'type': 'str'}, - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SlackChannelProperties, self).__init__(**kwargs) - self.client_id = kwargs.get('client_id', None) - self.client_secret = kwargs.get('client_secret', None) - self.verification_token = kwargs.get('verification_token', None) - self.landing_page_url = kwargs.get('landing_page_url', None) - self.redirect_action = None - self.last_submission_id = None - self.register_before_o_auth_flow = None - self.is_validated = None - self.signing_secret = kwargs.get('signing_secret', None) - self.is_enabled = kwargs['is_enabled'] - - -class SmsChannel(Channel): - """Sms channel definition. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Sms channel resource. - :type properties: ~azure.mgmt.botservice.models.SmsChannelProperties - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'SmsChannelProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(SmsChannel, self).__init__(**kwargs) - self.channel_name = 'SmsChannel' # type: str - self.properties = kwargs.get('properties', None) - - -class SmsChannelProperties(msrest.serialization.Model): - """The parameters to provide for the Sms channel. - - All required parameters must be populated in order to send to Azure. - - :param phone: Required. The Sms phone. - :type phone: str - :param account_sid: Required. The Sms account SID. Value only returned through POST to the - action Channel List API, otherwise empty. - :type account_sid: str - :param auth_token: The Sms auth token. Value only returned through POST to the action Channel - List API, otherwise empty. - :type auth_token: str - :param is_validated: Whether this channel is validated for the bot. - :type is_validated: bool - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool - """ - - _validation = { - 'phone': {'required': True}, - 'account_sid': {'required': True}, - 'is_enabled': {'required': True}, - } - - _attribute_map = { - 'phone': {'key': 'phone', 'type': 'str'}, - 'account_sid': {'key': 'accountSID', 'type': 'str'}, - 'auth_token': {'key': 'authToken', 'type': 'str'}, - 'is_validated': {'key': 'isValidated', 'type': 'bool'}, - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SmsChannelProperties, self).__init__(**kwargs) - self.phone = kwargs['phone'] - self.account_sid = kwargs['account_sid'] - self.auth_token = kwargs.get('auth_token', None) - self.is_validated = kwargs.get('is_validated', None) - self.is_enabled = kwargs['is_enabled'] - - -class TelegramChannel(Channel): - """Telegram channel definition. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Telegram channel resource. - :type properties: ~azure.mgmt.botservice.models.TelegramChannelProperties - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'TelegramChannelProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(TelegramChannel, self).__init__(**kwargs) - self.channel_name = 'TelegramChannel' # type: str - self.properties = kwargs.get('properties', None) - - -class TelegramChannelProperties(msrest.serialization.Model): - """The parameters to provide for the Telegram channel. - - All required parameters must be populated in order to send to Azure. - - :param access_token: The Telegram access token. Value only returned through POST to the action - Channel List API, otherwise empty. - :type access_token: str - :param is_validated: Whether this channel is validated for the bot. - :type is_validated: bool - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool - """ - - _validation = { - 'is_enabled': {'required': True}, - } - - _attribute_map = { - 'access_token': {'key': 'accessToken', 'type': 'str'}, - 'is_validated': {'key': 'isValidated', 'type': 'bool'}, - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(TelegramChannelProperties, self).__init__(**kwargs) - self.access_token = kwargs.get('access_token', None) - self.is_validated = kwargs.get('is_validated', None) - self.is_enabled = kwargs['is_enabled'] - - -class WebChatChannel(Channel): - """Web Chat channel definition. - - All required parameters must be populated in order to send to Azure. - - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Web Chat channel resource. - :type properties: ~azure.mgmt.botservice.models.WebChatChannelProperties - """ - - _validation = { - 'channel_name': {'required': True}, - } - - _attribute_map = { - 'channel_name': {'key': 'channelName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'WebChatChannelProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(WebChatChannel, self).__init__(**kwargs) - self.channel_name = 'WebChatChannel' # type: str - self.properties = kwargs.get('properties', None) - - -class WebChatChannelProperties(msrest.serialization.Model): - """The parameters to provide for the Web Chat channel. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar web_chat_embed_code: Web chat control embed code. - :vartype web_chat_embed_code: str - :param sites: The list of Web Chat sites. - :type sites: list[~azure.mgmt.botservice.models.WebChatSite] - """ - - _validation = { - 'web_chat_embed_code': {'readonly': True}, - } - - _attribute_map = { - 'web_chat_embed_code': {'key': 'webChatEmbedCode', 'type': 'str'}, - 'sites': {'key': 'sites', 'type': '[WebChatSite]'}, - } - - def __init__( - self, - **kwargs - ): - super(WebChatChannelProperties, self).__init__(**kwargs) - self.web_chat_embed_code = None - self.sites = kwargs.get('sites', 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 - :param site_name: Required. Site name. - :type 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 - :param is_enabled: Required. Whether this site is enabled for DirectLine channel. - :type is_enabled: bool - :param enable_preview: Required. Whether this site is enabled for preview versions of Webchat. - :type enable_preview: bool - """ - - _validation = { - 'site_id': {'readonly': True}, - 'site_name': {'required': True}, - 'key': {'readonly': True}, - 'key2': {'readonly': True}, - 'is_enabled': {'required': True}, - 'enable_preview': {'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'}, - 'enable_preview': {'key': 'enablePreview', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(WebChatSite, self).__init__(**kwargs) - self.site_id = None - self.site_name = kwargs['site_name'] - self.key = None - self.key2 = None - self.is_enabled = kwargs['is_enabled'] - self.enable_preview = kwargs['enable_preview'] 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 cad036e43070..2a2e0667a445 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 @@ -20,18 +20,30 @@ class Channel(msrest.serialization.Model): 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. + 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. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str + :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'}, } _subtype_map = { @@ -40,39 +52,73 @@ class Channel(msrest.serialization.Model): def __init__( self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, **kwargs ): + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + """ super(Channel, self).__init__(**kwargs) self.channel_name = None # type: Optional[str] + self.etag = etag + self.provisioning_state = None + self.location = location class AlexaChannel(Channel): """Alexa 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. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Alexa channel resource. - :type properties: ~azure.mgmt.botservice.models.AlexaChannelProperties + :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 + :ivar properties: The set of properties specific to Alexa channel resource. + :vartype properties: ~azure.mgmt.botservice.models.AlexaChannelProperties """ _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'}, 'properties': {'key': 'properties', 'type': 'AlexaChannelProperties'}, } def __init__( self, *, + etag: Optional[str] = None, + location: Optional[str] = None, properties: Optional["AlexaChannelProperties"] = None, **kwargs ): - super(AlexaChannel, self).__init__(**kwargs) + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to Alexa channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.AlexaChannelProperties + """ + super(AlexaChannel, self).__init__(etag=etag, location=location, **kwargs) self.channel_name = 'AlexaChannel' # type: str self.properties = properties @@ -84,14 +130,14 @@ class AlexaChannelProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param alexa_skill_id: Required. The Alexa skill Id. - :type alexa_skill_id: str + :ivar alexa_skill_id: Required. The Alexa skill Id. + :vartype alexa_skill_id: str :ivar url_fragment: Url fragment used in part of the Uri configured in Alexa. :vartype url_fragment: str :ivar service_endpoint_uri: Full Uri used to configured the skill in Alexa. :vartype service_endpoint_uri: str - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool + :ivar is_enabled: Required. Whether this channel is enabled for the bot. + :vartype is_enabled: bool """ _validation = { @@ -115,6 +161,12 @@ def __init__( is_enabled: bool, **kwargs ): + """ + :keyword alexa_skill_id: Required. The Alexa skill Id. + :paramtype alexa_skill_id: str + :keyword is_enabled: Required. Whether this channel is enabled for the bot. + :paramtype is_enabled: bool + """ super(AlexaChannelProperties, self).__init__(**kwargs) self.alexa_skill_id = alexa_skill_id self.url_fragment = None @@ -131,25 +183,28 @@ class Resource(msrest.serialization.Model): :vartype id: str :ivar name: Specifies the name of the resource. :vartype name: str - :param location: Specifies the location of the resource. - :type location: str + :ivar location: Specifies the location of the resource. + :vartype location: str :ivar type: Specifies the type of the resource. :vartype type: str - :param tags: A set of tags. Contains resource tags defined as key/value pairs. - :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. - :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :ivar tags: A set of tags. Contains resource tags defined as key/value pairs. + :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", "designer", "bot", "function", "azurebot". - :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. - :type etag: str + :vartype kind: str or ~azure.mgmt.botservice.models.Kind + :ivar etag: Entity Tag. + :vartype etag: str + :ivar zones: Entity zones. + :vartype zones: list[str] """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'zones': {'readonly': True}, } _attribute_map = { @@ -161,6 +216,7 @@ class Resource(msrest.serialization.Model): 'sku': {'key': 'sku', 'type': 'Sku'}, 'kind': {'key': 'kind', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, } def __init__( @@ -173,6 +229,19 @@ def __init__( etag: Optional[str] = None, **kwargs ): + """ + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Contains resource tags defined as key/value pairs. + :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", + "designer", "bot", "function", "azurebot". + :paramtype kind: str or ~azure.mgmt.botservice.models.Kind + :keyword etag: Entity Tag. + :paramtype etag: str + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -182,6 +251,7 @@ def __init__( self.sku = sku self.kind = kind self.etag = etag + self.zones = None class Bot(Resource): @@ -193,27 +263,30 @@ class Bot(Resource): :vartype id: str :ivar name: Specifies the name of the resource. :vartype name: str - :param location: Specifies the location of the resource. - :type location: str + :ivar location: Specifies the location of the resource. + :vartype location: str :ivar type: Specifies the type of the resource. :vartype type: str - :param tags: A set of tags. Contains resource tags defined as key/value pairs. - :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. - :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :ivar tags: A set of tags. Contains resource tags defined as key/value pairs. + :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", "designer", "bot", "function", "azurebot". - :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. - :type etag: str - :param properties: The set of properties specific to bot resource. - :type properties: ~azure.mgmt.botservice.models.BotProperties + :vartype kind: str or ~azure.mgmt.botservice.models.Kind + :ivar etag: Entity Tag. + :vartype etag: str + :ivar zones: Entity zones. + :vartype zones: list[str] + :ivar properties: The set of properties specific to bot resource. + :vartype properties: ~azure.mgmt.botservice.models.BotProperties """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'zones': {'readonly': True}, } _attribute_map = { @@ -225,6 +298,7 @@ class Bot(Resource): 'sku': {'key': 'sku', 'type': 'Sku'}, 'kind': {'key': 'kind', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, 'properties': {'key': 'properties', 'type': 'BotProperties'}, } @@ -239,6 +313,21 @@ def __init__( properties: Optional["BotProperties"] = None, **kwargs ): + """ + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Contains resource tags defined as key/value pairs. + :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", + "designer", "bot", "function", "azurebot". + :paramtype kind: str or ~azure.mgmt.botservice.models.Kind + :keyword etag: Entity Tag. + :paramtype etag: str + :keyword properties: The set of properties specific to bot resource. + :paramtype properties: ~azure.mgmt.botservice.models.BotProperties + """ super(Bot, self).__init__(location=location, tags=tags, sku=sku, kind=kind, etag=etag, **kwargs) self.properties = properties @@ -252,27 +341,30 @@ class BotChannel(Resource): :vartype id: str :ivar name: Specifies the name of the resource. :vartype name: str - :param location: Specifies the location of the resource. - :type location: str + :ivar location: Specifies the location of the resource. + :vartype location: str :ivar type: Specifies the type of the resource. :vartype type: str - :param tags: A set of tags. Contains resource tags defined as key/value pairs. - :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. - :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :ivar tags: A set of tags. Contains resource tags defined as key/value pairs. + :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", "designer", "bot", "function", "azurebot". - :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. - :type etag: str - :param properties: The set of properties specific to bot channel resource. - :type properties: ~azure.mgmt.botservice.models.Channel + :vartype kind: str or ~azure.mgmt.botservice.models.Kind + :ivar etag: Entity Tag. + :vartype etag: str + :ivar zones: Entity zones. + :vartype zones: list[str] + :ivar properties: The set of properties specific to bot channel resource. + :vartype properties: ~azure.mgmt.botservice.models.Channel """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'zones': {'readonly': True}, } _attribute_map = { @@ -284,6 +376,7 @@ class BotChannel(Resource): 'sku': {'key': 'sku', 'type': 'Sku'}, 'kind': {'key': 'kind', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, 'properties': {'key': 'properties', 'type': 'Channel'}, } @@ -298,6 +391,21 @@ def __init__( properties: Optional["Channel"] = None, **kwargs ): + """ + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Contains resource tags defined as key/value pairs. + :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", + "designer", "bot", "function", "azurebot". + :paramtype kind: str or ~azure.mgmt.botservice.models.Kind + :keyword etag: Entity Tag. + :paramtype etag: str + :keyword properties: The set of properties specific to bot channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.Channel + """ super(BotChannel, self).__init__(location=location, tags=tags, sku=sku, kind=kind, etag=etag, **kwargs) self.properties = properties @@ -309,40 +417,81 @@ class BotProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param display_name: Required. The Name of the bot. - :type display_name: str - :param description: The description of the bot. - :type description: str - :param icon_url: The Icon Url of the bot. - :type icon_url: str - :param endpoint: Required. The bot's endpoint. - :type endpoint: str + :ivar display_name: Required. The Name of the bot. + :vartype display_name: str + :ivar description: The description of the bot. + :vartype description: str + :ivar icon_url: The Icon Url of the bot. + :vartype icon_url: str + :ivar endpoint: Required. The bot's endpoint. + :vartype endpoint: str :ivar endpoint_version: The bot's endpoint version. :vartype endpoint_version: str - :param msa_app_id: Required. Microsoft App Id for the bot. - :type msa_app_id: str + :ivar all_settings: Contains resource all settings defined as key/value pairs. + :vartype all_settings: dict[str, str] + :ivar parameters: Contains resource parameters defined as key/value pairs. + :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", + "SingleTenant", "MultiTenant". + :vartype msa_app_type: str or ~azure.mgmt.botservice.models.MsaAppType + :ivar msa_app_id: Required. Microsoft App Id for the bot. + :vartype msa_app_id: str + :ivar msa_app_tenant_id: Microsoft App Tenant Id for the bot. + :vartype msa_app_tenant_id: str + :ivar msa_app_msi_resource_id: Microsoft App Managed Identity Resource Id for the bot. + :vartype msa_app_msi_resource_id: str :ivar configured_channels: Collection of channels for which the bot is configured. :vartype configured_channels: list[str] :ivar enabled_channels: Collection of channels for which the bot is enabled. :vartype enabled_channels: list[str] - :param developer_app_insight_key: The Application Insights key. - :type developer_app_insight_key: str - :param developer_app_insights_api_key: The Application Insights Api Key. - :type developer_app_insights_api_key: str - :param developer_app_insights_application_id: The Application Insights App Id. - :type developer_app_insights_application_id: str - :param luis_app_ids: Collection of LUIS App Ids. - :type luis_app_ids: list[str] - :param luis_key: The LUIS Key. - :type luis_key: str - :param is_cmek_enabled: Whether Cmek is enabled. - :type is_cmek_enabled: bool - :param cmek_key_vault_url: The CMK Url. - :type cmek_key_vault_url: str - :param is_isolated: Whether the bot is in an isolated network. - :type is_isolated: bool - :param schema_transformation_version: The channel schema transformation version for the bot. - :type schema_transformation_version: str + :ivar developer_app_insight_key: The Application Insights key. + :vartype developer_app_insight_key: str + :ivar developer_app_insights_api_key: The Application Insights Api Key. + :vartype developer_app_insights_api_key: str + :ivar developer_app_insights_application_id: The Application Insights App Id. + :vartype developer_app_insights_application_id: str + :ivar luis_app_ids: Collection of LUIS App Ids. + :vartype luis_app_ids: list[str] + :ivar luis_key: The LUIS Key. + :vartype luis_key: str + :ivar is_cmek_enabled: Whether Cmek is enabled. + :vartype is_cmek_enabled: bool + :ivar cmek_key_vault_url: The CMK Url. + :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". + :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 + :ivar is_developer_app_insights_api_key_set: Whether the bot is developerAppInsightsApiKey set. + :vartype is_developer_app_insights_api_key_set: bool + :ivar migration_token: Token used to migrate non Azure bot to azure subscription. + :vartype migration_token: str + :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :vartype disable_local_auth: bool + :ivar schema_transformation_version: The channel schema transformation version for the bot. + :vartype schema_transformation_version: str + :ivar storage_resource_id: The storage resourceId for the bot. + :vartype storage_resource_id: str + :ivar private_endpoint_connections: List of Private Endpoint Connections configured for the + bot. + :vartype private_endpoint_connections: + list[~azure.mgmt.botservice.models.PrivateEndpointConnection] + :ivar open_with_hint: The hint to browser (e.g. protocol handler) on how to open the bot for + authoring. + :vartype open_with_hint: str + :ivar app_password_hint: The hint (e.g. keyVault secret resourceId) on how to fetch the app + secret. + :vartype app_password_hint: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar publishing_credentials: Publishing credentials of the resource. + :vartype publishing_credentials: str """ _validation = { @@ -352,6 +501,9 @@ class BotProperties(msrest.serialization.Model): 'msa_app_id': {'required': True}, 'configured_channels': {'readonly': True}, 'enabled_channels': {'readonly': True}, + 'migration_token': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { @@ -360,7 +512,13 @@ class BotProperties(msrest.serialization.Model): 'icon_url': {'key': 'iconUrl', 'type': 'str'}, 'endpoint': {'key': 'endpoint', 'type': 'str'}, 'endpoint_version': {'key': 'endpointVersion', 'type': 'str'}, + 'all_settings': {'key': 'allSettings', 'type': '{str}'}, + 'parameters': {'key': 'parameters', 'type': '{str}'}, + 'manifest_url': {'key': 'manifestUrl', 'type': 'str'}, + 'msa_app_type': {'key': 'msaAppType', 'type': 'str'}, 'msa_app_id': {'key': 'msaAppId', 'type': 'str'}, + 'msa_app_tenant_id': {'key': 'msaAppTenantId', 'type': 'str'}, + 'msa_app_msi_resource_id': {'key': 'msaAppMSIResourceId', 'type': 'str'}, 'configured_channels': {'key': 'configuredChannels', 'type': '[str]'}, 'enabled_channels': {'key': 'enabledChannels', 'type': '[str]'}, 'developer_app_insight_key': {'key': 'developerAppInsightKey', 'type': 'str'}, @@ -370,8 +528,19 @@ class BotProperties(msrest.serialization.Model): 'luis_key': {'key': 'luisKey', 'type': 'str'}, 'is_cmek_enabled': {'key': 'isCmekEnabled', 'type': 'bool'}, 'cmek_key_vault_url': {'key': 'cmekKeyVaultUrl', 'type': 'str'}, - 'is_isolated': {'key': 'isIsolated', 'type': 'bool'}, + 'cmek_encryption_status': {'key': 'cmekEncryptionStatus', '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'}, + 'migration_token': {'key': 'migrationToken', 'type': 'str'}, + 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, 'schema_transformation_version': {'key': 'schemaTransformationVersion', 'type': 'str'}, + 'storage_resource_id': {'key': 'storageResourceId', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'open_with_hint': {'key': 'openWithHint', 'type': 'str'}, + 'app_password_hint': {'key': 'appPasswordHint', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'publishing_credentials': {'key': 'publishingCredentials', 'type': 'str'}, } def __init__( @@ -382,6 +551,12 @@ def __init__( msa_app_id: str, description: Optional[str] = None, icon_url: Optional[str] = None, + 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_tenant_id: Optional[str] = None, + msa_app_msi_resource_id: Optional[str] = None, developer_app_insight_key: Optional[str] = None, developer_app_insights_api_key: Optional[str] = None, developer_app_insights_application_id: Optional[str] = None, @@ -389,17 +564,95 @@ def __init__( luis_key: Optional[str] = None, is_cmek_enabled: Optional[bool] = None, cmek_key_vault_url: Optional[str] = None, - is_isolated: Optional[bool] = None, + cmek_encryption_status: Optional[str] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", + is_streaming_supported: Optional[bool] = None, + is_developer_app_insights_api_key_set: Optional[bool] = None, + disable_local_auth: Optional[bool] = None, schema_transformation_version: Optional[str] = None, + storage_resource_id: Optional[str] = None, + open_with_hint: Optional[str] = None, + app_password_hint: Optional[str] = None, + publishing_credentials: Optional[str] = None, **kwargs ): + """ + :keyword display_name: Required. The Name of the bot. + :paramtype display_name: str + :keyword description: The description of the bot. + :paramtype description: str + :keyword icon_url: The Icon Url of the bot. + :paramtype icon_url: str + :keyword endpoint: Required. The bot's endpoint. + :paramtype endpoint: str + :keyword all_settings: Contains resource all settings defined as key/value pairs. + :paramtype all_settings: dict[str, str] + :keyword parameters: Contains resource parameters defined as key/value pairs. + :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". + :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 + :keyword msa_app_tenant_id: Microsoft App Tenant Id for the bot. + :paramtype msa_app_tenant_id: str + :keyword msa_app_msi_resource_id: Microsoft App Managed Identity Resource Id for the bot. + :paramtype msa_app_msi_resource_id: str + :keyword developer_app_insight_key: The Application Insights key. + :paramtype developer_app_insight_key: str + :keyword developer_app_insights_api_key: The Application Insights Api Key. + :paramtype developer_app_insights_api_key: str + :keyword developer_app_insights_application_id: The Application Insights App Id. + :paramtype developer_app_insights_application_id: str + :keyword luis_app_ids: Collection of LUIS App Ids. + :paramtype luis_app_ids: list[str] + :keyword luis_key: The LUIS Key. + :paramtype luis_key: str + :keyword is_cmek_enabled: Whether Cmek is enabled. + :paramtype is_cmek_enabled: bool + :keyword cmek_key_vault_url: The CMK Url. + :paramtype cmek_key_vault_url: str + :keyword cmek_encryption_status: The CMK encryption status. + :paramtype cmek_encryption_status: str + :keyword public_network_access: Whether the bot is in an isolated network. Possible values + include: "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 + :keyword is_developer_app_insights_api_key_set: Whether the bot is developerAppInsightsApiKey + set. + :paramtype is_developer_app_insights_api_key_set: bool + :keyword disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :paramtype disable_local_auth: bool + :keyword schema_transformation_version: The channel schema transformation version for the bot. + :paramtype schema_transformation_version: str + :keyword storage_resource_id: The storage resourceId for the bot. + :paramtype storage_resource_id: str + :keyword open_with_hint: The hint to browser (e.g. protocol handler) on how to open the bot for + authoring. + :paramtype open_with_hint: str + :keyword app_password_hint: The hint (e.g. keyVault secret resourceId) on how to fetch the app + secret. + :paramtype app_password_hint: str + :keyword publishing_credentials: Publishing credentials of the resource. + :paramtype publishing_credentials: str + """ super(BotProperties, self).__init__(**kwargs) self.display_name = display_name self.description = description self.icon_url = icon_url self.endpoint = endpoint self.endpoint_version = None + self.all_settings = all_settings + self.parameters = parameters + self.manifest_url = manifest_url + self.msa_app_type = msa_app_type self.msa_app_id = msa_app_id + self.msa_app_tenant_id = msa_app_tenant_id + self.msa_app_msi_resource_id = msa_app_msi_resource_id self.configured_channels = None self.enabled_channels = None self.developer_app_insight_key = developer_app_insight_key @@ -409,8 +662,19 @@ def __init__( self.luis_key = luis_key self.is_cmek_enabled = is_cmek_enabled self.cmek_key_vault_url = cmek_key_vault_url - self.is_isolated = is_isolated + self.cmek_encryption_status = cmek_encryption_status + self.public_network_access = public_network_access + self.is_streaming_supported = is_streaming_supported + self.is_developer_app_insights_api_key_set = is_developer_app_insights_api_key_set + self.migration_token = None + self.disable_local_auth = disable_local_auth self.schema_transformation_version = schema_transformation_version + self.storage_resource_id = storage_resource_id + self.private_endpoint_connections = None + self.open_with_hint = open_with_hint + self.app_password_hint = app_password_hint + self.provisioning_state = None + self.publishing_credentials = publishing_credentials class BotResponseList(msrest.serialization.Model): @@ -418,8 +682,8 @@ class BotResponseList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param next_link: The link used to get the next page of bot service resources. - :type next_link: str + :ivar next_link: The link used to get the next page of bot service resources. + :vartype next_link: str :ivar value: Gets the list of bot service results and their properties. :vartype value: list[~azure.mgmt.botservice.models.Bot] """ @@ -439,6 +703,10 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: The link used to get the next page of bot service resources. + :paramtype next_link: str + """ super(BotResponseList, self).__init__(**kwargs) self.next_link = next_link self.value = None @@ -449,8 +717,8 @@ class ChannelResponseList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param next_link: The link used to get the next page of bot service channel resources. - :type next_link: str + :ivar next_link: The link used to get the next page of bot service channel resources. + :vartype next_link: str :ivar value: Gets the list of bot service channel results and their properties. :vartype value: list[~azure.mgmt.botservice.models.BotChannel] """ @@ -470,18 +738,105 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: The link used to get the next page of bot service channel resources. + :paramtype next_link: str + """ super(ChannelResponseList, self).__init__(**kwargs) self.next_link = next_link self.value = None +class ChannelSettings(msrest.serialization.Model): + """Channel settings definition. + + :ivar extension_key1: The extensionKey1. + :vartype extension_key1: str + :ivar extension_key2: The extensionKey2. + :vartype extension_key2: str + :ivar sites: The list of sites. + :vartype sites: list[~azure.mgmt.botservice.models.Site] + :ivar channel_id: The channel id. + :vartype channel_id: str + :ivar channel_display_name: The channel display name. + :vartype channel_display_name: str + :ivar bot_id: The bot id. + :vartype bot_id: str + :ivar bot_icon_url: The bot icon url. + :vartype bot_icon_url: str + :ivar is_enabled: Whether this channel is enabled for the bot. + :vartype is_enabled: bool + :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :vartype disable_local_auth: bool + """ + + _attribute_map = { + 'extension_key1': {'key': 'extensionKey1', 'type': 'str'}, + 'extension_key2': {'key': 'extensionKey2', 'type': 'str'}, + 'sites': {'key': 'sites', 'type': '[Site]'}, + 'channel_id': {'key': 'channelId', 'type': 'str'}, + 'channel_display_name': {'key': 'channelDisplayName', 'type': 'str'}, + 'bot_id': {'key': 'botId', 'type': 'str'}, + 'bot_icon_url': {'key': 'botIconUrl', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, + } + + def __init__( + self, + *, + extension_key1: Optional[str] = None, + extension_key2: Optional[str] = None, + sites: Optional[List["Site"]] = None, + channel_id: Optional[str] = None, + channel_display_name: Optional[str] = None, + bot_id: Optional[str] = None, + bot_icon_url: Optional[str] = None, + is_enabled: Optional[bool] = None, + disable_local_auth: Optional[bool] = None, + **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. + :paramtype channel_id: str + :keyword channel_display_name: The channel display name. + :paramtype channel_display_name: str + :keyword bot_id: The bot id. + :paramtype bot_id: str + :keyword bot_icon_url: The bot icon url. + :paramtype bot_icon_url: str + :keyword is_enabled: Whether this channel is enabled for the bot. + :paramtype is_enabled: bool + :keyword disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :paramtype disable_local_auth: bool + """ + super(ChannelSettings, self).__init__(**kwargs) + self.extension_key1 = extension_key1 + self.extension_key2 = extension_key2 + self.sites = sites + self.channel_id = channel_id + self.channel_display_name = channel_display_name + self.bot_id = bot_id + self.bot_icon_url = bot_icon_url + self.is_enabled = is_enabled + self.disable_local_auth = disable_local_auth + + class CheckNameAvailabilityRequestBody(msrest.serialization.Model): """The request body for a request to Bot Service Management to check availability of a bot name. - :param name: the name of the bot for which availability needs to be checked. - :type name: str - :param type: the type of the bot for which availability needs to be checked. - :type type: str + :ivar name: the name of the bot for which availability needs to be checked. + :vartype name: str + :ivar type: the type of the bot for which availability needs to be checked. + :vartype type: str """ _attribute_map = { @@ -496,6 +851,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword name: the name of the bot for which availability needs to be checked. + :paramtype name: str + :keyword type: the type of the bot for which availability needs to be checked. + :paramtype type: str + """ super(CheckNameAvailabilityRequestBody, self).__init__(**kwargs) self.name = name self.type = type @@ -504,11 +865,11 @@ def __init__( class CheckNameAvailabilityResponseBody(msrest.serialization.Model): """The response body returned for a request to Bot Service Management to check availability of a bot name. - :param valid: indicates if the bot name is valid. - :type valid: bool - :param message: additional message from the bot management api showing why a bot name is not + :ivar valid: indicates if the bot name is valid. + :vartype valid: bool + :ivar message: additional message from the bot management api showing why a bot name is not available. - :type message: str + :vartype message: str """ _attribute_map = { @@ -523,6 +884,13 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword valid: indicates if the bot name is valid. + :paramtype valid: bool + :keyword message: additional message from the bot management api showing why a bot name is not + available. + :paramtype message: str + """ super(CheckNameAvailabilityResponseBody, self).__init__(**kwargs) self.valid = valid self.message = message @@ -549,6 +917,8 @@ def __init__( self, **kwargs ): + """ + """ super(ConnectionItemName, self).__init__(**kwargs) self.name = None @@ -562,27 +932,30 @@ class ConnectionSetting(Resource): :vartype id: str :ivar name: Specifies the name of the resource. :vartype name: str - :param location: Specifies the location of the resource. - :type location: str + :ivar location: Specifies the location of the resource. + :vartype location: str :ivar type: Specifies the type of the resource. :vartype type: str - :param tags: A set of tags. Contains resource tags defined as key/value pairs. - :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. - :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. Possible values include: "sdk", + :ivar tags: A set of tags. Contains resource tags defined as key/value pairs. + :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", "designer", "bot", "function", "azurebot". - :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. - :type etag: str - :param properties: The set of properties specific to bot channel resource. - :type properties: ~azure.mgmt.botservice.models.ConnectionSettingProperties + :vartype kind: str or ~azure.mgmt.botservice.models.Kind + :ivar etag: Entity Tag. + :vartype etag: str + :ivar zones: Entity zones. + :vartype zones: list[str] + :ivar properties: The set of properties specific to bot channel resource. + :vartype properties: ~azure.mgmt.botservice.models.ConnectionSettingProperties """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'zones': {'readonly': True}, } _attribute_map = { @@ -594,6 +967,7 @@ class ConnectionSetting(Resource): 'sku': {'key': 'sku', 'type': 'Sku'}, 'kind': {'key': 'kind', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, 'properties': {'key': 'properties', 'type': 'ConnectionSettingProperties'}, } @@ -608,6 +982,21 @@ def __init__( properties: Optional["ConnectionSettingProperties"] = None, **kwargs ): + """ + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Contains resource tags defined as key/value pairs. + :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", + "designer", "bot", "function", "azurebot". + :paramtype kind: str or ~azure.mgmt.botservice.models.Kind + :keyword etag: Entity Tag. + :paramtype etag: str + :keyword properties: The set of properties specific to bot channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.ConnectionSettingProperties + """ super(ConnectionSetting, self).__init__(location=location, tags=tags, sku=sku, kind=kind, etag=etag, **kwargs) self.properties = properties @@ -615,10 +1004,10 @@ def __init__( class ConnectionSettingParameter(msrest.serialization.Model): """Extra Parameter in a Connection Setting Properties to indicate service provider specific properties. - :param key: Key for the Connection Setting Parameter. - :type key: str - :param value: Value associated with the Connection Setting Parameter. - :type value: str + :ivar key: Key for the Connection Setting Parameter. + :vartype key: str + :ivar value: Value associated with the Connection Setting Parameter. + :vartype value: str """ _attribute_map = { @@ -633,6 +1022,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword key: Key for the Connection Setting Parameter. + :paramtype key: str + :keyword value: Value associated with the Connection Setting Parameter. + :paramtype value: str + """ super(ConnectionSettingParameter, self).__init__(**kwargs) self.key = key self.value = value @@ -643,21 +1038,27 @@ class ConnectionSettingProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param client_id: Client Id associated with the Connection Setting. - :type client_id: str + :ivar id: Id associated with the Connection Setting. + :vartype id: str + :ivar name: Name associated with the Connection Setting. + :vartype name: str + :ivar client_id: Client Id associated with the Connection Setting. + :vartype client_id: str :ivar setting_id: Setting Id set by the service for the Connection Setting. :vartype setting_id: str - :param client_secret: Client Secret associated with the Connection Setting. - :type client_secret: str - :param scopes: Scopes associated with the Connection Setting. - :type scopes: str - :param service_provider_id: Service Provider Id associated with the Connection Setting. - :type service_provider_id: str - :param service_provider_display_name: Service Provider Display Name associated with the + :ivar client_secret: Client Secret associated with the Connection Setting. + :vartype client_secret: str + :ivar scopes: Scopes associated with the Connection Setting. + :vartype scopes: str + :ivar service_provider_id: Service Provider Id associated with the Connection Setting. + :vartype service_provider_id: str + :ivar service_provider_display_name: Service Provider Display Name associated with the Connection Setting. - :type service_provider_display_name: str - :param parameters: Service Provider Parameters associated with the Connection Setting. - :type parameters: list[~azure.mgmt.botservice.models.ConnectionSettingParameter] + :vartype service_provider_display_name: str + :ivar parameters: Service Provider Parameters associated with the Connection Setting. + :vartype parameters: list[~azure.mgmt.botservice.models.ConnectionSettingParameter] + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str """ _validation = { @@ -665,6 +1066,8 @@ class ConnectionSettingProperties(msrest.serialization.Model): } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, 'setting_id': {'key': 'settingId', 'type': 'str'}, 'client_secret': {'key': 'clientSecret', 'type': 'str'}, @@ -672,20 +1075,47 @@ class ConnectionSettingProperties(msrest.serialization.Model): 'service_provider_id': {'key': 'serviceProviderId', 'type': 'str'}, 'service_provider_display_name': {'key': 'serviceProviderDisplayName', 'type': 'str'}, 'parameters': {'key': 'parameters', 'type': '[ConnectionSettingParameter]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, } def __init__( self, *, + id: Optional[str] = None, + name: Optional[str] = None, client_id: Optional[str] = None, client_secret: Optional[str] = None, scopes: Optional[str] = None, service_provider_id: Optional[str] = None, service_provider_display_name: Optional[str] = None, parameters: Optional[List["ConnectionSettingParameter"]] = None, + provisioning_state: Optional[str] = None, **kwargs ): + """ + :keyword id: Id associated with the Connection Setting. + :paramtype id: str + :keyword name: Name associated with the Connection Setting. + :paramtype name: str + :keyword client_id: Client Id associated with the Connection Setting. + :paramtype client_id: str + :keyword client_secret: Client Secret associated with the Connection Setting. + :paramtype client_secret: str + :keyword scopes: Scopes associated with the Connection Setting. + :paramtype scopes: str + :keyword service_provider_id: Service Provider Id associated with the Connection Setting. + :paramtype service_provider_id: str + :keyword service_provider_display_name: Service Provider Display Name associated with the + Connection Setting. + :paramtype service_provider_display_name: str + :keyword parameters: Service Provider Parameters associated with the Connection Setting. + :paramtype parameters: list[~azure.mgmt.botservice.models.ConnectionSettingParameter] + :keyword provisioning_state: Provisioning state of the resource. + :paramtype provisioning_state: str + """ super(ConnectionSettingProperties, self).__init__(**kwargs) + self.id = id + self.name = name self.client_id = client_id self.setting_id = None self.client_secret = client_secret @@ -693,6 +1123,7 @@ def __init__( self.service_provider_id = service_provider_id self.service_provider_display_name = service_provider_display_name self.parameters = parameters + self.provisioning_state = provisioning_state class ConnectionSettingResponseList(msrest.serialization.Model): @@ -700,9 +1131,9 @@ class ConnectionSettingResponseList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param next_link: The link used to get the next page of bot service connection setting + :ivar next_link: The link used to get the next page of bot service connection setting resources. - :type next_link: str + :vartype next_link: str :ivar value: Gets the list of bot service connection settings and their properties. :vartype value: list[~azure.mgmt.botservice.models.ConnectionSetting] """ @@ -722,6 +1153,11 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: The link used to get the next page of bot service connection setting + resources. + :paramtype next_link: str + """ super(ConnectionSettingResponseList, self).__init__(**kwargs) self.next_link = next_link self.value = None @@ -730,30 +1166,52 @@ def __init__( class DirectLineChannel(Channel): """Direct Line 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. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Direct Line channel resource. - :type properties: ~azure.mgmt.botservice.models.DirectLineChannelProperties + :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 + :ivar properties: The set of properties specific to Direct Line channel resource. + :vartype properties: ~azure.mgmt.botservice.models.DirectLineChannelProperties """ _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'}, 'properties': {'key': 'properties', 'type': 'DirectLineChannelProperties'}, } def __init__( self, *, + etag: Optional[str] = None, + location: Optional[str] = None, properties: Optional["DirectLineChannelProperties"] = None, **kwargs ): - super(DirectLineChannel, self).__init__(**kwargs) + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to Direct Line channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.DirectLineChannelProperties + """ + super(DirectLineChannel, self).__init__(etag=etag, location=location, **kwargs) self.channel_name = 'DirectLineChannel' # type: str self.properties = properties @@ -761,22 +1219,33 @@ def __init__( class DirectLineChannelProperties(msrest.serialization.Model): """The parameters to provide for the Direct Line channel. - :param sites: The list of Direct Line sites. - :type sites: list[~azure.mgmt.botservice.models.DirectLineSite] + :ivar sites: The list of Direct Line sites. + :vartype sites: list[~azure.mgmt.botservice.models.DirectLineSite] + :ivar direct_line_embed_code: Direct Line embed code of the resource. + :vartype direct_line_embed_code: str """ _attribute_map = { 'sites': {'key': 'sites', 'type': '[DirectLineSite]'}, + 'direct_line_embed_code': {'key': 'DirectLineEmbedCode', 'type': 'str'}, } def __init__( self, *, sites: Optional[List["DirectLineSite"]] = None, + direct_line_embed_code: Optional[str] = None, **kwargs ): + """ + :keyword sites: The list of Direct Line sites. + :paramtype sites: list[~azure.mgmt.botservice.models.DirectLineSite] + :keyword direct_line_embed_code: Direct Line embed code of the resource. + :paramtype direct_line_embed_code: str + """ super(DirectLineChannelProperties, self).__init__(**kwargs) self.sites = sites + self.direct_line_embed_code = direct_line_embed_code class DirectLineSite(msrest.serialization.Model): @@ -788,26 +1257,28 @@ class DirectLineSite(msrest.serialization.Model): :ivar site_id: Site Id. :vartype site_id: str - :param site_name: Required. Site name. - :type site_name: 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 - :param is_enabled: Required. Whether this site is enabled for DirectLine channel. - :type is_enabled: bool - :param is_v1_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :type is_v1_enabled: bool - :param is_v3_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :type is_v3_enabled: bool - :param is_secure_site_enabled: Whether this site is enabled for authentication with Bot + :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. + :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. - :type is_secure_site_enabled: bool - :param trusted_origins: List of Trusted Origin URLs for this site. This field is applicable - only if isSecureSiteEnabled is True. - :type trusted_origins: list[str] + :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] """ _validation = { @@ -829,6 +1300,7 @@ class DirectLineSite(msrest.serialization.Model): '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]'}, } @@ -840,9 +1312,28 @@ def __init__( is_v1_enabled: bool, is_v3_enabled: bool, is_secure_site_enabled: Optional[bool] = None, + is_block_user_upload_enabled: Optional[bool] = None, trusted_origins: Optional[List[str]] = None, **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_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] + """ super(DirectLineSite, self).__init__(**kwargs) self.site_id = None self.site_name = site_name @@ -852,36 +1343,59 @@ def __init__( 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 class DirectLineSpeechChannel(Channel): """DirectLine Speech channel definition. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to DirectLine Speech channel resource. - :type properties: ~azure.mgmt.botservice.models.DirectLineSpeechChannelProperties + :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 + :ivar properties: The set of properties specific to DirectLine Speech channel resource. + :vartype properties: ~azure.mgmt.botservice.models.DirectLineSpeechChannelProperties """ _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'}, 'properties': {'key': 'properties', 'type': 'DirectLineSpeechChannelProperties'}, } def __init__( self, *, + etag: Optional[str] = None, + location: Optional[str] = None, properties: Optional["DirectLineSpeechChannelProperties"] = None, **kwargs ): - super(DirectLineSpeechChannel, self).__init__(**kwargs) + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to DirectLine Speech channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.DirectLineSpeechChannelProperties + """ + super(DirectLineSpeechChannel, self).__init__(etag=etag, location=location, **kwargs) self.channel_name = 'DirectLineSpeechChannel' # type: str self.properties = properties @@ -891,26 +1405,31 @@ class DirectLineSpeechChannelProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param cognitive_services_subscription_id: Required. The cognitive service subscription ID to + :ivar cognitive_service_region: Required. 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. - :type cognitive_services_subscription_id: str - :param is_enabled: Whether this channel is enabled or not. - :type is_enabled: bool - :param custom_voice_deployment_id: Custom speech model id (optional). - :type custom_voice_deployment_id: str - :param custom_speech_model_id: Custom voice deployment id (optional). - :type custom_speech_model_id: str - :param is_default_bot_for_cog_svc_account: Make this a default bot for chosen cognitive service + :vartype cognitive_service_subscription_key: str + :ivar is_enabled: Whether this channel is enabled or not. + :vartype is_enabled: bool + :ivar custom_voice_deployment_id: Custom speech model id (optional). + :vartype custom_voice_deployment_id: str + :ivar custom_speech_model_id: Custom voice deployment id (optional). + :vartype custom_speech_model_id: str + :ivar is_default_bot_for_cog_svc_account: Make this a default bot for chosen cognitive service account. - :type is_default_bot_for_cog_svc_account: bool + :vartype is_default_bot_for_cog_svc_account: bool """ _validation = { - 'cognitive_services_subscription_id': {'required': True}, + 'cognitive_service_region': {'required': True}, + 'cognitive_service_subscription_key': {'required': True}, } _attribute_map = { - 'cognitive_services_subscription_id': {'key': 'cognitiveServicesSubscriptionId', 'type': 'str'}, + 'cognitive_service_region': {'key': 'cognitiveServiceRegion', 'type': 'str'}, + 'cognitive_service_subscription_key': {'key': 'cognitiveServiceSubscriptionKey', 'type': 'str'}, 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, 'custom_voice_deployment_id': {'key': 'customVoiceDeploymentId', 'type': 'str'}, 'custom_speech_model_id': {'key': 'customSpeechModelId', 'type': 'str'}, @@ -920,15 +1439,34 @@ class DirectLineSpeechChannelProperties(msrest.serialization.Model): def __init__( self, *, - cognitive_services_subscription_id: str, + cognitive_service_region: str, + cognitive_service_subscription_key: str, is_enabled: Optional[bool] = None, custom_voice_deployment_id: Optional[str] = None, custom_speech_model_id: Optional[str] = None, is_default_bot_for_cog_svc_account: Optional[bool] = None, **kwargs ): + """ + :keyword cognitive_service_region: Required. 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. + :paramtype cognitive_service_subscription_key: str + :keyword is_enabled: Whether this channel is enabled or not. + :paramtype is_enabled: bool + :keyword custom_voice_deployment_id: Custom speech model id (optional). + :paramtype custom_voice_deployment_id: str + :keyword custom_speech_model_id: Custom voice deployment id (optional). + :paramtype custom_speech_model_id: str + :keyword is_default_bot_for_cog_svc_account: Make this a default bot for chosen cognitive + service account. + :paramtype is_default_bot_for_cog_svc_account: bool + """ super(DirectLineSpeechChannelProperties, self).__init__(**kwargs) - self.cognitive_services_subscription_id = cognitive_services_subscription_id + self.cognitive_service_region = cognitive_service_region + self.cognitive_service_subscription_key = cognitive_service_subscription_key self.is_enabled = is_enabled self.custom_voice_deployment_id = custom_voice_deployment_id self.custom_speech_model_id = custom_speech_model_id @@ -938,30 +1476,52 @@ def __init__( class EmailChannel(Channel): """Email 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. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to email channel resource. - :type properties: ~azure.mgmt.botservice.models.EmailChannelProperties + :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 + :ivar properties: The set of properties specific to email channel resource. + :vartype properties: ~azure.mgmt.botservice.models.EmailChannelProperties """ _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'}, 'properties': {'key': 'properties', 'type': 'EmailChannelProperties'}, } def __init__( self, *, + etag: Optional[str] = None, + location: Optional[str] = None, properties: Optional["EmailChannelProperties"] = None, **kwargs ): - super(EmailChannel, self).__init__(**kwargs) + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to email channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.EmailChannelProperties + """ + super(EmailChannel, self).__init__(etag=etag, location=location, **kwargs) self.channel_name = 'EmailChannel' # type: str self.properties = properties @@ -971,13 +1531,13 @@ class EmailChannelProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param email_address: Required. The email address. - :type email_address: str - :param password: The password for the email address. Value only returned through POST to the + :ivar email_address: Required. The email address. + :vartype email_address: str + :ivar password: The password for the email address. Value only returned through POST to the action Channel List API, otherwise empty. - :type password: str - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool + :vartype password: str + :ivar is_enabled: Required. Whether this channel is enabled for the bot. + :vartype is_enabled: bool """ _validation = { @@ -999,6 +1559,15 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword email_address: Required. The email address. + :paramtype email_address: str + :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 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.password = password @@ -1008,8 +1577,8 @@ def __init__( class Error(msrest.serialization.Model): """Bot Service error object. - :param error: The error body. - :type error: ~azure.mgmt.botservice.models.ErrorBody + :ivar error: The error body. + :vartype error: ~azure.mgmt.botservice.models.ErrorBody """ _attribute_map = { @@ -1022,6 +1591,10 @@ def __init__( error: Optional["ErrorBody"] = None, **kwargs ): + """ + :keyword error: The error body. + :paramtype error: ~azure.mgmt.botservice.models.ErrorBody + """ super(Error, self).__init__(**kwargs) self.error = error @@ -1031,10 +1604,10 @@ class ErrorBody(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str + :ivar code: Required. error code. + :vartype code: str + :ivar message: Required. error message. + :vartype message: str """ _validation = { @@ -1054,6 +1627,12 @@ def __init__( message: str, **kwargs ): + """ + :keyword code: Required. error code. + :paramtype code: str + :keyword message: Required. error message. + :paramtype message: str + """ super(ErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1062,30 +1641,52 @@ def __init__( class FacebookChannel(Channel): """Facebook channel definition. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to bot facebook channel. - :type properties: ~azure.mgmt.botservice.models.FacebookChannelProperties + :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 + :ivar properties: The set of properties specific to bot facebook channel. + :vartype properties: ~azure.mgmt.botservice.models.FacebookChannelProperties """ _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'}, 'properties': {'key': 'properties', 'type': 'FacebookChannelProperties'}, } def __init__( self, *, + etag: Optional[str] = None, + location: Optional[str] = None, properties: Optional["FacebookChannelProperties"] = None, **kwargs ): - super(FacebookChannel, self).__init__(**kwargs) + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to bot facebook channel. + :paramtype properties: ~azure.mgmt.botservice.models.FacebookChannelProperties + """ + super(FacebookChannel, self).__init__(etag=etag, location=location, **kwargs) self.channel_name = 'FacebookChannel' # type: str self.properties = properties @@ -1100,17 +1701,17 @@ class FacebookChannelProperties(msrest.serialization.Model): :ivar verify_token: Verify token. Value only returned through POST to the action Channel List API, otherwise empty. :vartype verify_token: str - :param pages: The list of Facebook pages. - :type pages: list[~azure.mgmt.botservice.models.FacebookPage] - :param app_id: Required. Facebook application id. - :type app_id: str - :param app_secret: Facebook application secret. Value only returned through POST to the action + :ivar pages: The list of Facebook pages. + :vartype pages: list[~azure.mgmt.botservice.models.FacebookPage] + :ivar app_id: Required. Facebook application id. + :vartype app_id: str + :ivar app_secret: Facebook application secret. Value only returned through POST to the action Channel List API, otherwise empty. - :type app_secret: str + :vartype app_secret: str :ivar callback_url: Callback Url. :vartype callback_url: str - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool + :ivar is_enabled: Required. Whether this channel is enabled for the bot. + :vartype is_enabled: bool """ _validation = { @@ -1138,6 +1739,17 @@ def __init__( app_secret: Optional[str] = None, **kwargs ): + """ + :keyword pages: The list of Facebook pages. + :paramtype pages: list[~azure.mgmt.botservice.models.FacebookPage] + :keyword app_id: Required. Facebook application id. + :paramtype app_id: str + :keyword app_secret: Facebook application secret. Value only returned through POST to the + action Channel List API, otherwise empty. + :paramtype app_secret: str + :keyword is_enabled: Required. Whether this channel is enabled for the bot. + :paramtype is_enabled: bool + """ super(FacebookChannelProperties, self).__init__(**kwargs) self.verify_token = None self.pages = pages @@ -1152,11 +1764,11 @@ class FacebookPage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. Page id. - :type id: str - :param access_token: Facebook application access token. Value only returned through POST to the + :ivar id: Required. Page id. + :vartype id: str + :ivar access_token: Facebook application access token. Value only returned through POST to the action Channel List API, otherwise empty. - :type access_token: str + :vartype access_token: str """ _validation = { @@ -1175,6 +1787,13 @@ def __init__( access_token: Optional[str] = None, **kwargs ): + """ + :keyword id: Required. Page id. + :paramtype id: str + :keyword access_token: Facebook application access token. Value only returned through POST to + the action Channel List API, otherwise empty. + :paramtype access_token: str + """ super(FacebookPage, self).__init__(**kwargs) self.id = id self.access_token = access_token @@ -1183,24 +1802,24 @@ def __init__( class HostSettingsResponse(msrest.serialization.Model): """The response body returned for a request to Bot Service Management to check per subscription hostSettings. - :param o_auth_url: For in-conversation bot user authentication. - :type o_auth_url: str - :param to_bot_from_channel_open_id_metadata_url: For verifying incoming tokens from the + :ivar o_auth_url: For in-conversation bot user authentication. + :vartype o_auth_url: str + :ivar to_bot_from_channel_open_id_metadata_url: For verifying incoming tokens from the channels. - :type to_bot_from_channel_open_id_metadata_url: str - :param to_bot_from_channel_token_issuer: For verifying incoming tokens from the channels. - :type to_bot_from_channel_token_issuer: str - :param to_bot_from_emulator_open_id_metadata_url: For verifying incoming tokens from bot + :vartype to_bot_from_channel_open_id_metadata_url: str + :ivar to_bot_from_channel_token_issuer: For verifying incoming tokens from the channels. + :vartype to_bot_from_channel_token_issuer: str + :ivar to_bot_from_emulator_open_id_metadata_url: For verifying incoming tokens from bot emulator. - :type to_bot_from_emulator_open_id_metadata_url: str - :param to_channel_from_bot_login_url: For getting access token to channels from bot host. - :type to_channel_from_bot_login_url: str - :param to_channel_from_bot_o_auth_scope: For getting access token to channels from bot host. - :type to_channel_from_bot_o_auth_scope: str - :param validate_authority: Per cloud OAuth setting on whether authority is validated. - :type validate_authority: bool - :param bot_open_id_metadata: Same as ToBotFromChannelOpenIdMetadataUrl, used by SDK < v4.12. - :type bot_open_id_metadata: str + :vartype to_bot_from_emulator_open_id_metadata_url: str + :ivar to_channel_from_bot_login_url: For getting access token to channels from bot host. + :vartype to_channel_from_bot_login_url: str + :ivar to_channel_from_bot_o_auth_scope: For getting access token to channels from bot host. + :vartype to_channel_from_bot_o_auth_scope: str + :ivar validate_authority: Per cloud OAuth setting on whether authority is validated. + :vartype validate_authority: bool + :ivar bot_open_id_metadata: Same as toBotFromChannelOpenIdMetadataUrl, used by SDK < v4.12. + :vartype bot_open_id_metadata: str """ _attribute_map = { @@ -1227,6 +1846,26 @@ def __init__( bot_open_id_metadata: Optional[str] = None, **kwargs ): + """ + :keyword o_auth_url: For in-conversation bot user authentication. + :paramtype o_auth_url: str + :keyword to_bot_from_channel_open_id_metadata_url: For verifying incoming tokens from the + channels. + :paramtype to_bot_from_channel_open_id_metadata_url: str + :keyword to_bot_from_channel_token_issuer: For verifying incoming tokens from the channels. + :paramtype to_bot_from_channel_token_issuer: str + :keyword to_bot_from_emulator_open_id_metadata_url: For verifying incoming tokens from bot + emulator. + :paramtype to_bot_from_emulator_open_id_metadata_url: str + :keyword to_channel_from_bot_login_url: For getting access token to channels from bot host. + :paramtype to_channel_from_bot_login_url: str + :keyword to_channel_from_bot_o_auth_scope: For getting access token to channels from bot host. + :paramtype to_channel_from_bot_o_auth_scope: str + :keyword validate_authority: Per cloud OAuth setting on whether authority is validated. + :paramtype validate_authority: bool + :keyword bot_open_id_metadata: Same as toBotFromChannelOpenIdMetadataUrl, used by SDK < v4.12. + :paramtype bot_open_id_metadata: str + """ super(HostSettingsResponse, self).__init__(**kwargs) self.o_auth_url = o_auth_url self.to_bot_from_channel_open_id_metadata_url = to_bot_from_channel_open_id_metadata_url @@ -1241,30 +1880,52 @@ def __init__( class KikChannel(Channel): """Kik 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. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Kik channel resource. - :type properties: ~azure.mgmt.botservice.models.KikChannelProperties + :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 + :ivar properties: The set of properties specific to Kik channel resource. + :vartype properties: ~azure.mgmt.botservice.models.KikChannelProperties """ _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'}, 'properties': {'key': 'properties', 'type': 'KikChannelProperties'}, } def __init__( self, *, + etag: Optional[str] = None, + location: Optional[str] = None, properties: Optional["KikChannelProperties"] = None, **kwargs ): - super(KikChannel, self).__init__(**kwargs) + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to Kik channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.KikChannelProperties + """ + super(KikChannel, self).__init__(etag=etag, location=location, **kwargs) self.channel_name = 'KikChannel' # type: str self.properties = properties @@ -1274,15 +1935,15 @@ class KikChannelProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param user_name: Required. The Kik user name. - :type user_name: str - :param api_key: Kik API key. Value only returned through POST to the action Channel List API, + :ivar user_name: Required. The Kik user name. + :vartype user_name: str + :ivar api_key: Kik API key. Value only returned through POST to the action Channel List API, otherwise empty. - :type api_key: str - :param is_validated: Whether this channel is validated for the bot. - :type is_validated: bool - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool + :vartype api_key: str + :ivar is_validated: Whether this channel is validated for the bot. + :vartype is_validated: bool + :ivar is_enabled: Required. Whether this channel is enabled for the bot. + :vartype is_enabled: bool """ _validation = { @@ -1306,6 +1967,17 @@ def __init__( is_validated: Optional[bool] = None, **kwargs ): + """ + :keyword user_name: Required. The Kik user name. + :paramtype user_name: str + :keyword api_key: Kik API key. Value only returned through POST to the action Channel List API, + otherwise empty. + :paramtype api_key: str + :keyword is_validated: Whether this channel is validated for the bot. + :paramtype is_validated: bool + :keyword is_enabled: Required. Whether this channel is enabled for the bot. + :paramtype is_enabled: bool + """ super(KikChannelProperties, self).__init__(**kwargs) self.user_name = user_name self.api_key = api_key @@ -1316,30 +1988,52 @@ def __init__( class LineChannel(Channel): """Line 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. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to line channel resource. - :type properties: ~azure.mgmt.botservice.models.LineChannelProperties + :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 + :ivar properties: The set of properties specific to line channel resource. + :vartype properties: ~azure.mgmt.botservice.models.LineChannelProperties """ _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'}, 'properties': {'key': 'properties', 'type': 'LineChannelProperties'}, } def __init__( self, *, + etag: Optional[str] = None, + location: Optional[str] = None, properties: Optional["LineChannelProperties"] = None, **kwargs ): - super(LineChannel, self).__init__(**kwargs) + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to line channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.LineChannelProperties + """ + super(LineChannel, self).__init__(etag=etag, location=location, **kwargs) self.channel_name = 'LineChannel' # type: str self.properties = properties @@ -1351,8 +2045,8 @@ class LineChannelProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param line_registrations: Required. The list of line channel registrations. - :type line_registrations: list[~azure.mgmt.botservice.models.LineRegistration] + :ivar line_registrations: Required. The list of line channel registrations. + :vartype line_registrations: list[~azure.mgmt.botservice.models.LineRegistration] :ivar callback_url: Callback Url to enter in line registration. :vartype callback_url: str :ivar is_validated: Whether this channel is validated for the bot. @@ -1377,6 +2071,10 @@ def __init__( line_registrations: List["LineRegistration"], **kwargs ): + """ + :keyword line_registrations: Required. The list of line channel registrations. + :paramtype line_registrations: list[~azure.mgmt.botservice.models.LineRegistration] + """ super(LineChannelProperties, self).__init__(**kwargs) self.line_registrations = line_registrations self.callback_url = None @@ -1390,10 +2088,10 @@ class LineRegistration(msrest.serialization.Model): :ivar generated_id: Id generated for the line channel registration. :vartype generated_id: str - :param channel_secret: Secret for the line channel registration. - :type channel_secret: str - :param channel_access_token: Access token for the line channel registration. - :type channel_access_token: str + :ivar channel_secret: Secret for the line channel registration. + :vartype channel_secret: str + :ivar channel_access_token: Access token for the line channel registration. + :vartype channel_access_token: str """ _validation = { @@ -1413,39 +2111,158 @@ def __init__( channel_access_token: Optional[str] = None, **kwargs ): + """ + :keyword channel_secret: Secret for the line channel registration. + :paramtype channel_secret: str + :keyword channel_access_token: Access token for the line channel registration. + :paramtype channel_access_token: str + """ super(LineRegistration, self).__init__(**kwargs) self.generated_id = None self.channel_secret = channel_secret self.channel_access_token = channel_access_token +class ListChannelWithKeysResponse(BotChannel): + """The ARM channel of list channel with keys 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 name: Specifies the name of the resource. + :vartype name: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar type: Specifies the type of the resource. + :vartype type: str + :ivar tags: A set of tags. Contains resource tags defined as key/value pairs. + :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", + "designer", "bot", "function", "azurebot". + :vartype kind: str or ~azure.mgmt.botservice.models.Kind + :ivar etag: Entity Tag. + :vartype etag: str + :ivar zones: Entity zones. + :vartype zones: list[str] + :ivar properties: The set of properties specific to bot channel resource. + :vartype properties: ~azure.mgmt.botservice.models.Channel + :ivar resource: The set of properties specific to bot channel resource. + :vartype resource: ~azure.mgmt.botservice.models.Channel + :ivar setting: Channel settings. + :vartype setting: ~azure.mgmt.botservice.models.ChannelSettings + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'zones': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'properties': {'key': 'properties', 'type': 'Channel'}, + 'resource': {'key': 'resource', 'type': 'Channel'}, + 'setting': {'key': 'setting', 'type': 'ChannelSettings'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + kind: Optional[Union[str, "Kind"]] = None, + etag: Optional[str] = None, + properties: Optional["Channel"] = None, + resource: Optional["Channel"] = None, + setting: Optional["ChannelSettings"] = None, + **kwargs + ): + """ + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Contains resource tags defined as key/value pairs. + :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", + "designer", "bot", "function", "azurebot". + :paramtype kind: str or ~azure.mgmt.botservice.models.Kind + :keyword etag: Entity Tag. + :paramtype etag: str + :keyword properties: The set of properties specific to bot channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.Channel + :keyword resource: The set of properties specific to bot channel resource. + :paramtype resource: ~azure.mgmt.botservice.models.Channel + :keyword setting: Channel settings. + :paramtype setting: ~azure.mgmt.botservice.models.ChannelSettings + """ + super(ListChannelWithKeysResponse, self).__init__(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties, **kwargs) + self.resource = resource + self.setting = setting + + class MsTeamsChannel(Channel): """Microsoft Teams 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. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Microsoft Teams channel resource. - :type properties: ~azure.mgmt.botservice.models.MsTeamsChannelProperties + :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 + :ivar properties: The set of properties specific to Microsoft Teams channel resource. + :vartype properties: ~azure.mgmt.botservice.models.MsTeamsChannelProperties """ _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'}, 'properties': {'key': 'properties', 'type': 'MsTeamsChannelProperties'}, } def __init__( self, *, + etag: Optional[str] = None, + location: Optional[str] = None, properties: Optional["MsTeamsChannelProperties"] = None, **kwargs ): - super(MsTeamsChannel, self).__init__(**kwargs) + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to Microsoft Teams channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.MsTeamsChannelProperties + """ + super(MsTeamsChannel, self).__init__(etag=etag, location=location, **kwargs) self.channel_name = 'MsTeamsChannel' # type: str self.properties = properties @@ -1455,12 +2272,18 @@ class MsTeamsChannelProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enable_calling: Enable calling for Microsoft Teams channel. - :type enable_calling: bool - :param calling_web_hook: Webhook for Microsoft Teams channel calls. - :type calling_web_hook: str - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool + :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 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. + :vartype incoming_call_route: str + :ivar deployment_environment: Deployment environment for Microsoft Teams channel calls. + :vartype deployment_environment: str + :ivar accepted_terms: Whether this channel accepted terms. + :vartype accepted_terms: bool """ _validation = { @@ -1471,6 +2294,9 @@ class MsTeamsChannelProperties(msrest.serialization.Model): 'enable_calling': {'key': 'enableCalling', 'type': 'bool'}, 'calling_web_hook': {'key': 'callingWebHook', 'type': 'str'}, 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'incoming_call_route': {'key': 'incomingCallRoute', 'type': 'str'}, + 'deployment_environment': {'key': 'deploymentEnvironment', 'type': 'str'}, + 'accepted_terms': {'key': 'acceptedTerms', 'type': 'bool'}, } def __init__( @@ -1479,25 +2305,45 @@ def __init__( is_enabled: bool, enable_calling: Optional[bool] = None, calling_web_hook: Optional[str] = None, + incoming_call_route: Optional[str] = None, + deployment_environment: Optional[str] = None, + 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 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. + :paramtype incoming_call_route: str + :keyword deployment_environment: Deployment environment for Microsoft Teams channel calls. + :paramtype deployment_environment: str + :keyword accepted_terms: Whether this channel accepted terms. + :paramtype accepted_terms: bool + """ super(MsTeamsChannelProperties, self).__init__(**kwargs) self.enable_calling = enable_calling self.calling_web_hook = calling_web_hook self.is_enabled = is_enabled + self.incoming_call_route = incoming_call_route + self.deployment_environment = deployment_environment + self.accepted_terms = accepted_terms class OperationDisplayInfo(msrest.serialization.Model): """The operation supported by Bot Service Management. - :param description: The description of the operation. - :type description: str - :param operation: The action that users can perform, based on their permission level. - :type operation: str - :param provider: Service provider: Microsoft Bot Service. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str + :ivar description: The description of the operation. + :vartype description: str + :ivar operation: The action that users can perform, based on their permission level. + :vartype operation: str + :ivar provider: Service provider: Microsoft Bot Service. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str """ _attribute_map = { @@ -1516,6 +2362,16 @@ def __init__( resource: Optional[str] = None, **kwargs ): + """ + :keyword description: The description of the operation. + :paramtype description: str + :keyword operation: The action that users can perform, based on their permission level. + :paramtype operation: str + :keyword provider: Service provider: Microsoft Bot Service. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + """ super(OperationDisplayInfo, self).__init__(**kwargs) self.description = description self.operation = operation @@ -1526,14 +2382,14 @@ def __init__( class OperationEntity(msrest.serialization.Model): """The operations supported by Bot Service Management. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The operation supported by Bot Service Management. - :type display: ~azure.mgmt.botservice.models.OperationDisplayInfo - :param origin: The origin of the operation. - :type origin: str - :param properties: Additional properties. - :type properties: any + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The operation supported by Bot Service Management. + :vartype display: ~azure.mgmt.botservice.models.OperationDisplayInfo + :ivar origin: The origin of the operation. + :vartype origin: str + :ivar properties: Additional properties. + :vartype properties: any """ _attribute_map = { @@ -1552,6 +2408,16 @@ def __init__( properties: Optional[Any] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The operation supported by Bot Service Management. + :paramtype display: ~azure.mgmt.botservice.models.OperationDisplayInfo + :keyword origin: The origin of the operation. + :paramtype origin: str + :keyword properties: Additional properties. + :paramtype properties: any + """ super(OperationEntity, self).__init__(**kwargs) self.name = name self.display = display @@ -1562,10 +2428,10 @@ def __init__( class OperationEntityListResult(msrest.serialization.Model): """The list of bot service operation response. - :param next_link: The link used to get the next page of operations. - :type next_link: str - :param value: The list of operations. - :type value: list[~azure.mgmt.botservice.models.OperationEntity] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + :ivar value: The list of operations. + :vartype value: list[~azure.mgmt.botservice.models.OperationEntity] """ _attribute_map = { @@ -1580,174 +2446,761 @@ def __init__( value: Optional[List["OperationEntity"]] = None, **kwargs ): + """ + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + :keyword value: The list of operations. + :paramtype value: list[~azure.mgmt.botservice.models.OperationEntity] + """ super(OperationEntityListResult, self).__init__(**kwargs) self.next_link = next_link self.value = value -class ServiceProvider(msrest.serialization.Model): - """Service Provider Definition. +class OperationResultsDescription(msrest.serialization.Model): + """The properties indicating the operation result of an operation on a service. + + Variables are only populated by the server, and will be ignored when sending a request. - :param properties: The Properties of a Service Provider Object. - :type properties: ~azure.mgmt.botservice.models.ServiceProviderProperties + :ivar id: The ID of the operation returned. + :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", + "Succeeded", "Failed", "Requested", "Running". + :vartype status: str or ~azure.mgmt.botservice.models.OperationResultStatus + :ivar start_time: The time that the operation was started. + :vartype start_time: ~datetime.datetime """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'status': {'readonly': True}, + 'start_time': {'readonly': True}, + } + _attribute_map = { - 'properties': {'key': 'properties', 'type': 'ServiceProviderProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, } def __init__( self, - *, - properties: Optional["ServiceProviderProperties"] = None, **kwargs ): - super(ServiceProvider, self).__init__(**kwargs) - self.properties = properties + """ + """ + super(OperationResultsDescription, self).__init__(**kwargs) + self.id = None + self.name = None + self.status = None + self.start_time = None -class ServiceProviderParameter(msrest.serialization.Model): - """Extra Parameters specific to each Service Provider. +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the Service Provider. - :vartype name: str - :ivar type: Type of the Service Provider. - :vartype type: str - :ivar display_name: Display Name of the Service Provider. - :vartype display_name: str - :ivar description: Description of the Service Provider. - :vartype description: str - :ivar help_url: Help Url for the Service Provider. - :vartype help_url: str - :ivar default: Default Name for the Service Provider. - :vartype default: str + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str """ _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'display_name': {'readonly': True}, - 'description': {'readonly': True}, - 'help_url': {'readonly': True}, - 'default': {'readonly': True}, + 'id': {'readonly': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'help_url': {'key': 'helpUrl', 'type': 'str'}, - 'default': {'key': 'default', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ServiceProviderParameter, self).__init__(**kwargs) - self.name = None - self.type = None - self.display_name = None - self.description = None - self.help_url = None - self.default = None + """ + """ + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None -class ServiceProviderProperties(msrest.serialization.Model): - """The Object used to describe a Service Provider supported by Bot Service. +class PrivateLinkResourceBase(msrest.serialization.Model): + """Common fields that are returned in the response for all BotService Private Link Resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Id for Service Provider. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar display_name: Display Name of the Service Provider. - :vartype display_name: str - :ivar service_provider_name: Display Name of the Service Provider. - :vartype service_provider_name: str - :ivar dev_portal_url: Display Name of the Service Provider. - :vartype dev_portal_url: str - :ivar icon_url: Display Name of the Service Provider. - :vartype icon_url: str - :param parameters: The list of parameters for the Service Provider. - :type parameters: list[~azure.mgmt.botservice.models.ServiceProviderParameter] + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str """ _validation = { 'id': {'readonly': True}, - 'display_name': {'readonly': True}, - 'service_provider_name': {'readonly': True}, - 'dev_portal_url': {'readonly': True}, - 'icon_url': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'service_provider_name': {'key': 'serviceProviderName', 'type': 'str'}, - 'dev_portal_url': {'key': 'devPortalUrl', 'type': 'str'}, - 'icon_url': {'key': 'iconUrl', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '[ServiceProviderParameter]'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, - *, - parameters: Optional[List["ServiceProviderParameter"]] = None, **kwargs ): - super(ServiceProviderProperties, self).__init__(**kwargs) + """ + """ + super(PrivateLinkResourceBase, self).__init__(**kwargs) self.id = None - self.display_name = None - self.service_provider_name = None - self.dev_portal_url = None - self.icon_url = None - self.parameters = parameters + self.name = None + self.type = None -class ServiceProviderResponseList(msrest.serialization.Model): - """The list of bot service providers response. +class PrivateEndpointConnection(PrivateLinkResourceBase): + """The Private Endpoint Connection resource. Variables are only populated by the server, and will be ignored when sending a request. - :param next_link: The link used to get the next page of bot service providers. - :type next_link: str - :ivar value: Gets the list of bot service providers and their properties. - :vartype value: list[~azure.mgmt.botservice.models.ServiceProvider] + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.botservice.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :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". + :vartype provisioning_state: str or + ~azure.mgmt.botservice.models.PrivateEndpointConnectionProvisioningState """ _validation = { - 'value': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ServiceProvider]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( self, *, - next_link: Optional[str] = None, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): - super(ServiceProviderResponseList, self).__init__(**kwargs) - self.next_link = next_link - self.value = None - + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.botservice.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.botservice.models.PrivateLinkServiceConnectionState + """ + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connection associated with the specified storage account. + + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.botservice.models.PrivateEndpointConnection] + """ -class SiteInfo(msrest.serialization.Model): - """Site information for WebChat or DirectLine Channels to identify which site to regenerate keys for. + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + } - All required parameters must be populated in order to send to Azure. + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + **kwargs + ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.botservice.models.PrivateEndpointConnection] + """ + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkResource(PrivateLinkResourceBase): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.botservice.models.PrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + **kwargs + ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.botservice.models.PrivateLinkResource] + """ + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + + +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". + :vartype status: str or ~azure.mgmt.botservice.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "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". + :paramtype status: str or ~azure.mgmt.botservice.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +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["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. + + :ivar name: Name of the Service Provider. + :vartype name: str + :ivar type: Type of the Service Provider. + :vartype type: str + :ivar display_name: Display Name of the Service Provider. + :vartype display_name: str + :ivar description: Description of the Service Provider. + :vartype description: str + :ivar help_url: Help Url for the Service Provider. + :vartype help_url: str + :ivar default: Default Name for the Service Provider. + :vartype default: str + :ivar metadata: Meta data for the Service Provider. + :vartype metadata: ~azure.mgmt.botservice.models.ServiceProviderParameterMetadata + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'display_name': {'readonly': True}, + 'description': {'readonly': True}, + 'help_url': {'readonly': True}, + 'default': {'readonly': True}, + 'metadata': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'help_url': {'key': 'helpUrl', 'type': 'str'}, + 'default': {'key': 'default', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': 'ServiceProviderParameterMetadata'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ServiceProviderParameter, self).__init__(**kwargs) + self.name = None + self.type = None + self.display_name = None + self.description = None + self.help_url = None + self.default = None + self.metadata = None + + +class ServiceProviderParameterMetadata(msrest.serialization.Model): + """Meta data for the Service Provider. + + :ivar constraints: the constraints of the bot meta data. + :vartype constraints: ~azure.mgmt.botservice.models.ServiceProviderParameterMetadataConstraints + """ + + _attribute_map = { + 'constraints': {'key': 'constraints', 'type': 'ServiceProviderParameterMetadataConstraints'}, + } + + def __init__( + self, + *, + constraints: Optional["ServiceProviderParameterMetadataConstraints"] = None, + **kwargs + ): + """ + :keyword constraints: the constraints of the bot meta data. + :paramtype constraints: + ~azure.mgmt.botservice.models.ServiceProviderParameterMetadataConstraints + """ + super(ServiceProviderParameterMetadata, self).__init__(**kwargs) + self.constraints = constraints + + +class ServiceProviderParameterMetadataConstraints(msrest.serialization.Model): + """the constraints of the bot meta data. + + :ivar required: Whether required the constraints of the bot meta data. + :vartype required: bool + """ + + _attribute_map = { + 'required': {'key': 'required', 'type': 'bool'}, + } + + def __init__( + self, + *, + required: Optional[bool] = None, + **kwargs + ): + """ + :keyword required: Whether required the constraints of the bot meta data. + :paramtype required: bool + """ + super(ServiceProviderParameterMetadataConstraints, self).__init__(**kwargs) + self.required = required + + +class ServiceProviderProperties(msrest.serialization.Model): + """The Object used to describe a Service Provider supported by Bot Service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Id for Service Provider. + :vartype id: str + :ivar display_name: Display Name of the Service Provider. + :vartype display_name: str + :ivar service_provider_name: Display Name of the Service Provider. + :vartype service_provider_name: str + :ivar dev_portal_url: Display Name of the Service Provider. + :vartype dev_portal_url: str + :ivar icon_url: Display Name of the Service Provider. + :vartype icon_url: str + :ivar parameters: The list of parameters for the Service Provider. + :vartype parameters: list[~azure.mgmt.botservice.models.ServiceProviderParameter] + """ + + _validation = { + 'id': {'readonly': True}, + 'display_name': {'readonly': True}, + 'service_provider_name': {'readonly': True}, + 'dev_portal_url': {'readonly': True}, + 'icon_url': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'service_provider_name': {'key': 'serviceProviderName', 'type': 'str'}, + 'dev_portal_url': {'key': 'devPortalUrl', 'type': 'str'}, + 'icon_url': {'key': 'iconUrl', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '[ServiceProviderParameter]'}, + } + + def __init__( + self, + *, + parameters: Optional[List["ServiceProviderParameter"]] = None, + **kwargs + ): + """ + :keyword parameters: The list of parameters for the Service Provider. + :paramtype parameters: list[~azure.mgmt.botservice.models.ServiceProviderParameter] + """ + super(ServiceProviderProperties, self).__init__(**kwargs) + self.id = None + self.display_name = None + self.service_provider_name = None + self.dev_portal_url = None + self.icon_url = None + self.parameters = parameters + + +class ServiceProviderResponseList(msrest.serialization.Model): + """The list of bot service providers response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar next_link: The link used to get the next page of bot service providers. + :vartype next_link: str + :ivar value: Gets the list of bot service providers and their properties. + :vartype value: list[~azure.mgmt.botservice.models.ServiceProvider] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[ServiceProvider]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword next_link: The link used to get the next page of bot service providers. + :paramtype next_link: str + """ + super(ServiceProviderResponseList, self).__init__(**kwargs) + self.next_link = next_link + 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 + """ - :param site_name: Required. The site name. - :type site_name: str - :param key: Required. Determines which key is to be regenerated. Possible values include: + _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. + + All required parameters must be populated in order to send to Azure. + + :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". - :type key: str or ~azure.mgmt.botservice.models.Key + :vartype key: str or ~azure.mgmt.botservice.models.Key """ _validation = { @@ -1767,6 +3220,13 @@ def __init__( key: Union[str, "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". + :paramtype key: str or ~azure.mgmt.botservice.models.Key + """ super(SiteInfo, self).__init__(**kwargs) self.site_name = site_name self.key = key @@ -1779,8 +3239,8 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The sku name. Possible values include: "F0", "S1". - :type name: str or ~azure.mgmt.botservice.models.SkuName + :ivar name: Required. The sku name. Possible values include: "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", "Standard". :vartype tier: str or ~azure.mgmt.botservice.models.SkuTier @@ -1802,6 +3262,10 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. The sku name. Possible values include: "F0", "S1". + :paramtype name: str or ~azure.mgmt.botservice.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = None @@ -1810,30 +3274,52 @@ def __init__( class SkypeChannel(Channel): """Skype 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. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Skype channel resource. - :type properties: ~azure.mgmt.botservice.models.SkypeChannelProperties + :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 + :ivar properties: The set of properties specific to Skype channel resource. + :vartype properties: ~azure.mgmt.botservice.models.SkypeChannelProperties """ _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'}, 'properties': {'key': 'properties', 'type': 'SkypeChannelProperties'}, } def __init__( self, *, + etag: Optional[str] = None, + location: Optional[str] = None, properties: Optional["SkypeChannelProperties"] = None, **kwargs ): - super(SkypeChannel, self).__init__(**kwargs) + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to Skype channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.SkypeChannelProperties + """ + super(SkypeChannel, self).__init__(etag=etag, location=location, **kwargs) self.channel_name = 'SkypeChannel' # type: str self.properties = properties @@ -1843,24 +3329,26 @@ class SkypeChannelProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enable_messaging: Enable messaging for Skype channel. - :type enable_messaging: bool - :param enable_media_cards: Enable media cards for Skype channel. - :type enable_media_cards: bool - :param enable_video: Enable video for Skype channel. - :type enable_video: bool - :param enable_calling: Enable calling for Skype channel. - :type enable_calling: bool - :param enable_screen_sharing: Enable screen sharing for Skype channel. - :type enable_screen_sharing: bool - :param enable_groups: Enable groups for Skype channel. - :type enable_groups: bool - :param groups_mode: Group mode for Skype channel. - :type groups_mode: str - :param calling_web_hook: Calling web hook for Skype channel. - :type calling_web_hook: str - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool + :ivar enable_messaging: Enable messaging for Skype channel. + :vartype enable_messaging: bool + :ivar enable_media_cards: Enable media cards for Skype channel. + :vartype enable_media_cards: bool + :ivar enable_video: Enable video for Skype channel. + :vartype enable_video: bool + :ivar enable_calling: Enable calling for Skype channel. + :vartype enable_calling: bool + :ivar enable_screen_sharing: Enable screen sharing for Skype channel. + :vartype enable_screen_sharing: bool + :ivar enable_groups: Enable groups for Skype channel. + :vartype enable_groups: bool + :ivar groups_mode: Group mode for Skype channel. + :vartype groups_mode: str + :ivar calling_web_hook: Calling web hook for Skype channel. + :vartype calling_web_hook: str + :ivar incoming_call_route: Incoming call route for Skype channel. + :vartype incoming_call_route: str + :ivar is_enabled: Required. Whether this channel is enabled for the bot. + :vartype is_enabled: bool """ _validation = { @@ -1876,6 +3364,7 @@ class SkypeChannelProperties(msrest.serialization.Model): 'enable_groups': {'key': 'enableGroups', 'type': 'bool'}, 'groups_mode': {'key': 'groupsMode', 'type': 'str'}, 'calling_web_hook': {'key': 'callingWebHook', 'type': 'str'}, + 'incoming_call_route': {'key': 'incomingCallRoute', 'type': 'str'}, 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, } @@ -1891,8 +3380,31 @@ def __init__( enable_groups: Optional[bool] = None, groups_mode: Optional[str] = None, calling_web_hook: Optional[str] = None, + incoming_call_route: Optional[str] = None, **kwargs ): + """ + :keyword enable_messaging: Enable messaging for Skype channel. + :paramtype enable_messaging: bool + :keyword enable_media_cards: Enable media cards for Skype channel. + :paramtype enable_media_cards: bool + :keyword enable_video: Enable video for Skype channel. + :paramtype enable_video: bool + :keyword enable_calling: Enable calling for Skype channel. + :paramtype enable_calling: bool + :keyword enable_screen_sharing: Enable screen sharing for Skype channel. + :paramtype enable_screen_sharing: bool + :keyword enable_groups: Enable groups for Skype channel. + :paramtype enable_groups: bool + :keyword groups_mode: Group mode for Skype channel. + :paramtype groups_mode: str + :keyword calling_web_hook: Calling web hook for Skype channel. + :paramtype calling_web_hook: str + :keyword incoming_call_route: Incoming call route for Skype channel. + :paramtype incoming_call_route: str + :keyword is_enabled: Required. Whether this channel is enabled for the bot. + :paramtype is_enabled: bool + """ super(SkypeChannelProperties, self).__init__(**kwargs) self.enable_messaging = enable_messaging self.enable_media_cards = enable_media_cards @@ -1902,36 +3414,59 @@ def __init__( self.enable_groups = enable_groups self.groups_mode = groups_mode self.calling_web_hook = calling_web_hook + self.incoming_call_route = incoming_call_route self.is_enabled = is_enabled class SlackChannel(Channel): """Slack 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. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Slack channel resource. - :type properties: ~azure.mgmt.botservice.models.SlackChannelProperties + :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 + :ivar properties: The set of properties specific to Slack channel resource. + :vartype properties: ~azure.mgmt.botservice.models.SlackChannelProperties """ _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'}, 'properties': {'key': 'properties', 'type': 'SlackChannelProperties'}, } def __init__( self, *, + etag: Optional[str] = None, + location: Optional[str] = None, properties: Optional["SlackChannelProperties"] = None, **kwargs ): - super(SlackChannel, self).__init__(**kwargs) + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to Slack channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.SlackChannelProperties + """ + super(SlackChannel, self).__init__(etag=etag, location=location, **kwargs) self.channel_name = 'SlackChannel' # type: str self.properties = properties @@ -1943,16 +3478,18 @@ class SlackChannelProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param client_id: The Slack client id. - :type client_id: str - :param client_secret: The Slack client secret. Value only returned through POST to the action + :ivar client_id: The Slack client id. + :vartype client_id: str + :ivar client_secret: The Slack client secret. Value only returned through POST to the action Channel List API, otherwise empty. - :type client_secret: str - :param verification_token: The Slack verification token. Value only returned through POST to - the action Channel List API, otherwise empty. - :type verification_token: str - :param landing_page_url: The Slack landing page Url. - :type landing_page_url: str + :vartype client_secret: str + :ivar verification_token: The Slack verification token. Value only returned through POST to the + action Channel List API, otherwise empty. + :vartype verification_token: str + :ivar scopes: The Slack permission scopes. + :vartype scopes: str + :ivar landing_page_url: The Slack landing page Url. + :vartype landing_page_url: str :ivar redirect_action: The Slack redirect action. :vartype redirect_action: str :ivar last_submission_id: The Sms auth token. @@ -1962,10 +3499,10 @@ class SlackChannelProperties(msrest.serialization.Model): :vartype register_before_o_auth_flow: bool :ivar is_validated: Whether this channel is validated for the bot. :vartype is_validated: bool - :param signing_secret: The Slack signing secret. - :type signing_secret: str - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool + :ivar signing_secret: The Slack signing secret. + :vartype signing_secret: str + :ivar is_enabled: Required. Whether this channel is enabled for the bot. + :vartype is_enabled: bool """ _validation = { @@ -1980,11 +3517,12 @@ class SlackChannelProperties(msrest.serialization.Model): 'client_id': {'key': 'clientId', 'type': 'str'}, 'client_secret': {'key': 'clientSecret', 'type': 'str'}, 'verification_token': {'key': 'verificationToken', 'type': 'str'}, + 'scopes': {'key': 'scopes', 'type': 'str'}, 'landing_page_url': {'key': 'landingPageUrl', 'type': 'str'}, 'redirect_action': {'key': 'redirectAction', 'type': 'str'}, 'last_submission_id': {'key': 'lastSubmissionId', 'type': 'str'}, 'register_before_o_auth_flow': {'key': 'registerBeforeOAuthFlow', 'type': 'bool'}, - 'is_validated': {'key': 'isValidated', 'type': 'bool'}, + 'is_validated': {'key': 'IsValidated', 'type': 'bool'}, 'signing_secret': {'key': 'signingSecret', 'type': 'str'}, 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, } @@ -1996,14 +3534,34 @@ def __init__( client_id: Optional[str] = None, client_secret: Optional[str] = None, verification_token: Optional[str] = None, + scopes: Optional[str] = None, landing_page_url: Optional[str] = None, signing_secret: Optional[str] = None, **kwargs ): + """ + :keyword client_id: The Slack client id. + :paramtype client_id: str + :keyword client_secret: The Slack client secret. Value only returned through POST to the action + Channel List API, otherwise empty. + :paramtype client_secret: str + :keyword verification_token: The Slack verification token. Value only returned through POST to + the action Channel List API, otherwise empty. + :paramtype verification_token: str + :keyword scopes: The Slack permission scopes. + :paramtype scopes: str + :keyword landing_page_url: The Slack landing page Url. + :paramtype landing_page_url: str + :keyword signing_secret: The Slack signing secret. + :paramtype signing_secret: str + :keyword is_enabled: Required. Whether this channel is enabled for the bot. + :paramtype is_enabled: bool + """ super(SlackChannelProperties, self).__init__(**kwargs) self.client_id = client_id self.client_secret = client_secret self.verification_token = verification_token + self.scopes = scopes self.landing_page_url = landing_page_url self.redirect_action = None self.last_submission_id = None @@ -2016,30 +3574,52 @@ def __init__( class SmsChannel(Channel): """Sms 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. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Sms channel resource. - :type properties: ~azure.mgmt.botservice.models.SmsChannelProperties + :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 + :ivar properties: The set of properties specific to Sms channel resource. + :vartype properties: ~azure.mgmt.botservice.models.SmsChannelProperties """ _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'}, 'properties': {'key': 'properties', 'type': 'SmsChannelProperties'}, } def __init__( self, *, + etag: Optional[str] = None, + location: Optional[str] = None, properties: Optional["SmsChannelProperties"] = None, **kwargs ): - super(SmsChannel, self).__init__(**kwargs) + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to Sms channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.SmsChannelProperties + """ + super(SmsChannel, self).__init__(etag=etag, location=location, **kwargs) self.channel_name = 'SmsChannel' # type: str self.properties = properties @@ -2049,18 +3629,18 @@ class SmsChannelProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param phone: Required. The Sms phone. - :type phone: str - :param account_sid: Required. The Sms account SID. Value only returned through POST to the + :ivar phone: Required. The Sms phone. + :vartype phone: str + :ivar account_sid: Required. The Sms account SID. Value only returned through POST to the action Channel List API, otherwise empty. - :type account_sid: str - :param auth_token: The Sms auth token. Value only returned through POST to the action Channel + :vartype account_sid: str + :ivar auth_token: The Sms auth token. Value only returned through POST to the action Channel List API, otherwise empty. - :type auth_token: str - :param is_validated: Whether this channel is validated for the bot. - :type is_validated: bool - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool + :vartype auth_token: str + :ivar is_validated: Whether this channel is validated for the bot. + :vartype is_validated: bool + :ivar is_enabled: Required. Whether this channel is enabled for the bot. + :vartype is_enabled: bool """ _validation = { @@ -2087,6 +3667,20 @@ def __init__( is_validated: Optional[bool] = None, **kwargs ): + """ + :keyword phone: Required. The Sms phone. + :paramtype phone: str + :keyword account_sid: Required. The Sms account SID. Value only returned through POST to the + action Channel List API, otherwise empty. + :paramtype account_sid: str + :keyword auth_token: The Sms auth token. Value only returned through POST to the action Channel + List API, otherwise empty. + :paramtype auth_token: str + :keyword is_validated: Whether this channel is validated for the bot. + :paramtype is_validated: bool + :keyword is_enabled: Required. Whether this channel is enabled for the bot. + :paramtype is_enabled: bool + """ super(SmsChannelProperties, self).__init__(**kwargs) self.phone = phone self.account_sid = account_sid @@ -2098,30 +3692,52 @@ def __init__( class TelegramChannel(Channel): """Telegram 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. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Telegram channel resource. - :type properties: ~azure.mgmt.botservice.models.TelegramChannelProperties + :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 + :ivar properties: The set of properties specific to Telegram channel resource. + :vartype properties: ~azure.mgmt.botservice.models.TelegramChannelProperties """ _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'}, 'properties': {'key': 'properties', 'type': 'TelegramChannelProperties'}, } def __init__( self, *, + etag: Optional[str] = None, + location: Optional[str] = None, properties: Optional["TelegramChannelProperties"] = None, **kwargs ): - super(TelegramChannel, self).__init__(**kwargs) + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to Telegram channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.TelegramChannelProperties + """ + super(TelegramChannel, self).__init__(etag=etag, location=location, **kwargs) self.channel_name = 'TelegramChannel' # type: str self.properties = properties @@ -2131,13 +3747,13 @@ class TelegramChannelProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param access_token: The Telegram access token. Value only returned through POST to the action + :ivar access_token: The Telegram access token. Value only returned through POST to the action Channel List API, otherwise empty. - :type access_token: str - :param is_validated: Whether this channel is validated for the bot. - :type is_validated: bool - :param is_enabled: Required. Whether this channel is enabled for the bot. - :type is_enabled: bool + :vartype access_token: str + :ivar is_validated: Whether this channel is validated for the bot. + :vartype is_validated: bool + :ivar is_enabled: Required. Whether this channel is enabled for the bot. + :vartype is_enabled: bool """ _validation = { @@ -2158,6 +3774,15 @@ def __init__( is_validated: Optional[bool] = None, **kwargs ): + """ + :keyword access_token: The Telegram access token. Value only returned through POST to the + action Channel List API, otherwise empty. + :paramtype access_token: str + :keyword is_validated: Whether this channel is validated for the bot. + :paramtype is_validated: bool + :keyword is_enabled: Required. Whether this channel is enabled for the bot. + :paramtype is_enabled: bool + """ super(TelegramChannelProperties, self).__init__(**kwargs) self.access_token = access_token self.is_validated = is_validated @@ -2167,30 +3792,52 @@ def __init__( class WebChatChannel(Channel): """Web Chat 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. - :param channel_name: Required. The channel name.Constant filled by server. - :type channel_name: str - :param properties: The set of properties specific to Web Chat channel resource. - :type properties: ~azure.mgmt.botservice.models.WebChatChannelProperties + :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 + :ivar properties: The set of properties specific to Web Chat channel resource. + :vartype properties: ~azure.mgmt.botservice.models.WebChatChannelProperties """ _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'}, 'properties': {'key': 'properties', 'type': 'WebChatChannelProperties'}, } def __init__( self, *, + etag: Optional[str] = None, + location: Optional[str] = None, properties: Optional["WebChatChannelProperties"] = None, **kwargs ): - super(WebChatChannel, self).__init__(**kwargs) + """ + :keyword etag: Entity Tag of the resource. + :paramtype etag: str + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword properties: The set of properties specific to Web Chat channel resource. + :paramtype properties: ~azure.mgmt.botservice.models.WebChatChannelProperties + """ + super(WebChatChannel, self).__init__(etag=etag, location=location, **kwargs) self.channel_name = 'WebChatChannel' # type: str self.properties = properties @@ -2202,8 +3849,8 @@ class WebChatChannelProperties(msrest.serialization.Model): :ivar web_chat_embed_code: Web chat control embed code. :vartype web_chat_embed_code: str - :param sites: The list of Web Chat sites. - :type sites: list[~azure.mgmt.botservice.models.WebChatSite] + :ivar sites: The list of Web Chat sites. + :vartype sites: list[~azure.mgmt.botservice.models.WebChatSite] """ _validation = { @@ -2221,64 +3868,10 @@ def __init__( sites: Optional[List["WebChatSite"]] = None, **kwargs ): + """ + :keyword sites: The list of Web Chat sites. + :paramtype sites: list[~azure.mgmt.botservice.models.WebChatSite] + """ super(WebChatChannelProperties, self).__init__(**kwargs) self.web_chat_embed_code = None self.sites = sites - - -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 - :param site_name: Required. Site name. - :type 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 - :param is_enabled: Required. Whether this site is enabled for DirectLine channel. - :type is_enabled: bool - :param enable_preview: Required. Whether this site is enabled for preview versions of Webchat. - :type enable_preview: bool - """ - - _validation = { - 'site_id': {'readonly': True}, - 'site_name': {'required': True}, - 'key': {'readonly': True}, - 'key2': {'readonly': True}, - 'is_enabled': {'required': True}, - 'enable_preview': {'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'}, - 'enable_preview': {'key': 'enablePreview', 'type': 'bool'}, - } - - def __init__( - self, - *, - site_name: str, - is_enabled: bool, - enable_preview: bool, - **kwargs - ): - 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.enable_preview = enable_preview 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 57b1265e4d3f..89604c7b3d53 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 @@ -12,6 +12,9 @@ from ._operations import Operations from ._bot_connection_operations import BotConnectionOperations 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 __all__ = [ 'BotsOperations', @@ -20,4 +23,7 @@ 'Operations', 'BotConnectionOperations', 'HostSettingsOperations', + 'OperationResultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', ] 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 c0bfd7861cc7..a9701d3153c8 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 @@ -5,23 +5,295 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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() +_SERIALIZER.client_side_validation = False + +def build_list_service_providers_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_with_secrets_request( + resource_group_name: str, + resource_name: str, + connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + 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}/listWithSecrets') + 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_.-]*$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + resource_group_name: str, + resource_name: str, + connection_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + 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}') + 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_.-]*$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + 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') + + # 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') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + resource_name: str, + connection_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + 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}') + 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_.-]*$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + 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') + + # 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') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + resource_name: str, + connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + 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}') + 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_.-]*$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + 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}') + 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_.-]*$'), + "connectionName": _SERIALIZER.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_bot_service_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + 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') + 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 + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BotConnectionOperations(object): """BotConnectionOperations operations. @@ -45,11 +317,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_service_providers( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceProviderResponseList" + **kwargs: Any + ) -> "_models.ServiceProviderResponseList": """Lists the available Service Providers for creating Connection Settings. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,31 +334,21 @@ def list_service_providers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.list_service_providers.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_service_providers_request( + subscription_id=self._config.subscription_id, + template_url=self.list_service_providers.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceProviderResponseList', pipeline_response) @@ -95,16 +357,18 @@ def list_service_providers( return cls(pipeline_response, deserialized, {}) return deserialized + list_service_providers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders'} # type: ignore + + @distributed_trace def list_with_secrets( self, - resource_group_name, # type: str - resource_name, # type: str - connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectionSetting" + resource_group_name: str, + resource_name: str, + connection_name: str, + **kwargs: Any + ) -> "_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. @@ -123,34 +387,24 @@ def list_with_secrets( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.list_with_secrets.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'connectionName': self._serialize.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_with_secrets_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + template_url=self.list_with_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConnectionSetting', pipeline_response) @@ -159,17 +413,19 @@ def list_with_secrets( return cls(pipeline_response, deserialized, {}) return deserialized + list_with_secrets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - resource_name, # type: str - connection_name, # type: str - parameters, # type: "_models.ConnectionSetting" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectionSetting" + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: "_models.ConnectionSetting", + **kwargs: Any + ) -> "_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. @@ -190,39 +446,29 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'connectionName': self._serialize.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ConnectionSetting') + + request = build_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ConnectionSetting') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -235,17 +481,19 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - resource_name, # type: str - connection_name, # type: str - parameters, # type: "_models.ConnectionSetting" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectionSetting" + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: "_models.ConnectionSetting", + **kwargs: Any + ) -> "_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. @@ -266,39 +514,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'connectionName': self._serialize.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ConnectionSetting') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ConnectionSetting') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -311,16 +549,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - resource_name, # type: str - connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ConnectionSetting" + resource_group_name: str, + resource_name: str, + connection_name: str, + **kwargs: Any + ) -> "_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. @@ -339,34 +579,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'connectionName': self._serialize.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConnectionSetting', pipeline_response) @@ -375,16 +605,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - resource_name, # type: str - connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + resource_name: str, + connection_name: str, + **kwargs: Any + ) -> None: """Deletes a Connection Setting registration for a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -403,34 +635,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'connectionName': self._serialize.url("connection_name", connection_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -438,13 +660,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}'} # type: ignore + + @distributed_trace def list_by_bot_service( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ConnectionSettingResponseList"] + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> 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. @@ -452,8 +675,10 @@ def list_by_bot_service( :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: An iterator like instance of either ConnectionSettingResponseList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.ConnectionSettingResponseList] + :return: An iterator like instance of either ConnectionSettingResponseList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.ConnectionSettingResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConnectionSettingResponseList"] @@ -461,36 +686,33 @@ def list_by_bot_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_bot_service.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_bot_service_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_bot_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_bot_service_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ConnectionSettingResponseList', pipeline_response) + deserialized = self._deserialize("ConnectionSettingResponseList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -503,12 +725,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) 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 ed7fd2484627..20afa260f2ed 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 @@ -5,23 +5,282 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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() +_SERIALIZER.client_side_validation = False + +def build_create_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + 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}') + 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 + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + 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}') + 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 + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + 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}') + 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 + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + 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}') + 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 + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_check_name_availability_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + 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') + + # 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') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class BotsOperations(object): """BotsOperations operations. @@ -45,14 +304,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - resource_name, # type: str - parameters, # type: "_models.Bot" - **kwargs # type: Any - ): - # type: (...) -> "_models.Bot" + resource_group_name: str, + resource_name: str, + parameters: "_models.Bot", + **kwargs: Any + ) -> "_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. @@ -71,38 +330,28 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Bot') + + request = build_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Bot') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -115,21 +364,23 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - resource_name, # type: str - location=None, # type: Optional[str] - tags=None, # type: Optional[Dict[str, str]] - sku=None, # type: Optional["_models.Sku"] - kind=None, # type: Optional[Union[str, "_models.Kind"]] - etag=None, # type: Optional[str] - properties=None, # type: Optional["_models.BotProperties"] - **kwargs # type: Any - ): - # type: (...) -> "_models.Bot" + resource_group_name: str, + resource_name: str, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.Sku"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, + etag: Optional[str] = None, + properties: Optional["_models.BotProperties"] = None, + **kwargs: Any + ) -> "_models.Bot": """Updates a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -159,39 +410,28 @@ def update( } error_map.update(kwargs.pop('error_map', {})) - _parameters = _models.Bot(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _parameters = _models.Bot(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) + _json = self._serialize.body(_parameters, 'Bot') + + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'Bot') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -204,15 +444,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: """Deletes a Bot Service from the resource group. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -229,33 +471,23 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -263,13 +495,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Bot" + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.Bot": """Returns a BotService specified by the parameters. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -286,33 +519,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Bot', pipeline_response) @@ -321,14 +544,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BotResponseList"] + resource_group_name: str, + **kwargs: Any + ) -> 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. @@ -343,35 +568,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BotResponseList', pipeline_response) + deserialized = self._deserialize("BotResponseList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -384,22 +605,23 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BotResponseList"] + **kwargs: Any + ) -> 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 @@ -412,34 +634,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BotResponseList', pipeline_response) + deserialized = self._deserialize("BotResponseList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -452,23 +669,24 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices'} # type: ignore + @distributed_trace def get_check_name_availability( self, - parameters, # type: "_models.CheckNameAvailabilityRequestBody" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResponseBody" + parameters: "_models.CheckNameAvailabilityRequestBody", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResponseBody": """Check whether a bot name is available. :param parameters: The request body parameters to provide for the check name availability @@ -484,32 +702,25 @@ def get_check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.get_check_name_availability.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CheckNameAvailabilityRequestBody') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'CheckNameAvailabilityRequestBody') + + request = build_get_check_name_availability_request( + content_type=content_type, + json=_json, + template_url=self.get_check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityResponseBody', pipeline_response) @@ -518,4 +729,6 @@ def get_check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + 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 8b4d14b36711..e8b4724c3771 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 @@ -5,23 +5,264 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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() +_SERIALIZER.client_side_validation = False + +def build_create_request( + resource_group_name: str, + resource_name: str, + channel_name: Union[str, "_models.ChannelName"], + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + 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}') + 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_.-]*$'), + "channelName": _SERIALIZER.url("channel_name", channel_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + 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') + + # 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') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + resource_name: str, + channel_name: Union[str, "_models.ChannelName"], + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + 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}') + 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_.-]*$'), + "channelName": _SERIALIZER.url("channel_name", channel_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + 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') + + # 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') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + channel_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + 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}') + 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_.-]*$'), + "channelName": _SERIALIZER.url("channel_name", channel_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 + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + resource_name: str, + channel_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + 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}') + 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_.-]*$'), + "channelName": _SERIALIZER.url("channel_name", channel_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 + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_with_keys_request( + resource_group_name: str, + resource_name: str, + channel_name: Union[str, "_models.ChannelName"], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + 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}/listChannelWithKeys') + 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_.-]*$'), + "channelName": _SERIALIZER.url("channel_name", channel_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + 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') + 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 + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ChannelsOperations(object): """ChannelsOperations operations. @@ -45,15 +286,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - resource_name, # type: str - channel_name, # type: Union[str, "_models.ChannelName"] - parameters, # type: "_models.BotChannel" - **kwargs # type: Any - ): - # type: (...) -> "_models.BotChannel" + resource_group_name: str, + resource_name: str, + channel_name: Union[str, "_models.ChannelName"], + parameters: "_models.BotChannel", + **kwargs: Any + ) -> "_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. @@ -74,39 +315,29 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'channelName': self._serialize.url("channel_name", channel_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'BotChannel') + + request = build_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'BotChannel') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -119,22 +350,24 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - resource_name, # type: str - channel_name, # type: Union[str, "_models.ChannelName"] - location=None, # type: Optional[str] - tags=None, # type: Optional[Dict[str, str]] - sku=None, # type: Optional["_models.Sku"] - kind=None, # type: Optional[Union[str, "_models.Kind"]] - etag=None, # type: Optional[str] - properties=None, # type: Optional["_models.Channel"] - **kwargs # type: Any - ): - # type: (...) -> "_models.BotChannel" + resource_group_name: str, + resource_name: str, + channel_name: Union[str, "_models.ChannelName"], + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.Sku"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, + etag: Optional[str] = None, + properties: Optional["_models.Channel"] = None, + **kwargs: Any + ) -> "_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. @@ -166,40 +399,29 @@ def update( } error_map.update(kwargs.pop('error_map', {})) - _parameters = _models.BotChannel(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'channelName': self._serialize.url("channel_name", channel_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _parameters = _models.BotChannel(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) + _json = self._serialize.body(_parameters, 'BotChannel') + + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'BotChannel') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -212,16 +434,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - resource_name, # type: str - channel_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + resource_name: str, + channel_name: str, + **kwargs: Any + ) -> None: """Deletes a Channel registration from a Bot Service. :param resource_group_name: The name of the Bot resource group in the user subscription. @@ -240,34 +464,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'channelName': self._serialize.url("channel_name", channel_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -275,14 +489,15 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - resource_name, # type: str - channel_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BotChannel" + resource_group_name: str, + resource_name: str, + channel_name: str, + **kwargs: Any + ) -> "_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. @@ -301,34 +516,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'channelName': self._serialize.url("channel_name", channel_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BotChannel', pipeline_response) @@ -337,16 +542,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'} # type: ignore + + @distributed_trace def list_with_keys( self, - resource_group_name, # type: str - resource_name, # type: str - channel_name, # type: Union[str, "_models.ChannelName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.BotChannel" + resource_group_name: str, + resource_name: str, + channel_name: Union[str, "_models.ChannelName"], + **kwargs: Any + ) -> "_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. @@ -356,60 +563,52 @@ def list_with_keys( :param channel_name: The name of the Channel resource. :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel, or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel + :return: ListChannelWithKeysResponse, or the result of cls(response) + :rtype: ~azure.mgmt.botservice.models.ListChannelWithKeysResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BotChannel"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListChannelWithKeysResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.list_with_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'channelName': self._serialize.url("channel_name", channel_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_with_keys_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + template_url=self.list_with_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('BotChannel', pipeline_response) + deserialized = self._deserialize('ListChannelWithKeysResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized + list_with_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ChannelResponseList"] + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> 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. @@ -426,36 +625,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ChannelResponseList', pipeline_response) + deserialized = self._deserialize("ChannelResponseList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -468,12 +664,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) 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 4f1f776163b0..0de65a0f3fd0 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 @@ -5,22 +5,71 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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() +_SERIALIZER.client_side_validation = False + +def build_regenerate_keys_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + channel_name: Union[str, "_models.RegenerateKeysChannelName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + 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') + 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'), + "channelName": _SERIALIZER.url("channel_name", channel_name, 'str'), + } + + 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') + + # 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') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class DirectLineOperations(object): """DirectLineOperations operations. @@ -44,15 +93,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def regenerate_keys( self, - resource_group_name, # type: str - resource_name, # type: str - channel_name, # type: Union[str, "_models.RegenerateKeysChannelName"] - parameters, # type: "_models.SiteInfo" - **kwargs # type: Any - ): - # type: (...) -> "_models.BotChannel" + resource_group_name: str, + resource_name: str, + channel_name: Union[str, "_models.RegenerateKeysChannelName"], + parameters: "_models.SiteInfo", + **kwargs: Any + ) -> "_models.BotChannel": """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService resource. @@ -74,39 +123,29 @@ def regenerate_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.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': self._serialize.url("resource_name", resource_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'channelName': self._serialize.url("channel_name", channel_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SiteInfo') + + request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + channel_name=channel_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SiteInfo') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BotChannel', pipeline_response) @@ -115,4 +154,6 @@ def regenerate_keys( return cls(pipeline_response, deserialized, {}) return deserialized + 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/_host_settings_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_host_settings_operations.py index 5f893242d0d2..45a14abce945 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 @@ -5,22 +5,55 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class HostSettingsOperations(object): """HostSettingsOperations operations. @@ -44,11 +77,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.HostSettingsResponse" + **kwargs: Any + ) -> "_models.HostSettingsResponse": """Get per subscription settings needed to host bot in compute resource such as Azure App Service. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,31 +94,21 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(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, response) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('HostSettingsResponse', pipeline_response) @@ -94,4 +117,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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 new file mode 100644 index 000000000000..a3e071a80c6c --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operation_results_operations.py @@ -0,0 +1,183 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +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.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +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 +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_initial( + subscription_id: str, + operation_result_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}') + 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) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **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. + + :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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _get_initial( + self, + operation_result_id: str, + **kwargs: Any + ) -> Optional["_models.OperationResultsDescription"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationResultsDescription"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request_initial( + subscription_id=self._config.subscription_id, + operation_result_id=operation_result_id, + template_url=self._get_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationResultsDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}'} # type: ignore + + + @distributed_trace + def begin_get( + self, + operation_result_id: str, + **kwargs: Any + ) -> LROPoller["_models.OperationResultsDescription"]: + """Get the operation result for a long running operation. + + :param operation_result_id: The ID of the operation result to get. + :type operation_result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationResultsDescription or the result + of cls(response) + :rtype: + ~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"] + 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( + operation_result_id=operation_result_id, + cls=lambda x,y,z: x, + **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() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + 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 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 70b0dc376668..0974357b9f2f 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 @@ -5,23 +5,50 @@ # 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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,15 +72,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationEntityListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationEntityListResult"]: """Lists all the available BotService operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationEntityListResult or the result of cls(response) + :return: An iterator like instance of either OperationEntityListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.OperationEntityListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationEntityListResult', pipeline_response) + deserialized = self._deserialize("OperationEntityListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +123,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.Error, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) 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 new file mode 100644 index 000000000000..d0f7bac87b99 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,455 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +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() +_SERIALIZER.client_side_validation = False + +def build_list_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + 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') + 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 + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + 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}') + 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'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + 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}') + 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'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + 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') + + # 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') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + 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}') + 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'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + 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') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **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. + + :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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> 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. + :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: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_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. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace + def create( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_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. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. + :type properties: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified private endpoint connection associated with the Bot. + + :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 private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + 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 new file mode 100644 index 000000000000..736789dec443 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_link_resources_operations.py @@ -0,0 +1,134 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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.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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_bot_resource_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + 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}/privateLinkResources') + 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 + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['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') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **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. + + :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. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_bot_resource( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_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. + :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: PrivateLinkResourceListResult, or the result of cls(response) + :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', {})) + + + request = build_list_by_bot_resource_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_bot_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(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('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_bot_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources'} # type: ignore +