From e49cf5ed825d7459fe507097de7529d0da55aa85 Mon Sep 17 00:00:00 2001 From: swagat mishra Date: Tue, 3 Apr 2018 09:36:10 -0700 Subject: [PATCH] Add bot service sdk to support microsoft.botservice (#2328) * first commit of swagger and tests * rename test files as per convention * regenrate recordings * ran crud tests * test email and teams channels * skype and telegram * add sms channel test * add directline and webchat tests (Failing) * Add resource preparer for crud bots * final email channel * final tests * new line after setup.cfg * fix failing tests python>3.6 * add cookie cutter template * address comments --- azure-mgmt-botservice/HISTORY.rst | 9 + azure-mgmt-botservice/MANIFEST.in | 2 + azure-mgmt-botservice/README.rst | 49 ++ azure-mgmt-botservice/azure/__init__.py | 1 + azure-mgmt-botservice/azure/mgmt/__init__.py | 1 + .../azure/mgmt/botservice/__init__.py | 18 + .../mgmt/botservice/azure_bot_service.py | 96 ++++ .../azure/mgmt/botservice/models/__init__.py | 98 ++++ .../models/azure_bot_service_enums.py | 38 ++ .../azure/mgmt/botservice/models/bot.py | 62 ++ .../mgmt/botservice/models/bot_channel.py | 62 ++ .../botservice/models/bot_channel_paged.py | 27 + .../azure/mgmt/botservice/models/bot_paged.py | 27 + .../mgmt/botservice/models/bot_properties.py | 90 +++ .../azure/mgmt/botservice/models/channel.py | 40 ++ .../check_name_availability_request_body.py | 34 ++ .../check_name_availability_response_body.py | 33 ++ .../botservice/models/direct_line_channel.py | 38 ++ .../models/direct_line_channel_properties.py | 27 + .../botservice/models/direct_line_site.py | 66 +++ .../mgmt/botservice/models/email_channel.py | 37 ++ .../models/email_channel_properties.py | 41 ++ .../azure/mgmt/botservice/models/error.py | 40 ++ .../mgmt/botservice/models/error_body.py | 36 ++ .../botservice/models/facebook_channel.py | 36 ++ .../models/facebook_channel_properties.py | 63 +++ .../mgmt/botservice/models/kik_channel.py | 36 ++ .../models/kik_channel_properties.py | 45 ++ .../botservice/models/ms_teams_channel.py | 37 ++ .../models/ms_teams_channel_properties.py | 51 ++ .../models/operation_display_info.py | 40 ++ .../botservice/models/operation_entity.py | 39 ++ .../models/operation_entity_paged.py | 27 + .../azure/mgmt/botservice/models/resource.py | 65 +++ .../azure/mgmt/botservice/models/sku.py | 40 ++ .../mgmt/botservice/models/skype_channel.py | 37 ++ .../models/skype_channel_properties.py | 63 +++ .../mgmt/botservice/models/slack_channel.py | 37 ++ .../models/slack_channel_properties.py | 74 +++ .../mgmt/botservice/models/sms_channel.py | 36 ++ .../models/sms_channel_properties.py | 50 ++ .../botservice/models/telegram_channel.py | 37 ++ .../models/telegram_channel_properties.py | 40 ++ .../botservice/models/web_chat_channel.py | 37 ++ .../models/web_chat_channel_properties.py | 38 ++ .../mgmt/botservice/models/web_chat_site.py | 60 ++ .../mgmt/botservice/operations/__init__.py | 22 + .../operations/bot_services_operations.py | 101 ++++ .../botservice/operations/bots_operations.py | 435 ++++++++++++++ .../operations/channels_operations.py | 390 +++++++++++++ .../mgmt/botservice/operations/operations.py | 98 ++++ .../azure/mgmt/botservice/version.py | 13 + azure-mgmt-botservice/azure_bdist_wheel.py | 533 ++++++++++++++++++ azure-mgmt-botservice/setup.cfg | 3 + azure-mgmt-botservice/setup.py | 84 +++ azure-mgmt-botservice/tests/__init__.py | 0 ...otservice_channels.test_email_channel.yaml | 256 +++++++++ ...service_channels.test_msteams_channel.yaml | 185 ++++++ ...otservice_channels.test_skype_channel.yaml | 244 ++++++++ ..._botservice_channels.test_sms_channel.yaml | 187 ++++++ ...ervice_channels.test_telegram_channel.yaml | 186 ++++++ ...t_botservice_crud.test_bot_operations.yaml | 160 ++++++ .../tests/test_mgmt_botservice_channels.py | 177 ++++++ .../tests/test_mgmt_botservice_crud.py | 87 +++ 64 files changed, 5121 insertions(+) create mode 100644 azure-mgmt-botservice/HISTORY.rst create mode 100644 azure-mgmt-botservice/MANIFEST.in create mode 100644 azure-mgmt-botservice/README.rst create mode 100644 azure-mgmt-botservice/azure/__init__.py create mode 100644 azure-mgmt-botservice/azure/mgmt/__init__.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/__init__.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/azure_bot_service.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/azure_bot_service_enums.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/bot.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/bot_channel.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/bot_channel_paged.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/bot_paged.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/bot_properties.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/channel.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/check_name_availability_request_body.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/check_name_availability_response_body.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/direct_line_channel.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/direct_line_channel_properties.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/direct_line_site.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/email_channel.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/email_channel_properties.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/error.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/error_body.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/facebook_channel.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/facebook_channel_properties.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/kik_channel.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/kik_channel_properties.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/ms_teams_channel.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/ms_teams_channel_properties.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/operation_display_info.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/operation_entity.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/operation_entity_paged.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/resource.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/sku.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/skype_channel.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/skype_channel_properties.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/slack_channel.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/slack_channel_properties.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/sms_channel.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/sms_channel_properties.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/telegram_channel.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/telegram_channel_properties.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/web_chat_channel.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/web_chat_channel_properties.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/models/web_chat_site.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/operations/__init__.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/operations/bot_services_operations.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/operations/bots_operations.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/operations/channels_operations.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/operations/operations.py create mode 100644 azure-mgmt-botservice/azure/mgmt/botservice/version.py create mode 100644 azure-mgmt-botservice/azure_bdist_wheel.py create mode 100644 azure-mgmt-botservice/setup.cfg create mode 100644 azure-mgmt-botservice/setup.py create mode 100644 azure-mgmt-botservice/tests/__init__.py create mode 100644 azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_email_channel.yaml create mode 100644 azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_msteams_channel.yaml create mode 100644 azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_skype_channel.yaml create mode 100644 azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_sms_channel.yaml create mode 100644 azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_telegram_channel.yaml create mode 100644 azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_crud.test_bot_operations.yaml create mode 100644 azure-mgmt-botservice/tests/test_mgmt_botservice_channels.py create mode 100644 azure-mgmt-botservice/tests/test_mgmt_botservice_crud.py diff --git a/azure-mgmt-botservice/HISTORY.rst b/azure-mgmt-botservice/HISTORY.rst new file mode 100644 index 000000000000..8924d5d6c445 --- /dev/null +++ b/azure-mgmt-botservice/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +Release History +=============== + +0.1.0 (1970-01-01) +++++++++++++++++++ + +* Initial Release diff --git a/azure-mgmt-botservice/MANIFEST.in b/azure-mgmt-botservice/MANIFEST.in new file mode 100644 index 000000000000..9ecaeb15de50 --- /dev/null +++ b/azure-mgmt-botservice/MANIFEST.in @@ -0,0 +1,2 @@ +include *.rst +include azure_bdist_wheel.py \ No newline at end of file diff --git a/azure-mgmt-botservice/README.rst b/azure-mgmt-botservice/README.rst new file mode 100644 index 000000000000..091ce1ab13e3 --- /dev/null +++ b/azure-mgmt-botservice/README.rst @@ -0,0 +1,49 @@ +Microsoft Azure SDK for Python +============================== + +This is the Microsoft Azure Bot Service Client Library. + +Azure Resource Manager (ARM) is the next generation of management APIs that +replace the old Azure Service Management (ASM). + +This package has been tested with Python 2.7, 3.4, 3.5 and 3.6. + +For the older Azure Service Management (ASM) libraries, see +`azure-servicemanagement-legacy `__ library. + +For a more complete set of Azure libraries, see the `azure `__ bundle package. + + +Compatibility +============= + +**IMPORTANT**: If you have an earlier version of the azure package +(version < 1.0), you should uninstall it before installing this package. + +You can check the version using pip: + +.. code:: shell + + pip freeze + +If you see azure==0.11.0 (or any version below 1.0), uninstall it first: + +.. code:: shell + + pip uninstall azure + + +Usage +===== + +For code examples, see `Bot Service +`__ +on docs.microsoft.com. + + +Provide Feedback +================ + +If you encounter any bugs or have suggestions, please file an issue in the +`Issues `__ +section of the project. diff --git a/azure-mgmt-botservice/azure/__init__.py b/azure-mgmt-botservice/azure/__init__.py new file mode 100644 index 000000000000..de40ea7ca058 --- /dev/null +++ b/azure-mgmt-botservice/azure/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/azure-mgmt-botservice/azure/mgmt/__init__.py b/azure-mgmt-botservice/azure/mgmt/__init__.py new file mode 100644 index 000000000000..de40ea7ca058 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/__init__.py b/azure-mgmt-botservice/azure/mgmt/botservice/__init__.py new file mode 100644 index 000000000000..62afd7a253a2 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/__init__.py @@ -0,0 +1,18 @@ +# 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_bot_service import AzureBotService +from .version import VERSION + +__all__ = ['AzureBotService'] + +__version__ = VERSION + diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/azure_bot_service.py b/azure-mgmt-botservice/azure/mgmt/botservice/azure_bot_service.py new file mode 100644 index 000000000000..a3b1f8e9e3b6 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/azure_bot_service.py @@ -0,0 +1,96 @@ +# 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 msrest.service_client import ServiceClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.bots_operations import BotsOperations +from .operations.bot_services_operations import BotServicesOperations +from .operations.channels_operations import ChannelsOperations +from .operations.operations import Operations +from . import models + + +class AzureBotServiceConfiguration(AzureConfiguration): + """Configuration for AzureBotService + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Azure Subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(AzureBotServiceConfiguration, self).__init__(base_url) + + self.add_user_agent('azure-mgmt-botservice/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + + +class AzureBotService(object): + """Azure Bot Service is a platform for creating smart conversational agents. + + :ivar config: Configuration for client. + :vartype config: AzureBotServiceConfiguration + + :ivar bots: Bots operations + :vartype bots: azure.mgmt.botservice.operations.BotsOperations + :ivar bot_services: BotServices operations + :vartype bot_services: azure.mgmt.botservice.operations.BotServicesOperations + :ivar channels: Channels operations + :vartype channels: azure.mgmt.botservice.operations.ChannelsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.botservice.operations.Operations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Azure Subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = AzureBotServiceConfiguration(credentials, subscription_id, base_url) + self._client = ServiceClient(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2017-12-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.bots = BotsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.bot_services = BotServicesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.channels = ChannelsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py new file mode 100644 index 000000000000..5f741876394b --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py @@ -0,0 +1,98 @@ +# 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 .sku import Sku +from .resource import Resource +from .bot_properties import BotProperties +from .bot import Bot +from .channel import Channel +from .bot_channel import BotChannel +from .facebook_channel_properties import FacebookChannelProperties +from .facebook_channel import FacebookChannel +from .email_channel_properties import EmailChannelProperties +from .email_channel import EmailChannel +from .ms_teams_channel_properties import MsTeamsChannelProperties +from .ms_teams_channel import MsTeamsChannel +from .skype_channel_properties import SkypeChannelProperties +from .skype_channel import SkypeChannel +from .kik_channel_properties import KikChannelProperties +from .kik_channel import KikChannel +from .web_chat_site import WebChatSite +from .web_chat_channel_properties import WebChatChannelProperties +from .web_chat_channel import WebChatChannel +from .direct_line_site import DirectLineSite +from .direct_line_channel_properties import DirectLineChannelProperties +from .direct_line_channel import DirectLineChannel +from .telegram_channel_properties import TelegramChannelProperties +from .telegram_channel import TelegramChannel +from .sms_channel_properties import SmsChannelProperties +from .sms_channel import SmsChannel +from .slack_channel_properties import SlackChannelProperties +from .slack_channel import SlackChannel +from .error_body import ErrorBody +from .error import Error, ErrorException +from .operation_display_info import OperationDisplayInfo +from .operation_entity import OperationEntity +from .check_name_availability_request_body import CheckNameAvailabilityRequestBody +from .check_name_availability_response_body import CheckNameAvailabilityResponseBody +from .bot_paged import BotPaged +from .bot_channel_paged import BotChannelPaged +from .operation_entity_paged import OperationEntityPaged +from .azure_bot_service_enums import ( + SkuName, + SkuTier, + Kind, + ChannelName, +) + +__all__ = [ + 'Sku', + 'Resource', + 'BotProperties', + 'Bot', + 'Channel', + 'BotChannel', + 'FacebookChannelProperties', + 'FacebookChannel', + 'EmailChannelProperties', + 'EmailChannel', + 'MsTeamsChannelProperties', + 'MsTeamsChannel', + 'SkypeChannelProperties', + 'SkypeChannel', + 'KikChannelProperties', + 'KikChannel', + 'WebChatSite', + 'WebChatChannelProperties', + 'WebChatChannel', + 'DirectLineSite', + 'DirectLineChannelProperties', + 'DirectLineChannel', + 'TelegramChannelProperties', + 'TelegramChannel', + 'SmsChannelProperties', + 'SmsChannel', + 'SlackChannelProperties', + 'SlackChannel', + 'ErrorBody', + 'Error', 'ErrorException', + 'OperationDisplayInfo', + 'OperationEntity', + 'CheckNameAvailabilityRequestBody', + 'CheckNameAvailabilityResponseBody', + 'BotPaged', + 'BotChannelPaged', + 'OperationEntityPaged', + 'SkuName', + 'SkuTier', + 'Kind', + 'ChannelName', +] diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/azure_bot_service_enums.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/azure_bot_service_enums.py new file mode 100644 index 000000000000..7c7077a9a3a2 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/azure_bot_service_enums.py @@ -0,0 +1,38 @@ +# 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 enum import Enum + + +class SkuName(Enum): + + f0 = "F0" + s1 = "S1" + + +class SkuTier(Enum): + + free = "Free" + standard = "Standard" + + +class Kind(Enum): + + sdk = "sdk" + designer = "designer" + bot = "bot" + function = "function" + + +class ChannelName(Enum): + + facebook_channel = "FacebookChannel" + email_channel = "EmailChannel" diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/bot.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/bot.py new file mode 100644 index 000000000000..ec00bdc15815 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/bot.py @@ -0,0 +1,62 @@ +# 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 .resource import Resource + + +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: 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' + :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, location=None, tags=None, sku=None, kind=None, etag=None, properties=None): + super(Bot, self).__init__(location=location, tags=tags, sku=sku, kind=kind, etag=etag) + self.properties = properties diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/bot_channel.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/bot_channel.py new file mode 100644 index 000000000000..78b6439dcb7f --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/bot_channel.py @@ -0,0 +1,62 @@ +# 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 .resource import Resource + + +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: 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' + :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, location=None, tags=None, sku=None, kind=None, etag=None, properties=None): + super(BotChannel, self).__init__(location=location, tags=tags, sku=sku, kind=kind, etag=etag) + self.properties = properties diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/bot_channel_paged.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/bot_channel_paged.py new file mode 100644 index 000000000000..7cf0ca710405 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/bot_channel_paged.py @@ -0,0 +1,27 @@ +# 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 msrest.paging import Paged + + +class BotChannelPaged(Paged): + """ + A paging container for iterating over a list of :class:`BotChannel ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[BotChannel]'} + } + + def __init__(self, *args, **kwargs): + + super(BotChannelPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/bot_paged.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/bot_paged.py new file mode 100644 index 000000000000..410e37eb94b0 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/bot_paged.py @@ -0,0 +1,27 @@ +# 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 msrest.paging import Paged + + +class BotPaged(Paged): + """ + A paging container for iterating over a list of :class:`Bot ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Bot]'} + } + + def __init__(self, *args, **kwargs): + + super(BotPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/bot_properties.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/bot_properties.py new file mode 100644 index 000000000000..4b7e4251db5e --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/bot_properties.py @@ -0,0 +1,90 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class BotProperties(Model): + """The parameters to provide for the Bot. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param display_name: 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: The bot's endpoint + :type endpoint: str + :ivar endpoint_version: The bot's endpoint version + :vartype endpoint_version: str + :param msa_app_id: 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 + """ + + _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'}, + } + + def __init__(self, display_name, endpoint, msa_app_id, description=None, icon_url=None, developer_app_insight_key=None, developer_app_insights_api_key=None, developer_app_insights_application_id=None, luis_app_ids=None, luis_key=None): + self.display_name = display_name + self.description = description + self.icon_url = icon_url + self.endpoint = endpoint + self.endpoint_version = None + self.msa_app_id = msa_app_id + self.configured_channels = None + self.enabled_channels = None + self.developer_app_insight_key = developer_app_insight_key + self.developer_app_insights_api_key = developer_app_insights_api_key + self.developer_app_insights_application_id = developer_app_insights_application_id + self.luis_app_ids = luis_app_ids + self.luis_key = luis_key diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/channel.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/channel.py new file mode 100644 index 000000000000..d6b04cf2f463 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/channel.py @@ -0,0 +1,40 @@ +# 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 msrest.serialization import Model + + +class Channel(Model): + """Channel definition. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: FacebookChannel, EmailChannel, MsTeamsChannel, + SkypeChannel, KikChannel, WebChatChannel, DirectLineChannel, + TelegramChannel, SmsChannel, SlackChannel + + :param 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': {'FacebookChannel': 'FacebookChannel', 'EmailChannel': 'EmailChannel', 'MsTeamsChannel': 'MsTeamsChannel', 'SkypeChannel': 'SkypeChannel', 'KikChannel': 'KikChannel', 'WebChatChannel': 'WebChatChannel', 'DirectLineChannel': 'DirectLineChannel', 'TelegramChannel': 'TelegramChannel', 'SmsChannel': 'SmsChannel', 'SlackChannel': 'SlackChannel'} + } + + def __init__(self): + self.channel_name = None diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/check_name_availability_request_body.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/check_name_availability_request_body.py new file mode 100644 index 000000000000..7c78f2e00d5a --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/check_name_availability_request_body.py @@ -0,0 +1,34 @@ +# 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 msrest.serialization import Model + + +class CheckNameAvailabilityRequestBody(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, name=None, type=None): + self.name = name + self.type = type diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/check_name_availability_response_body.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/check_name_availability_response_body.py new file mode 100644 index 000000000000..4e1313f2f5e3 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/check_name_availability_response_body.py @@ -0,0 +1,33 @@ +# 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 msrest.serialization import Model + + +class CheckNameAvailabilityResponseBody(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, valid=None, message=None): + self.valid = valid + self.message = message diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/direct_line_channel.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/direct_line_channel.py new file mode 100644 index 000000000000..43af144b6f01 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/direct_line_channel.py @@ -0,0 +1,38 @@ +# 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 .channel import Channel + + +class DirectLineChannel(Channel): + """Direct Line channel definition. + + :param 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, properties=None): + super(DirectLineChannel, self).__init__() + self.properties = properties + self.channel_name = 'DirectLineChannel' diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/direct_line_channel_properties.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/direct_line_channel_properties.py new file mode 100644 index 000000000000..537e8b44ea9c --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/direct_line_channel_properties.py @@ -0,0 +1,27 @@ +# 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 msrest.serialization import Model + + +class DirectLineChannelProperties(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, sites=None): + self.sites = sites diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/direct_line_site.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/direct_line_site.py new file mode 100644 index 000000000000..3cf031dbf261 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/direct_line_site.py @@ -0,0 +1,66 @@ +# 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 msrest.serialization import Model + + +class DirectLineSite(Model): + """A site for the Direct Line channel. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar site_id: Site Id + :vartype site_id: str + :param site_name: Site name + :type site_name: str + :ivar key: Primary key + :vartype key: str + :ivar key2: Secondary key + :vartype key2: str + :param is_enabled: Whether this site is enabled for DirectLine channel + :type is_enabled: bool + :param is_v1_enabled: Whether this site is enabled for Bot Framework V1 + protocol + :type is_v1_enabled: bool + :param is_v3_enabled: Whether this site is enabled for Bot Framework V1 + protocol + :type is_v3_enabled: bool + """ + + _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'}, + } + + def __init__(self, site_name, is_enabled, is_v1_enabled, is_v3_enabled): + self.site_id = None + self.site_name = site_name + self.key = None + self.key2 = None + self.is_enabled = is_enabled + self.is_v1_enabled = is_v1_enabled + self.is_v3_enabled = is_v3_enabled diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/email_channel.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/email_channel.py new file mode 100644 index 000000000000..d8b1cf9f46a9 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/email_channel.py @@ -0,0 +1,37 @@ +# 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 .channel import Channel + + +class EmailChannel(Channel): + """Email channel definition. + + :param 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, properties=None): + super(EmailChannel, self).__init__() + self.properties = properties + self.channel_name = 'EmailChannel' diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/email_channel_properties.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/email_channel_properties.py new file mode 100644 index 000000000000..cbf2197c474b --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/email_channel_properties.py @@ -0,0 +1,41 @@ +# 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 msrest.serialization import Model + + +class EmailChannelProperties(Model): + """The parameters to provide for the Email channel. + + :param email_address: The email address + :type email_address: str + :param password: The password for the email address + :type password: str + :param is_enabled: Whether this channel is enabled for the bot + :type is_enabled: bool + """ + + _validation = { + 'email_address': {'required': True}, + 'password': {'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, email_address, password, is_enabled): + self.email_address = email_address + self.password = password + self.is_enabled = is_enabled diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/error.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/error.py new file mode 100644 index 000000000000..019e466cd621 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/error.py @@ -0,0 +1,40 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Error(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, error=None): + self.error = error + + +class ErrorException(HttpOperationError): + """Server responsed with exception of type: 'Error'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorException, self).__init__(deserialize, response, 'Error', *args) diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/error_body.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/error_body.py new file mode 100644 index 000000000000..926be9c3b948 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/error_body.py @@ -0,0 +1,36 @@ +# 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 msrest.serialization import Model + + +class ErrorBody(Model): + """Bot Service error body. + + :param code: error code + :type code: str + :param message: 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, code, message): + self.code = code + self.message = message diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/facebook_channel.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/facebook_channel.py new file mode 100644 index 000000000000..b253e2fb1f49 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/facebook_channel.py @@ -0,0 +1,36 @@ +# 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 .channel import Channel + + +class FacebookChannel(Channel): + """Facebook channel definition. + + :param 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, properties=None): + super(FacebookChannel, self).__init__() + self.properties = properties + self.channel_name = 'FacebookChannel' diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/facebook_channel_properties.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/facebook_channel_properties.py new file mode 100644 index 000000000000..d37ace5ab6aa --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/facebook_channel_properties.py @@ -0,0 +1,63 @@ +# 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 msrest.serialization import Model + + +class FacebookChannelProperties(Model): + """The parameters to provide for the Facebook channel. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar verify_token: Verify token + :vartype verify_token: str + :param page_id: Page id + :type page_id: str + :param app_id: Facebook application id + :type app_id: str + :param app_secret: Facebook application secret + :type app_secret: str + :param access_token: Facebook application access token + :type access_token: str + :ivar callback_url: Callback Url + :vartype callback_url: str + :param is_enabled: Whether this channel is enabled for the bot + :type is_enabled: bool + """ + + _validation = { + 'verify_token': {'readonly': True}, + 'page_id': {'required': True}, + 'app_id': {'required': True}, + 'app_secret': {'required': True}, + 'callback_url': {'readonly': True}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'verify_token': {'key': 'verifyToken', 'type': 'str'}, + 'page_id': {'key': 'pageId', 'type': 'str'}, + 'app_id': {'key': 'appId', 'type': 'str'}, + 'app_secret': {'key': 'appSecret', 'type': 'str'}, + 'access_token': {'key': 'accessToken', 'type': 'str'}, + 'callback_url': {'key': 'callbackUrl', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__(self, page_id, app_id, app_secret, is_enabled, access_token=None): + self.verify_token = None + self.page_id = page_id + self.app_id = app_id + self.app_secret = app_secret + self.access_token = access_token + self.callback_url = None + self.is_enabled = is_enabled diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/kik_channel.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/kik_channel.py new file mode 100644 index 000000000000..e3fe47a1b214 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/kik_channel.py @@ -0,0 +1,36 @@ +# 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 .channel import Channel + + +class KikChannel(Channel): + """Kik channel definition. + + :param 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, properties=None): + super(KikChannel, self).__init__() + self.properties = properties + self.channel_name = 'KikChannel' diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/kik_channel_properties.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/kik_channel_properties.py new file mode 100644 index 000000000000..8a12161f37c1 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/kik_channel_properties.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class KikChannelProperties(Model): + """The parameters to provide for the Kik channel. + + :param user_name: The Kik user name + :type user_name: str + :param api_key: Kik API key + :type api_key: str + :param is_validated: Whether this channel is validated for the bot + :type is_validated: bool + :param is_enabled: Whether this channel is enabled for the bot + :type is_enabled: bool + """ + + _validation = { + 'user_name': {'required': True}, + 'api_key': {'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, user_name, api_key, is_enabled, is_validated=None): + self.user_name = user_name + self.api_key = api_key + self.is_validated = is_validated + self.is_enabled = is_enabled diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/ms_teams_channel.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/ms_teams_channel.py new file mode 100644 index 000000000000..c5a9c0b932e0 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/ms_teams_channel.py @@ -0,0 +1,37 @@ +# 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 .channel import Channel + + +class MsTeamsChannel(Channel): + """Microsoft Teams channel definition. + + :param 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, properties=None): + super(MsTeamsChannel, self).__init__() + self.properties = properties + self.channel_name = 'MsTeamsChannel' diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/ms_teams_channel_properties.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/ms_teams_channel_properties.py new file mode 100644 index 000000000000..51bbe2bbed2f --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/ms_teams_channel_properties.py @@ -0,0 +1,51 @@ +# 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 msrest.serialization import Model + + +class MsTeamsChannelProperties(Model): + """The parameters to provide for the Microsoft Teams channel. + + :param enable_messaging: Enable messaging for Microsoft Teams channel + :type enable_messaging: bool + :param enable_media_cards: Enable media cards for Microsoft Teams channel + :type enable_media_cards: bool + :param enable_video: Enable video for Microsoft Teams channel + :type enable_video: bool + :param enable_calling: Enable calling for Microsoft Teams channel + :type enable_calling: bool + :param call_mode: Enable messaging for Microsoft Teams channel + :type call_mode: str + :param is_enabled: 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'}, + 'call_mode': {'key': 'callMode', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__(self, is_enabled, enable_messaging=None, enable_media_cards=None, enable_video=None, enable_calling=None, call_mode=None): + self.enable_messaging = enable_messaging + self.enable_media_cards = enable_media_cards + self.enable_video = enable_video + self.enable_calling = enable_calling + self.call_mode = call_mode + self.is_enabled = is_enabled diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/operation_display_info.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/operation_display_info.py new file mode 100644 index 000000000000..4be59cd2d4b6 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/operation_display_info.py @@ -0,0 +1,40 @@ +# 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 msrest.serialization import Model + + +class OperationDisplayInfo(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, description=None, operation=None, provider=None, resource=None): + self.description = description + self.operation = operation + self.provider = provider + self.resource = resource diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/operation_entity.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/operation_entity.py new file mode 100644 index 000000000000..37922e24676b --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/operation_entity.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class OperationEntity(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: object + """ + + _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, name=None, display=None, origin=None, properties=None): + self.name = name + self.display = display + self.origin = origin + self.properties = properties diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/operation_entity_paged.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/operation_entity_paged.py new file mode 100644 index 000000000000..f9016021095d --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/operation_entity_paged.py @@ -0,0 +1,27 @@ +# 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 msrest.paging import Paged + + +class OperationEntityPaged(Paged): + """ + A paging container for iterating over a list of :class:`OperationEntity ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[OperationEntity]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationEntityPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/resource.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/resource.py new file mode 100644 index 000000000000..668f18a1c16c --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/resource.py @@ -0,0 +1,65 @@ +# 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 msrest.serialization import Model + + +class Resource(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: 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' + :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, location=None, tags=None, sku=None, kind=None, etag=None): + self.id = None + self.name = None + self.location = location + self.type = None + self.tags = tags + self.sku = sku + self.kind = kind + self.etag = etag diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/sku.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/sku.py new file mode 100644 index 000000000000..35fa9c142249 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/sku.py @@ -0,0 +1,40 @@ +# 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 msrest.serialization import Model + + +class Sku(Model): + """The SKU of the cognitive services account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param name: 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, name): + self.name = name + self.tier = None diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/skype_channel.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/skype_channel.py new file mode 100644 index 000000000000..f9c12c31dd01 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/skype_channel.py @@ -0,0 +1,37 @@ +# 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 .channel import Channel + + +class SkypeChannel(Channel): + """Skype channel definition. + + :param 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, properties=None): + super(SkypeChannel, self).__init__() + self.properties = properties + self.channel_name = 'SkypeChannel' diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/skype_channel_properties.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/skype_channel_properties.py new file mode 100644 index 000000000000..582d94c48697 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/skype_channel_properties.py @@ -0,0 +1,63 @@ +# 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 msrest.serialization import Model + + +class SkypeChannelProperties(Model): + """The parameters to provide for the Microsoft Teams channel. + + :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: 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, is_enabled, enable_messaging=None, enable_media_cards=None, enable_video=None, enable_calling=None, enable_screen_sharing=None, enable_groups=None, groups_mode=None, calling_web_hook=None): + self.enable_messaging = enable_messaging + self.enable_media_cards = enable_media_cards + self.enable_video = enable_video + self.enable_calling = enable_calling + self.enable_screen_sharing = enable_screen_sharing + self.enable_groups = enable_groups + self.groups_mode = groups_mode + self.calling_web_hook = calling_web_hook + self.is_enabled = is_enabled diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/slack_channel.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/slack_channel.py new file mode 100644 index 000000000000..7be5bd512b2e --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/slack_channel.py @@ -0,0 +1,37 @@ +# 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 .channel import Channel + + +class SlackChannel(Channel): + """Slack channel definition. + + :param 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, properties=None): + super(SlackChannel, self).__init__() + self.properties = properties + self.channel_name = 'SlackChannel' diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/slack_channel_properties.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/slack_channel_properties.py new file mode 100644 index 000000000000..7c0f60cb0b5c --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/slack_channel_properties.py @@ -0,0 +1,74 @@ +# 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 msrest.serialization import Model + + +class SlackChannelProperties(Model): + """The parameters to provide for the Slack channel. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param client_id: The Slack client id + :type client_id: str + :param client_secret: The Slack client secret + :type client_secret: str + :param verification_token: The Slack verification token + :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_oauth_flow: Whether to register the settings before + OAuth validation is performed. Recommended to True. + :vartype register_before_oauth_flow: bool + :ivar is_validated: Whether this channel is validated for the bot + :vartype is_validated: bool + :param is_enabled: Whether this channel is enabled for the bot + :type is_enabled: bool + """ + + _validation = { + 'client_id': {'required': True}, + 'client_secret': {'required': True}, + 'verification_token': {'required': True}, + 'redirect_action': {'readonly': True}, + 'last_submission_id': {'readonly': True}, + 'register_before_oauth_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_oauth_flow': {'key': 'registerBeforeOAuthFlow', 'type': 'bool'}, + 'is_validated': {'key': 'isValidated', 'type': 'bool'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__(self, client_id, client_secret, verification_token, is_enabled, landing_page_url=None): + self.client_id = client_id + self.client_secret = client_secret + self.verification_token = verification_token + self.landing_page_url = landing_page_url + self.redirect_action = None + self.last_submission_id = None + self.register_before_oauth_flow = None + self.is_validated = None + self.is_enabled = is_enabled diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/sms_channel.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/sms_channel.py new file mode 100644 index 000000000000..dba9ebc83637 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/sms_channel.py @@ -0,0 +1,36 @@ +# 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 .channel import Channel + + +class SmsChannel(Channel): + """Sms channel definition. + + :param 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, properties=None): + super(SmsChannel, self).__init__() + self.properties = properties + self.channel_name = 'SmsChannel' diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/sms_channel_properties.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/sms_channel_properties.py new file mode 100644 index 000000000000..45898f7a9e30 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/sms_channel_properties.py @@ -0,0 +1,50 @@ +# 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 msrest.serialization import Model + + +class SmsChannelProperties(Model): + """The parameters to provide for the Sms channel. + + :param phone: The Sms phone + :type phone: str + :param account_sid: The Sms account SID + :type account_sid: str + :param auth_token: The Sms auth token + :type auth_token: str + :param is_validated: Whether this channel is validated for the bot + :type is_validated: bool + :param is_enabled: Whether this channel is enabled for the bot + :type is_enabled: bool + """ + + _validation = { + 'phone': {'required': True}, + 'account_sid': {'required': True}, + 'auth_token': {'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, phone, account_sid, auth_token, is_enabled, is_validated=None): + self.phone = phone + self.account_sid = account_sid + self.auth_token = auth_token + self.is_validated = is_validated + self.is_enabled = is_enabled diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/telegram_channel.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/telegram_channel.py new file mode 100644 index 000000000000..eb2afc7e87bd --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/telegram_channel.py @@ -0,0 +1,37 @@ +# 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 .channel import Channel + + +class TelegramChannel(Channel): + """Telegram channel definition. + + :param 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, properties=None): + super(TelegramChannel, self).__init__() + self.properties = properties + self.channel_name = 'TelegramChannel' diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/telegram_channel_properties.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/telegram_channel_properties.py new file mode 100644 index 000000000000..9430466c7a60 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/telegram_channel_properties.py @@ -0,0 +1,40 @@ +# 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 msrest.serialization import Model + + +class TelegramChannelProperties(Model): + """The parameters to provide for the Telegram channel. + + :param access_token: The Telegram access token + :type access_token: str + :param is_validated: Whether this channel is validated for the bot + :type is_validated: bool + :param is_enabled: Whether this channel is enabled for the bot + :type is_enabled: bool + """ + + _validation = { + 'access_token': {'required': True}, + '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, access_token, is_enabled, is_validated=None): + self.access_token = access_token + self.is_validated = is_validated + self.is_enabled = is_enabled diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/web_chat_channel.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/web_chat_channel.py new file mode 100644 index 000000000000..e2fc362fdb69 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/web_chat_channel.py @@ -0,0 +1,37 @@ +# 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 .channel import Channel + + +class WebChatChannel(Channel): + """Web Chat channel definition. + + :param 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, properties=None): + super(WebChatChannel, self).__init__() + self.properties = properties + self.channel_name = 'WebChatChannel' diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/web_chat_channel_properties.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/web_chat_channel_properties.py new file mode 100644 index 000000000000..144b64707a65 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/web_chat_channel_properties.py @@ -0,0 +1,38 @@ +# 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 msrest.serialization import Model + + +class WebChatChannelProperties(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, sites=None): + self.web_chat_embed_code = None + self.sites = sites diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/models/web_chat_site.py b/azure-mgmt-botservice/azure/mgmt/botservice/models/web_chat_site.py new file mode 100644 index 000000000000..bcee7b9bddc5 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/models/web_chat_site.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class WebChatSite(Model): + """A site for the Webchat channel. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar site_id: Site Id + :vartype site_id: str + :param site_name: Site name + :type site_name: str + :ivar key: Primary key + :vartype key: str + :ivar key2: Secondary key + :vartype key2: str + :param is_enabled: Whether this site is enabled for DirectLine channel + :type is_enabled: bool + :param enable_preview: 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, is_enabled, enable_preview): + 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/azure-mgmt-botservice/azure/mgmt/botservice/operations/__init__.py b/azure-mgmt-botservice/azure/mgmt/botservice/operations/__init__.py new file mode 100644 index 000000000000..f36f516ecc3f --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/operations/__init__.py @@ -0,0 +1,22 @@ +# 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 .bots_operations import BotsOperations +from .bot_services_operations import BotServicesOperations +from .channels_operations import ChannelsOperations +from .operations import Operations + +__all__ = [ + 'BotsOperations', + 'BotServicesOperations', + 'ChannelsOperations', + 'Operations', +] diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/operations/bot_services_operations.py b/azure-mgmt-botservice/azure/mgmt/botservice/operations/bot_services_operations.py new file mode 100644 index 000000000000..2902f7951ec6 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/operations/bot_services_operations.py @@ -0,0 +1,101 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class BotServicesOperations(object): + """BotServicesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-12-01. Constant value: "2017-12-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-12-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Returns all the resources of a particular type belonging to a + subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Bot + :rtype: + ~azure.mgmt.botservice.models.BotPaged[~azure.mgmt.botservice.models.Bot] + :raises: + :class:`ErrorException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices' + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.BotPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.BotPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/operations/bots_operations.py b/azure-mgmt-botservice/azure/mgmt/botservice/operations/bots_operations.py new file mode 100644 index 000000000000..5ad70b3168b3 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/operations/bots_operations.py @@ -0,0 +1,435 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class BotsOperations(object): + """BotsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-12-01. Constant value: "2017-12-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-12-01" + + self.config = config + + def create( + self, resource_group_name, resource_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates a Bot Service. Bot Service is a resource group wide resource + type. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. + :type parameters: ~azure.mgmt.botservice.models.Bot + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Bot or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.botservice.models.Bot or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Bot') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Bot', response) + if response.status_code == 201: + deserialized = self._deserialize('Bot', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, resource_name, location=None, tags=None, sku=None, kind=None, etag=None, properties=None, custom_headers=None, raw=False, **operation_config): + """Updates a Bot Service. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :type resource_name: str + :param location: Specifies the location of the resource. + :type location: str + :param 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' + :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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Bot or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.botservice.models.Bot or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + parameters = models.Bot(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Bot') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Bot', response) + if response.status_code == 201: + deserialized = self._deserialize('Bot', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def delete( + self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): + """Deletes a Bot Service from the resource group. . + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :type resource_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def get( + self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): + """Returns a BotService specified by the parameters. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :type resource_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Bot or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.botservice.models.Bot or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Bot', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Returns all the resources of a particular type belonging to a resource + group. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Bot + :rtype: + ~azure.mgmt.botservice.models.BotPaged[~azure.mgmt.botservice.models.Bot] + :raises: + :class:`ErrorException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.BotPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.BotPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + + def get_check_name_availability( + self, name=None, type=None, custom_headers=None, raw=False, **operation_config): + """Check whether a bot name is available. + + :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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CheckNameAvailabilityResponseBody or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + parameters = models.CheckNameAvailabilityRequestBody(name=name, type=type) + + # Construct URL + url = '/providers/Microsoft.BotService/botServices/checkNameAvailability' + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'CheckNameAvailabilityRequestBody') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CheckNameAvailabilityResponseBody', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/operations/channels_operations.py b/azure-mgmt-botservice/azure/mgmt/botservice/operations/channels_operations.py new file mode 100644 index 000000000000..4c17ba4c21d7 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/operations/channels_operations.py @@ -0,0 +1,390 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ChannelsOperations(object): + """ChannelsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-12-01. Constant value: "2017-12-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-12-01" + + self.config = config + + def create( + self, resource_group_name, resource_name, channel_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :type resource_name: str + :param channel_name: The name of the Bot resource. Possible values + include: 'FacebookChannel', 'EmailChannel', 'KikChannel', + 'TelegramChannel', 'SlackChannel' + :type channel_name: str + :param parameters: The parameters to provide for the created bot. + :type parameters: ~azure.mgmt.botservice.models.BotChannel + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BotChannel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.botservice.models.BotChannel or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'BotChannel') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BotChannel', response) + if response.status_code == 201: + deserialized = self._deserialize('BotChannel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, resource_name, channel_name, location=None, tags=None, sku=None, kind=None, etag=None, properties=None, custom_headers=None, raw=False, **operation_config): + """Updates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :type resource_name: str + :param channel_name: The name of the Bot resource. Possible values + include: 'FacebookChannel', 'EmailChannel', 'KikChannel', + 'TelegramChannel', 'SlackChannel' + :type channel_name: str + :param location: Specifies the location of the resource. + :type location: str + :param 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' + :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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BotChannel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.botservice.models.BotChannel or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + parameters = models.BotChannel(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties) + + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'BotChannel') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BotChannel', response) + if response.status_code == 201: + deserialized = self._deserialize('BotChannel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def delete( + self, resource_group_name, resource_name, channel_name, custom_headers=None, raw=False, **operation_config): + """Deletes a Channel registration from a Bot Service. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :type resource_name: str + :param channel_name: The name of the Bot resource. + :type channel_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def get( + self, resource_group_name, resource_name, channel_name, custom_headers=None, raw=False, **operation_config): + """Returns a BotService Channel registration specified by the parameters. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :type resource_name: str + :param channel_name: The name of the Bot resource. + :type channel_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: BotChannel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.botservice.models.BotChannel or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BotChannel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_by_resource_group( + self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): + """Returns all the Channel registrations of a particular BotService + resource. + + :param resource_group_name: The name of the resource group within the + user's subscription. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. + :type resource_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of BotChannel + :rtype: + ~azure.mgmt.botservice.models.BotChannelPaged[~azure.mgmt.botservice.models.BotChannel] + :raises: + :class:`ErrorException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels' + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.BotChannelPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.BotChannelPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/operations/operations.py b/azure-mgmt-botservice/azure/mgmt/botservice/operations/operations.py new file mode 100644 index 000000000000..87663ae547e2 --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/operations/operations.py @@ -0,0 +1,98 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class Operations(object): + """Operations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-12-01. Constant value: "2017-12-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-12-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all the available BotService operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of OperationEntity + :rtype: + ~azure.mgmt.botservice.models.OperationEntityPaged[~azure.mgmt.botservice.models.OperationEntity] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/providers/Microsoft.BotService/operations' + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.OperationEntityPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.OperationEntityPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-botservice/azure/mgmt/botservice/version.py b/azure-mgmt-botservice/azure/mgmt/botservice/version.py new file mode 100644 index 000000000000..e0ec669828cb --- /dev/null +++ b/azure-mgmt-botservice/azure/mgmt/botservice/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" + diff --git a/azure-mgmt-botservice/azure_bdist_wheel.py b/azure-mgmt-botservice/azure_bdist_wheel.py new file mode 100644 index 000000000000..61ec571a9743 --- /dev/null +++ b/azure-mgmt-botservice/azure_bdist_wheel.py @@ -0,0 +1,533 @@ +""" +"wheel" copyright (c) 2012-2017 Daniel Holth and +contributors. + +The MIT License + +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. + +Create a Azure wheel (.whl) distribution (a wheel is a built archive format). + +This file is a copy of the official bdist_wheel file from wheel 0.30.0a0, enhanced +of the bottom with some Microsoft extension for Azure SDK for Python + +""" + +import csv +import hashlib +import os +import subprocess +import warnings +import shutil +import json +import sys + +try: + import sysconfig +except ImportError: # pragma nocover + # Python < 2.7 + import distutils.sysconfig as sysconfig + +import pkg_resources + +safe_name = pkg_resources.safe_name +safe_version = pkg_resources.safe_version + +from shutil import rmtree +from email.generator import Generator + +from distutils.core import Command +from distutils.sysconfig import get_python_version + +from distutils import log as logger + +from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag, get_platform +from wheel.util import native, open_for_csv +from wheel.archive import archive_wheelfile +from wheel.pkginfo import read_pkg_info, write_pkg_info +from wheel.metadata import pkginfo_to_dict +from wheel import pep425tags, metadata +from wheel import __version__ as wheel_version + +def safer_name(name): + return safe_name(name).replace('-', '_') + +def safer_version(version): + return safe_version(version).replace('-', '_') + +class bdist_wheel(Command): + + description = 'create a wheel distribution' + + user_options = [('bdist-dir=', 'b', + "temporary directory for creating the distribution"), + ('plat-name=', 'p', + "platform name to embed in generated filenames " + "(default: %s)" % get_platform()), + ('keep-temp', 'k', + "keep the pseudo-installation tree around after " + + "creating the distribution archive"), + ('dist-dir=', 'd', + "directory to put final built distributions in"), + ('skip-build', None, + "skip rebuilding everything (for testing/debugging)"), + ('relative', None, + "build the archive using relative paths" + "(default: false)"), + ('owner=', 'u', + "Owner name used when creating a tar file" + " [default: current user]"), + ('group=', 'g', + "Group name used when creating a tar file" + " [default: current group]"), + ('universal', None, + "make a universal wheel" + " (default: false)"), + ('python-tag=', None, + "Python implementation compatibility tag" + " (default: py%s)" % get_impl_ver()[0]), + ] + + boolean_options = ['keep-temp', 'skip-build', 'relative', 'universal'] + + def initialize_options(self): + self.bdist_dir = None + self.data_dir = None + self.plat_name = None + self.plat_tag = None + self.format = 'zip' + self.keep_temp = False + self.dist_dir = None + self.distinfo_dir = None + self.egginfo_dir = None + self.root_is_pure = None + self.skip_build = None + self.relative = False + self.owner = None + self.group = None + self.universal = False + self.python_tag = 'py' + get_impl_ver()[0] + self.plat_name_supplied = False + + def finalize_options(self): + if self.bdist_dir is None: + bdist_base = self.get_finalized_command('bdist').bdist_base + self.bdist_dir = os.path.join(bdist_base, 'wheel') + + self.data_dir = self.wheel_dist_name + '.data' + self.plat_name_supplied = self.plat_name is not None + + need_options = ('dist_dir', 'plat_name', 'skip_build') + + self.set_undefined_options('bdist', + *zip(need_options, need_options)) + + self.root_is_pure = not (self.distribution.has_ext_modules() + or self.distribution.has_c_libraries()) + + # Support legacy [wheel] section for setting universal + wheel = self.distribution.get_option_dict('wheel') + if 'universal' in wheel: + # please don't define this in your global configs + val = wheel['universal'][1].strip() + if val.lower() in ('1', 'true', 'yes'): + self.universal = True + + @property + def wheel_dist_name(self): + """Return distribution full name with - replaced with _""" + return '-'.join((safer_name(self.distribution.get_name()), + safer_version(self.distribution.get_version()))) + + def get_tag(self): + # bdist sets self.plat_name if unset, we should only use it for purepy + # wheels if the user supplied it. + if self.plat_name_supplied: + plat_name = self.plat_name + elif self.root_is_pure: + plat_name = 'any' + else: + plat_name = self.plat_name or get_platform() + if plat_name in ('linux-x86_64', 'linux_x86_64') and sys.maxsize == 2147483647: + plat_name = 'linux_i686' + plat_name = plat_name.replace('-', '_').replace('.', '_') + + + if self.root_is_pure: + if self.universal: + impl = 'py2.py3' + else: + impl = self.python_tag + tag = (impl, 'none', plat_name) + else: + impl_name = get_abbr_impl() + impl_ver = get_impl_ver() + # PEP 3149 + abi_tag = str(get_abi_tag()).lower() + tag = (impl_name + impl_ver, abi_tag, plat_name) + supported_tags = pep425tags.get_supported( + supplied_platform=plat_name if self.plat_name_supplied else None) + # XXX switch to this alternate implementation for non-pure: + assert tag == supported_tags[0], "%s != %s" % (tag, supported_tags[0]) + return tag + + def get_archive_basename(self): + """Return archive name without extension""" + + impl_tag, abi_tag, plat_tag = self.get_tag() + + archive_basename = "%s-%s-%s-%s" % ( + self.wheel_dist_name, + impl_tag, + abi_tag, + plat_tag) + return archive_basename + + def run(self): + build_scripts = self.reinitialize_command('build_scripts') + build_scripts.executable = 'python' + + if not self.skip_build: + self.run_command('build') + + install = self.reinitialize_command('install', + reinit_subcommands=True) + install.root = self.bdist_dir + install.compile = False + install.skip_build = self.skip_build + install.warn_dir = False + + # A wheel without setuptools scripts is more cross-platform. + # Use the (undocumented) `no_ep` option to setuptools' + # install_scripts command to avoid creating entry point scripts. + install_scripts = self.reinitialize_command('install_scripts') + install_scripts.no_ep = True + + # Use a custom scheme for the archive, because we have to decide + # at installation time which scheme to use. + for key in ('headers', 'scripts', 'data', 'purelib', 'platlib'): + setattr(install, + 'install_' + key, + os.path.join(self.data_dir, key)) + + basedir_observed = '' + + if os.name == 'nt': + # win32 barfs if any of these are ''; could be '.'? + # (distutils.command.install:change_roots bug) + basedir_observed = os.path.normpath(os.path.join(self.data_dir, '..')) + self.install_libbase = self.install_lib = basedir_observed + + setattr(install, + 'install_purelib' if self.root_is_pure else 'install_platlib', + basedir_observed) + + logger.info("installing to %s", self.bdist_dir) + + self.run_command('install') + + archive_basename = self.get_archive_basename() + + pseudoinstall_root = os.path.join(self.dist_dir, archive_basename) + if not self.relative: + archive_root = self.bdist_dir + else: + archive_root = os.path.join( + self.bdist_dir, + self._ensure_relative(install.install_base)) + + self.set_undefined_options( + 'install_egg_info', ('target', 'egginfo_dir')) + self.distinfo_dir = os.path.join(self.bdist_dir, + '%s.dist-info' % self.wheel_dist_name) + self.egg2dist(self.egginfo_dir, + self.distinfo_dir) + + self.write_wheelfile(self.distinfo_dir) + + self.write_record(self.bdist_dir, self.distinfo_dir) + + # Make the archive + if not os.path.exists(self.dist_dir): + os.makedirs(self.dist_dir) + wheel_name = archive_wheelfile(pseudoinstall_root, archive_root) + + # Sign the archive + if 'WHEEL_TOOL' in os.environ: + subprocess.call([os.environ['WHEEL_TOOL'], 'sign', wheel_name]) + + # Add to 'Distribution.dist_files' so that the "upload" command works + getattr(self.distribution, 'dist_files', []).append( + ('bdist_wheel', get_python_version(), wheel_name)) + + if not self.keep_temp: + if self.dry_run: + logger.info('removing %s', self.bdist_dir) + else: + rmtree(self.bdist_dir) + + def write_wheelfile(self, wheelfile_base, generator='bdist_wheel (' + wheel_version + ')'): + from email.message import Message + msg = Message() + msg['Wheel-Version'] = '1.0' # of the spec + msg['Generator'] = generator + msg['Root-Is-Purelib'] = str(self.root_is_pure).lower() + + # Doesn't work for bdist_wininst + impl_tag, abi_tag, plat_tag = self.get_tag() + for impl in impl_tag.split('.'): + for abi in abi_tag.split('.'): + for plat in plat_tag.split('.'): + msg['Tag'] = '-'.join((impl, abi, plat)) + + wheelfile_path = os.path.join(wheelfile_base, 'WHEEL') + logger.info('creating %s', wheelfile_path) + with open(wheelfile_path, 'w') as f: + Generator(f, maxheaderlen=0).flatten(msg) + + def _ensure_relative(self, path): + # copied from dir_util, deleted + drive, path = os.path.splitdrive(path) + if path[0:1] == os.sep: + path = drive + path[1:] + return path + + def _pkginfo_to_metadata(self, egg_info_path, pkginfo_path): + return metadata.pkginfo_to_metadata(egg_info_path, pkginfo_path) + + def license_file(self): + """Return license filename from a license-file key in setup.cfg, or None.""" + metadata = self.distribution.get_option_dict('metadata') + if not 'license_file' in metadata: + return None + return metadata['license_file'][1] + + def setupcfg_requirements(self): + """Generate requirements from setup.cfg as + ('Requires-Dist', 'requirement; qualifier') tuples. From a metadata + section in setup.cfg: + + [metadata] + provides-extra = extra1 + extra2 + requires-dist = requirement; qualifier + another; qualifier2 + unqualified + + Yields + + ('Provides-Extra', 'extra1'), + ('Provides-Extra', 'extra2'), + ('Requires-Dist', 'requirement; qualifier'), + ('Requires-Dist', 'another; qualifier2'), + ('Requires-Dist', 'unqualified') + """ + metadata = self.distribution.get_option_dict('metadata') + + # our .ini parser folds - to _ in key names: + for key, title in (('provides_extra', 'Provides-Extra'), + ('requires_dist', 'Requires-Dist')): + if not key in metadata: + continue + field = metadata[key] + for line in field[1].splitlines(): + line = line.strip() + if not line: + continue + yield (title, line) + + def add_requirements(self, metadata_path): + """Add additional requirements from setup.cfg to file metadata_path""" + additional = list(self.setupcfg_requirements()) + if not additional: return + pkg_info = read_pkg_info(metadata_path) + if 'Provides-Extra' in pkg_info or 'Requires-Dist' in pkg_info: + warnings.warn('setup.cfg requirements overwrite values from setup.py') + del pkg_info['Provides-Extra'] + del pkg_info['Requires-Dist'] + for k, v in additional: + pkg_info[k] = v + write_pkg_info(metadata_path, pkg_info) + + def egg2dist(self, egginfo_path, distinfo_path): + """Convert an .egg-info directory into a .dist-info directory""" + def adios(p): + """Appropriately delete directory, file or link.""" + if os.path.exists(p) and not os.path.islink(p) and os.path.isdir(p): + shutil.rmtree(p) + elif os.path.exists(p): + os.unlink(p) + + adios(distinfo_path) + + if not os.path.exists(egginfo_path): + # There is no egg-info. This is probably because the egg-info + # file/directory is not named matching the distribution name used + # to name the archive file. Check for this case and report + # accordingly. + import glob + pat = os.path.join(os.path.dirname(egginfo_path), '*.egg-info') + possible = glob.glob(pat) + err = "Egg metadata expected at %s but not found" % (egginfo_path,) + if possible: + alt = os.path.basename(possible[0]) + err += " (%s found - possible misnamed archive file?)" % (alt,) + + raise ValueError(err) + + if os.path.isfile(egginfo_path): + # .egg-info is a single file + pkginfo_path = egginfo_path + pkg_info = self._pkginfo_to_metadata(egginfo_path, egginfo_path) + os.mkdir(distinfo_path) + else: + # .egg-info is a directory + pkginfo_path = os.path.join(egginfo_path, 'PKG-INFO') + pkg_info = self._pkginfo_to_metadata(egginfo_path, pkginfo_path) + + # ignore common egg metadata that is useless to wheel + shutil.copytree(egginfo_path, distinfo_path, + ignore=lambda x, y: set(('PKG-INFO', + 'requires.txt', + 'SOURCES.txt', + 'not-zip-safe',))) + + # delete dependency_links if it is only whitespace + dependency_links_path = os.path.join(distinfo_path, 'dependency_links.txt') + with open(dependency_links_path, 'r') as dependency_links_file: + dependency_links = dependency_links_file.read().strip() + if not dependency_links: + adios(dependency_links_path) + + write_pkg_info(os.path.join(distinfo_path, 'METADATA'), pkg_info) + + # XXX deprecated. Still useful for current distribute/setuptools. + metadata_path = os.path.join(distinfo_path, 'METADATA') + self.add_requirements(metadata_path) + + # XXX intentionally a different path than the PEP. + metadata_json_path = os.path.join(distinfo_path, 'metadata.json') + pymeta = pkginfo_to_dict(metadata_path, + distribution=self.distribution) + + if 'description' in pymeta: + description_filename = 'DESCRIPTION.rst' + description_text = pymeta.pop('description') + description_path = os.path.join(distinfo_path, + description_filename) + with open(description_path, "wb") as description_file: + description_file.write(description_text.encode('utf-8')) + pymeta['extensions']['python.details']['document_names']['description'] = description_filename + + # XXX heuristically copy any LICENSE/LICENSE.txt? + license = self.license_file() + if license: + license_filename = 'LICENSE.txt' + shutil.copy(license, os.path.join(self.distinfo_dir, license_filename)) + pymeta['extensions']['python.details']['document_names']['license'] = license_filename + + with open(metadata_json_path, "w") as metadata_json: + json.dump(pymeta, metadata_json, sort_keys=True) + + adios(egginfo_path) + + def write_record(self, bdist_dir, distinfo_dir): + from wheel.util import urlsafe_b64encode + + record_path = os.path.join(distinfo_dir, 'RECORD') + record_relpath = os.path.relpath(record_path, bdist_dir) + + def walk(): + for dir, dirs, files in os.walk(bdist_dir): + dirs.sort() + for f in sorted(files): + yield os.path.join(dir, f) + + def skip(path): + """Wheel hashes every possible file.""" + return (path == record_relpath) + + with open_for_csv(record_path, 'w+') as record_file: + writer = csv.writer(record_file) + for path in walk(): + relpath = os.path.relpath(path, bdist_dir) + if skip(relpath): + hash = '' + size = '' + else: + with open(path, 'rb') as f: + data = f.read() + digest = hashlib.sha256(data).digest() + hash = 'sha256=' + native(urlsafe_b64encode(digest)) + size = len(data) + record_path = os.path.relpath( + path, bdist_dir).replace(os.path.sep, '/') + writer.writerow((record_path, hash, size)) + + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +from distutils import log as logger +import os.path + +#from wheel.bdist_wheel import bdist_wheel +class azure_bdist_wheel(bdist_wheel): + + description = "Create an Azure wheel distribution" + + user_options = bdist_wheel.user_options + \ + [('azure-namespace-package=', None, + "Name of the deepest nspkg used")] + + def initialize_options(self): + bdist_wheel.initialize_options(self) + self.azure_namespace_package = None + + def finalize_options(self): + bdist_wheel.finalize_options(self) + if self.azure_namespace_package and not self.azure_namespace_package.endswith("-nspkg"): + raise ValueError("azure_namespace_package must finish by -nspkg") + + def run(self): + if not self.distribution.install_requires: + self.distribution.install_requires = [] + self.distribution.install_requires.append( + "{}>=2.0.0".format(self.azure_namespace_package)) + bdist_wheel.run(self) + + def write_record(self, bdist_dir, distinfo_dir): + if self.azure_namespace_package: + # Split and remove last part, assuming it's "nspkg" + subparts = self.azure_namespace_package.split('-')[0:-1] + folder_with_init = [os.path.join(*subparts[0:i+1]) for i in range(len(subparts))] + for azure_sub_package in folder_with_init: + init_file = os.path.join(bdist_dir, azure_sub_package, '__init__.py') + if os.path.isfile(init_file): + logger.info("manually remove {} while building the wheel".format(init_file)) + os.remove(init_file) + else: + raise ValueError("Unable to find {}. Are you sure of your namespace package?".format(init_file)) + bdist_wheel.write_record(self, bdist_dir, distinfo_dir) +cmdclass = { + 'bdist_wheel': azure_bdist_wheel, +} diff --git a/azure-mgmt-botservice/setup.cfg b/azure-mgmt-botservice/setup.cfg new file mode 100644 index 000000000000..856f4164982c --- /dev/null +++ b/azure-mgmt-botservice/setup.cfg @@ -0,0 +1,3 @@ +[bdist_wheel] +universal=1 +azure-namespace-package=azure-mgmt-nspkg \ No newline at end of file diff --git a/azure-mgmt-botservice/setup.py b/azure-mgmt-botservice/setup.py new file mode 100644 index 000000000000..628663c84c75 --- /dev/null +++ b/azure-mgmt-botservice/setup.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup +try: + from azure_bdist_wheel import cmdclass +except ImportError: + from distutils import log as logger + logger.warn("Wheel is not available, disabling bdist_wheel hook") + cmdclass = {} + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-botservice" +PACKAGE_PPRINT_NAME = "Bot Service Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.rst', encoding='utf-8') as f: + readme = f.read() +with open('HISTORY.rst', encoding='utf-8') as f: + history = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + history, + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=["tests"]), + install_requires=[ + 'msrestazure>=0.4.20,<2.0.0', + 'azure-common~=1.1', + ], + cmdclass=cmdclass +) diff --git a/azure-mgmt-botservice/tests/__init__.py b/azure-mgmt-botservice/tests/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_email_channel.yaml b/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_email_channel.yaml new file mode 100644 index 000000000000..52fe6b4d20b2 --- /dev/null +++ b/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_email_channel.yaml @@ -0,0 +1,256 @@ +interactions: +- request: + body: '{"location": "global", "sku": {"name": "Free"}, "kind": "Bot", "properties": + {"displayName": "this is a test bot", "description": "this is a description + for a test bot", "endpoint": "https://bing.com/messages/", "msaAppId": "056d9ad9-17a9-4cc7-aebb-43bf6f293a08", + "developerAppInsightKey": "59513bad-10a7-4d41-b4d0-b1c34c6af511", "developerAppInsightsApiKey": + "w24iw5ocbhcig71su7ibaj63hey5ieaozeuwdv11", "developerAppInsightsApplicationId": + "cf03484e-3fdb-4b5e-9ad7-94bde32e5a11"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['481'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbote60013a2/providers/Microsoft.BotService/botServices/azurebotservicee60013a2?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbote60013a2/providers/Microsoft.BotService/botServices/azurebotservicee60013a2","name":"azurebotservicee60013a2","type":"Microsoft.BotService/botServices","etag":"W/\"datetime''2018-04-02T18%3A36%3A34.9983667Z''\"","location":"global","sku":{"name":""},"kind":"Bot","properties":{"displayName":"this + is a test bot","description":"this is a description for a test bot","iconUrl":"//intercom-scratch.azureedge.net/bot-icons-v1/bot-framework-default.png","endpoint":"https://bing.com/messages/","msaAppId":"056d9ad9-17a9-4cc7-aebb-43bf6f293a08","developerAppInsightKey":"59513bad-10a7-4d41-b4d0-b1c34c6af511","developerAppInsightsApplicationId":"cf03484e-3fdb-4b5e-9ad7-94bde32e5a11","luisAppIds":[],"endpointVersion":"3.0","configuredChannels":["webchat"],"enabledChannels":["webchat","directline"],"isDeveloperAppInsightsApiKeySet":true,"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['950'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 18:36:35 GMT'] + etag: [W/"datetime'2018-04-02T18%3A36%3A34.9983667Z'"] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-powered-by: [ASP.NET] + status: {code: 201, message: Created} +- request: + body: '{"location": "global", "properties": {"channelName": "EmailChannel", "properties": + {"emailAddress": "swagatm2@outlook.com", "password": "Botuser123@", "isEnabled": + true}}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['171'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbote60013a2/providers/Microsoft.BotService/botServices/azurebotservicee60013a2/channels/EmailChannel?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbote60013a2/providers/Microsoft.BotService/botServices/azurebotservicee60013a2/channels/EmailChannel","name":"azurebotservicee60013a2/EmailChannel","type":"Microsoft.BotService/botServices/channels","etag":"W/\"8148c55803b448c0dab50af27c73b1084/2/2018 + 6:36:42 PM\"","location":"global","properties":{"properties":{"emailAddress":"swagatm2@outlook.com","password":"Botuser123@","isEnabled":true},"etag":"W/\"8148c55803b448c0dab50af27c73b1084/2/2018 + 6:36:42 PM\"","channelName":"EmailChannel","location":"global","provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['627'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 18:36:42 GMT'] + etag: ['W/"8148c55803b448c0dab50af27c73b1084/2/2018 6:36:42 PM"'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-powered-by: [ASP.NET] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbote60013a2/providers/Microsoft.BotService/botServices/azurebotservicee60013a2/channels/EmailChannel?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbote60013a2/providers/Microsoft.BotService/botServices/azurebotservicee60013a2/channels/EmailChannel","name":"azurebotservicee60013a2/EmailChannel","type":"Microsoft.BotService/botServices/channels","etag":"W/\"c319754c4cd79482a41125d9543e108b4/2/2018 + 6:36:43 PM\"","location":"global","properties":{"properties":{"emailAddress":"swagatm2@outlook.com","password":"Botuser123@","isEnabled":true},"etag":"W/\"c319754c4cd79482a41125d9543e108b4/2/2018 + 6:36:43 PM\"","channelName":"EmailChannel","location":"global","provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['627'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 18:36:43 GMT'] + etag: ['W/"c319754c4cd79482a41125d9543e108b4/2/2018 6:36:43 PM"'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbote60013a2/providers/Microsoft.BotService/botServices/azurebotservicee60013a2/channels/EmailChannel?api-version=2017-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Mon, 02 Apr 2018 18:36:45 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbote60013a2/providers/Microsoft.BotService/botServices/azurebotservicee60013a2/channels/EmailChannel?api-version=2017-12-01 + response: + body: {string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.BotService/botServices/azurebotservicee60013a2/channels/EmailChannel'' + under resource group ''pythonsdkbote60013a2'' was not found."}}'} + headers: + cache-control: [no-cache] + content-length: ['202'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 18:36:46 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-failure-cause: [gateway] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbote60013a2/providers/Microsoft.BotService/botServices/azurebotservicee60013a2?api-version=2017-12-01 + response: + body: {string: '{"error":{"code":"UnknownError","message":"message: The remote + server returned an error: (412) Precondition Failed. original trace: at + Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync[T](IAsyncResult + result) in c:\\Program Files (x86)\\Jenkins\\workspace\\release_dotnet_master\\Lib\\ClassLibraryCommon\\Core\\Executor\\Executor.cs:line + 50\r\n at Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.<>c__DisplayClass2`1.b__0(IAsyncResult + ar) in c:\\Program Files (x86)\\Jenkins\\workspace\\release_dotnet_master\\Lib\\ClassLibraryCommon\\Core\\Util\\AsyncExtensions.cs:line + 69\r\n--- End of stack trace from previous location where exception was thrown + ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at + System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task + task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()\r\n at + Intercom.Azure.Helpers.CloudTableObjectExtensions.d__13`1.MoveNext() + in E:\\_work\\3\\s\\Utilities\\Intercom.Storage.Helpers\\CloudTableObjectExtensions.cs:line + 323\r\n--- End of stack trace from previous location where exception was thrown + ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at + System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task + task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()\r\n at + Intercom.Azure.Helpers.CloudTableObjectExtensions.d__12`1.MoveNext() + in E:\\_work\\3\\s\\Utilities\\Intercom.Storage.Helpers\\CloudTableObjectExtensions.cs:line + 268\r\n--- End of stack trace from previous location where exception was thrown + ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at + System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task + task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()\r\n at + Intercom.Models.Storage.d__80.MoveNext() in E:\\_work\\3\\s\\Intercom.Models\\Storage\\BotOperators.cs:line + 272\r\n--- End of stack trace from previous location where exception was thrown + ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at + System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task + task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()\r\n at + Intercom.Models.Storage.d__95.MoveNext() in + E:\\_work\\3\\s\\Intercom.Models\\Storage\\BotOperators.cs:line 740\r\n--- + End of stack trace from previous location where exception was thrown ---\r\n at + System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task + task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()\r\n at + DevPortalLib.Helpers.BotHelper.d__16.MoveNext() in E:\\_work\\3\\s\\DevPortalLib\\Helpers\\BotHelper.cs:line + 222\r\n--- End of stack trace from previous location where exception was thrown + ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at + System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task + task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()\r\n at + Intercom.ResourceProvider.DataProviders.ResourceDataProvider.d__3.MoveNext() + in E:\\_work\\3\\s\\Intercom.ResourceProvider\\DataProviders\\ResourceDataProvider.cs:line + 203"}}'} + headers: + cache-control: [no-cache] + connection: [close] + content-length: ['3788'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 18:36:52 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-failure-cause: [service] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-powered-by: [ASP.NET] + status: {code: 500, message: Internal Server Error} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbote60013a2/providers/Microsoft.BotService/botServices/azurebotservicee60013a2?api-version=2017-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Mon, 02 Apr 2018 18:37:00 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +version: 1 diff --git a/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_msteams_channel.yaml b/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_msteams_channel.yaml new file mode 100644 index 000000000000..92c6d3d74efb --- /dev/null +++ b/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_msteams_channel.yaml @@ -0,0 +1,185 @@ +interactions: +- request: + body: '{"location": "global", "sku": {"name": "Free"}, "kind": "Bot", "properties": + {"displayName": "this is a test bot", "description": "this is a description + for a test bot", "endpoint": "https://bing.com/messages/", "msaAppId": "41a220b9-6571-4f0b-bbd2-43f1c1d82f53", + "developerAppInsightKey": "59513bad-10a7-4d41-b4d0-b1c34c6af52a", "developerAppInsightsApiKey": + "w24iw5ocbhcig71su7ibaj63hey5ieaozeuwdv2r", "developerAppInsightsApplicationId": + "cf03484e-3fdb-4b5e-9ad7-94bde32e5a2b"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['481'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13","name":"testpythonbot13","type":"Microsoft.BotService/botServices","etag":"W/\"datetime''2018-04-01T03%3A44%3A25.9372046Z''\"","location":"global","sku":{"name":""},"kind":"Bot","properties":{"displayName":"this + is a test bot","description":"this is a description for a test bot","iconUrl":"//intercom-scratch.azureedge.net/bot-icons-v1/bot-framework-default.png","endpoint":"https://bing.com/messages/","msaAppId":"41a220b9-6571-4f0b-bbd2-43f1c1d82f53","developerAppInsightKey":"59513bad-10a7-4d41-b4d0-b1c34c6af52a","developerAppInsightsApplicationId":"cf03484e-3fdb-4b5e-9ad7-94bde32e5a2b","luisAppIds":[],"endpointVersion":"3.0","configuredChannels":["webchat"],"enabledChannels":["webchat","directline"],"isDeveloperAppInsightsApiKeySet":true,"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['926'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 01 Apr 2018 03:44:26 GMT'] + etag: [W/"datetime'2018-04-01T03%3A44%3A25.9372046Z'"] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 201, message: Created} +- request: + body: '{"location": "global", "properties": {"channelName": "MsTeamsChannel", + "properties": {"enableMessaging": true, "isEnabled": true}}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['131'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13/channels/MsTeamsChannel?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13/channels/MsTeamsChannel","name":"testpythonbot13/MsTeamsChannel","type":"Microsoft.BotService/botServices/channels","etag":"W/\"05f9ab1b3ec654ae06838944f06d7bdc4/1/2018 + 3:45:13 AM\"","location":"global","properties":{"properties":{"enableMessaging":true,"enableMediaCards":false,"enableVideo":false,"enableCalling":false,"callMode":null,"isEnabled":true},"etag":"W/\"05f9ab1b3ec654ae06838944f06d7bdc4/1/2018 + 3:45:13 AM\"","channelName":"MsTeamsChannel","location":"global","provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['652'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 01 Apr 2018 03:45:13 GMT'] + etag: ['W/"05f9ab1b3ec654ae06838944f06d7bdc4/1/2018 3:45:13 AM"'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13/channels/MsTeamsChannel?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13/channels/MsTeamsChannel","name":"testpythonbot13/MsTeamsChannel","type":"Microsoft.BotService/botServices/channels","etag":"W/\"0a4cd16bd516f5a97993fcf633be366b4/1/2018 + 3:45:45 AM\"","location":"global","properties":{"properties":{"enableMessaging":false,"enableMediaCards":false,"enableVideo":false,"enableCalling":false,"callMode":null,"isEnabled":true},"etag":"W/\"0a4cd16bd516f5a97993fcf633be366b4/1/2018 + 3:45:45 AM\"","channelName":"MsTeamsChannel","location":"global","provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['653'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 01 Apr 2018 03:45:45 GMT'] + etag: ['W/"0a4cd16bd516f5a97993fcf633be366b4/1/2018 3:45:45 AM"'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13/channels/MsTeamsChannel?api-version=2017-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Sun, 01 Apr 2018 03:46:36 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13/channels/MsTeamsChannel?api-version=2017-12-01 + response: + body: {string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.BotService/botServices/testpythonbot13/channels/MsTeamsChannel'' + under resource group ''testpythonrg'' was not found."}}'} + headers: + cache-control: [no-cache] + content-length: ['188'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 01 Apr 2018 03:46:37 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-failure-cause: [gateway] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13?api-version=2017-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Sun, 01 Apr 2018 03:47:24 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +version: 1 diff --git a/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_skype_channel.yaml b/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_skype_channel.yaml new file mode 100644 index 000000000000..fd75574952fb --- /dev/null +++ b/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_skype_channel.yaml @@ -0,0 +1,244 @@ +interactions: +- request: + body: '{"location": "global", "sku": {"name": "Free"}, "kind": "Bot", "properties": + {"displayName": "this is a test bot", "description": "this is a description + for a test bot", "endpoint": "https://bing.com/messages/", "msaAppId": "41a220b9-6571-4f0b-bbd2-43f1c1d82f53", + "developerAppInsightKey": "59513bad-10a7-4d41-b4d0-b1c34c6af52a", "developerAppInsightsApiKey": + "w24iw5ocbhcig71su7ibaj63hey5ieaozeuwdv2r", "developerAppInsightsApplicationId": + "cf03484e-3fdb-4b5e-9ad7-94bde32e5a2b"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['481'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13","name":"testpythonbot13","type":"Microsoft.BotService/botServices","etag":"W/\"datetime''2018-04-01T04%3A05%3A31.6306037Z''\"","location":"global","sku":{"name":""},"kind":"Bot","properties":{"displayName":"this + is a test bot","description":"this is a description for a test bot","iconUrl":"//intercom-scratch.azureedge.net/bot-icons-v1/bot-framework-default.png","endpoint":"https://bing.com/messages/","msaAppId":"41a220b9-6571-4f0b-bbd2-43f1c1d82f53","developerAppInsightKey":"59513bad-10a7-4d41-b4d0-b1c34c6af52a","developerAppInsightsApplicationId":"cf03484e-3fdb-4b5e-9ad7-94bde32e5a2b","luisAppIds":[],"endpointVersion":"3.0","configuredChannels":["webchat"],"enabledChannels":["webchat","directline"],"isDeveloperAppInsightsApiKeySet":true,"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['926'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 01 Apr 2018 04:05:31 GMT'] + etag: [W/"datetime'2018-04-01T04%3A05%3A31.6306037Z'"] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 201, message: Created} +- request: + body: '{"location": "global", "properties": {"channelName": "SkypeChannel", "properties": + {"enableMessaging": true, "isEnabled": true}}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['129'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13/channels/SkypeChannel?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13/channels/SkypeChannel","name":"testpythonbot13/SkypeChannel","type":"Microsoft.BotService/botServices/channels","etag":"W/\"e1bfa1407ed0ebd0a745ef8d8872541c4/1/2018 + 4:06:02 AM\"","location":"global","properties":{"properties":{"enableMessaging":true,"enableMediaCards":false,"enableVideo":false,"enableCalling":false,"enableScreenSharing":false,"enableGroups":false,"groupsMode":null,"callingWebHook":null,"isEnabled":true},"etag":"W/\"e1bfa1407ed0ebd0a745ef8d8872541c4/1/2018 + 4:06:02 AM\"","channelName":"SkypeChannel","location":"global","provisioningState":"Accepted"}}'} + headers: + cache-control: [no-cache] + content-length: ['718'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 01 Apr 2018 04:06:02 GMT'] + etag: ['W/"e1bfa1407ed0ebd0a745ef8d8872541c4/1/2018 4:06:02 AM"'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13/channels/SkypeChannel?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13/channels/SkypeChannel","name":"testpythonbot13/SkypeChannel","type":"Microsoft.BotService/botServices/channels","etag":"W/\"a9c9d34a8f5e09c02779a2a247318e994/1/2018 + 4:06:19 AM\"","location":"global","properties":{"properties":{"enableMessaging":true,"enableMediaCards":false,"enableVideo":false,"enableCalling":false,"enableScreenSharing":false,"enableGroups":false,"groupsMode":null,"callingWebHook":"","isEnabled":true},"etag":"W/\"a9c9d34a8f5e09c02779a2a247318e994/1/2018 + 4:06:19 AM\"","channelName":"SkypeChannel","location":"global","provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['717'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 01 Apr 2018 04:06:18 GMT'] + etag: ['W/"a9c9d34a8f5e09c02779a2a247318e994/1/2018 4:06:19 AM"'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13/channels/SkypeChannel?api-version=2017-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Sun, 01 Apr 2018 04:06:23 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13/channels/SkypeChannel?api-version=2017-12-01 + response: + body: {string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.BotService/botServices/testpythonbot13/channels/SkypeChannel'' + under resource group ''testpythonrg'' was not found."}}'} + headers: + cache-control: [no-cache] + content-length: ['186'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 01 Apr 2018 04:06:24 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-failure-cause: [gateway] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13?api-version=2017-12-01 + response: + body: {string: '{"error":{"code":"UnknownError","message":"message: Unable to + connect to the remote server original trace: at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync[T](IAsyncResult + result) in c:\\Program Files (x86)\\Jenkins\\workspace\\release_dotnet_master\\Lib\\ClassLibraryCommon\\Core\\Executor\\Executor.cs:line + 50\r\n at Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.<>c__DisplayClass2`1.b__0(IAsyncResult + ar) in c:\\Program Files (x86)\\Jenkins\\workspace\\release_dotnet_master\\Lib\\ClassLibraryCommon\\Core\\Util\\AsyncExtensions.cs:line + 69\r\n--- End of stack trace from previous location where exception was thrown + ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at + System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task + task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()\r\n at + Intercom.Models.Storage.d__56.MoveNext() in E:\\_work\\3\\s\\Intercom.Models\\Storage\\BotLogOperators.cs:line + 42\r\n--- End of stack trace from previous location where exception was thrown + ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at + System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task + task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()\r\n at + Intercom.Models.Storage.d__59.MoveNext() in E:\\_work\\3\\s\\Intercom.Models\\Storage\\BotLogOperators.cs:line + 67\r\n--- End of stack trace from previous location where exception was thrown + ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at + System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task + task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()\r\n at + DevPortalLib.Helpers.BotHelper.d__16.MoveNext() in E:\\_work\\3\\s\\DevPortalLib\\Helpers\\BotHelper.cs:line + 222\r\n--- End of stack trace from previous location where exception was thrown + ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at + System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task + task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()\r\n at + Intercom.ResourceProvider.DataProviders.ResourceDataProvider.d__3.MoveNext() + in E:\\_work\\3\\s\\Intercom.ResourceProvider\\DataProviders\\ResourceDataProvider.cs:line + 203"}}'} + headers: + cache-control: [no-cache] + connection: [close] + content-length: ['2648'] + content-type: [application/json; charset=utf-8] + date: ['Sun, 01 Apr 2018 04:07:36 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-failure-cause: [service] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-powered-by: [ASP.NET] + status: {code: 500, message: Internal Server Error} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testpythonrg/providers/Microsoft.BotService/botServices/testpythonbot13?api-version=2017-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Sun, 01 Apr 2018 04:08:11 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +version: 1 diff --git a/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_sms_channel.yaml b/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_sms_channel.yaml new file mode 100644 index 000000000000..ccf3e816a2e3 --- /dev/null +++ b/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_sms_channel.yaml @@ -0,0 +1,187 @@ +interactions: +- request: + body: '{"location": "global", "sku": {"name": "Free"}, "kind": "Bot", "properties": + {"displayName": "this is a test bot", "description": "this is a description + for a test bot", "endpoint": "https://bing.com/messages/", "msaAppId": "056d9ad9-17a9-4cc7-aebb-43bf6f293a08", + "developerAppInsightKey": "59513bad-10a7-4d41-b4d0-b1c34c6af511", "developerAppInsightsApiKey": + "w24iw5ocbhcig71su7ibaj63hey5ieaozeuwdv11", "developerAppInsightsApplicationId": + "cf03484e-3fdb-4b5e-9ad7-94bde32e5a11"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['481'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbotc02c12ed/providers/Microsoft.BotService/botServices/azurebotservicec02c12ed?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbotc02c12ed/providers/Microsoft.BotService/botServices/azurebotservicec02c12ed","name":"azurebotservicec02c12ed","type":"Microsoft.BotService/botServices","etag":"W/\"datetime''2018-04-02T18%3A49%3A28.0293013Z''\"","location":"global","sku":{"name":""},"kind":"Bot","properties":{"displayName":"this + is a test bot","description":"this is a description for a test bot","iconUrl":"//intercom-scratch.azureedge.net/bot-icons-v1/bot-framework-default.png","endpoint":"https://bing.com/messages/","msaAppId":"056d9ad9-17a9-4cc7-aebb-43bf6f293a08","developerAppInsightKey":"59513bad-10a7-4d41-b4d0-b1c34c6af511","developerAppInsightsApplicationId":"cf03484e-3fdb-4b5e-9ad7-94bde32e5a11","luisAppIds":[],"endpointVersion":"3.0","configuredChannels":["webchat"],"enabledChannels":["webchat","directline"],"isDeveloperAppInsightsApiKeySet":true,"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['950'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 18:49:28 GMT'] + etag: [W/"datetime'2018-04-02T18%3A49%3A28.0293013Z'"] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1195'] + x-powered-by: [ASP.NET] + status: {code: 201, message: Created} +- request: + body: '{"location": "global", "properties": {"channelName": "SmsChannel", "properties": + {"phone": "+15153258725", "accountSID": "AC421cab6999e0c8c0d1a90c6643db8f05", + "authToken": "507d2f4f9a832fdd042d05c500b3a88f", "isValidated": false, "isEnabled": + true}}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['250'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbotc02c12ed/providers/Microsoft.BotService/botServices/azurebotservicec02c12ed/channels/SmsChannel?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbotc02c12ed/providers/Microsoft.BotService/botServices/azurebotservicec02c12ed/channels/SmsChannel","name":"azurebotservicec02c12ed/SmsChannel","type":"Microsoft.BotService/botServices/channels","etag":"W/\"e2377294dce6f2292077ed4a9d0518214/2/2018 + 6:49:32 PM\"","location":"global","properties":{"properties":{"phone":"+15153258725","accountSID":"AC421cab6999e0c8c0d1a90c6643db8f05","authToken":"507d2f4f9a832fdd042d05c500b3a88f","isValidated":true,"isEnabled":true},"etag":"W/\"e2377294dce6f2292077ed4a9d0518214/2/2018 + 6:49:32 PM\"","channelName":"SmsChannel","location":"global","provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['697'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 18:49:32 GMT'] + etag: ['W/"e2377294dce6f2292077ed4a9d0518214/2/2018 6:49:32 PM"'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1195'] + x-powered-by: [ASP.NET] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbotc02c12ed/providers/Microsoft.BotService/botServices/azurebotservicec02c12ed/channels/SmsChannel?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbotc02c12ed/providers/Microsoft.BotService/botServices/azurebotservicec02c12ed/channels/SmsChannel","name":"azurebotservicec02c12ed/SmsChannel","type":"Microsoft.BotService/botServices/channels","etag":"W/\"c4d7157ef33c98d6ef63afaabc8b220a4/2/2018 + 6:49:33 PM\"","location":"global","properties":{"properties":{"phone":"+15153258725","accountSID":"AC421cab6999e0c8c0d1a90c6643db8f05","authToken":"507d2f4f9a832fdd042d05c500b3a88f","isValidated":true,"isEnabled":true},"etag":"W/\"c4d7157ef33c98d6ef63afaabc8b220a4/2/2018 + 6:49:33 PM\"","channelName":"SmsChannel","location":"global","provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['697'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 18:49:33 GMT'] + etag: ['W/"c4d7157ef33c98d6ef63afaabc8b220a4/2/2018 6:49:33 PM"'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbotc02c12ed/providers/Microsoft.BotService/botServices/azurebotservicec02c12ed/channels/SmsChannel?api-version=2017-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Mon, 02 Apr 2018 18:49:35 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbotc02c12ed/providers/Microsoft.BotService/botServices/azurebotservicec02c12ed/channels/SmsChannel?api-version=2017-12-01 + response: + body: {string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.BotService/botServices/azurebotservicec02c12ed/channels/SmsChannel'' + under resource group ''pythonsdkbotc02c12ed'' was not found."}}'} + headers: + cache-control: [no-cache] + content-length: ['200'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 18:49:36 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-failure-cause: [gateway] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbotc02c12ed/providers/Microsoft.BotService/botServices/azurebotservicec02c12ed?api-version=2017-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Mon, 02 Apr 2018 18:49:42 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +version: 1 diff --git a/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_telegram_channel.yaml b/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_telegram_channel.yaml new file mode 100644 index 000000000000..9c50fa04f545 --- /dev/null +++ b/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_channels.test_telegram_channel.yaml @@ -0,0 +1,186 @@ +interactions: +- request: + body: '{"location": "global", "sku": {"name": "Free"}, "kind": "Bot", "properties": + {"displayName": "this is a test bot", "description": "this is a description + for a test bot", "endpoint": "https://bing.com/messages/", "msaAppId": "056d9ad9-17a9-4cc7-aebb-43bf6f293a08", + "developerAppInsightKey": "59513bad-10a7-4d41-b4d0-b1c34c6af511", "developerAppInsightsApiKey": + "w24iw5ocbhcig71su7ibaj63hey5ieaozeuwdv11", "developerAppInsightsApplicationId": + "cf03484e-3fdb-4b5e-9ad7-94bde32e5a11"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['481'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbot247414eb/providers/Microsoft.BotService/botServices/azurebotservice247414eb?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbot247414eb/providers/Microsoft.BotService/botServices/azurebotservice247414eb","name":"azurebotservice247414eb","type":"Microsoft.BotService/botServices","etag":"W/\"datetime''2018-04-02T18%3A49%3A49.1365318Z''\"","location":"global","sku":{"name":""},"kind":"Bot","properties":{"displayName":"this + is a test bot","description":"this is a description for a test bot","iconUrl":"//intercom-scratch.azureedge.net/bot-icons-v1/bot-framework-default.png","endpoint":"https://bing.com/messages/","msaAppId":"056d9ad9-17a9-4cc7-aebb-43bf6f293a08","developerAppInsightKey":"59513bad-10a7-4d41-b4d0-b1c34c6af511","developerAppInsightsApplicationId":"cf03484e-3fdb-4b5e-9ad7-94bde32e5a11","luisAppIds":[],"endpointVersion":"3.0","configuredChannels":["webchat"],"enabledChannels":["webchat","directline"],"isDeveloperAppInsightsApiKeySet":true,"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['950'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 18:49:48 GMT'] + etag: [W/"datetime'2018-04-02T18%3A49%3A49.1365318Z'"] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-powered-by: [ASP.NET] + status: {code: 201, message: Created} +- request: + body: '{"location": "global", "properties": {"channelName": "TelegramChannel", + "properties": {"accessToken": "520413022:AAF12lBf6s4tSqntaXEZnvrn6XOVrjQ6YN4", + "isEnabled": true}}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['171'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbot247414eb/providers/Microsoft.BotService/botServices/azurebotservice247414eb/channels/TelegramChannel?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbot247414eb/providers/Microsoft.BotService/botServices/azurebotservice247414eb/channels/TelegramChannel","name":"azurebotservice247414eb/TelegramChannel","type":"Microsoft.BotService/botServices/channels","etag":"W/\"2f68e80acd919f46f3fa3489e9ee9d974/2/2018 + 6:50:01 PM\"","location":"global","properties":{"properties":{"accessToken":"520413022:AAF12lBf6s4tSqntaXEZnvrn6XOVrjQ6YN4","isValidated":true,"isEnabled":true},"etag":"W/\"2f68e80acd919f46f3fa3489e9ee9d974/2/2018 + 6:50:01 PM\"","channelName":"TelegramChannel","location":"global","provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['654'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 18:50:00 GMT'] + etag: ['W/"2f68e80acd919f46f3fa3489e9ee9d974/2/2018 6:50:01 PM"'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1197'] + x-powered-by: [ASP.NET] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbot247414eb/providers/Microsoft.BotService/botServices/azurebotservice247414eb/channels/TelegramChannel?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbot247414eb/providers/Microsoft.BotService/botServices/azurebotservice247414eb/channels/TelegramChannel","name":"azurebotservice247414eb/TelegramChannel","type":"Microsoft.BotService/botServices/channels","etag":"W/\"bf7d8f5819a02ef6633eaa8074317d124/2/2018 + 6:50:02 PM\"","location":"global","properties":{"properties":{"accessToken":"520413022:AAF12lBf6s4tSqntaXEZnvrn6XOVrjQ6YN4","isValidated":true,"isEnabled":true},"etag":"W/\"bf7d8f5819a02ef6633eaa8074317d124/2/2018 + 6:50:02 PM\"","channelName":"TelegramChannel","location":"global","provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['654'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 18:50:02 GMT'] + etag: ['W/"bf7d8f5819a02ef6633eaa8074317d124/2/2018 6:50:02 PM"'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbot247414eb/providers/Microsoft.BotService/botServices/azurebotservice247414eb/channels/TelegramChannel?api-version=2017-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Mon, 02 Apr 2018 18:50:04 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1195'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbot247414eb/providers/Microsoft.BotService/botServices/azurebotservice247414eb/channels/TelegramChannel?api-version=2017-12-01 + response: + body: {string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.BotService/botServices/azurebotservice247414eb/channels/TelegramChannel'' + under resource group ''pythonsdkbot247414eb'' was not found."}}'} + headers: + cache-control: [no-cache] + content-length: ['205'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 18:50:05 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-failure-cause: [gateway] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pythonsdkbot247414eb/providers/Microsoft.BotService/botServices/azurebotservice247414eb?api-version=2017-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Mon, 02 Apr 2018 18:50:11 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1198'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +version: 1 diff --git a/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_crud.test_bot_operations.yaml b/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_crud.test_bot_operations.yaml new file mode 100644 index 000000000000..c12e4fac4179 --- /dev/null +++ b/azure-mgmt-botservice/tests/recordings/test_mgmt_botservice_crud.test_bot_operations.yaml @@ -0,0 +1,160 @@ +interactions: +- request: + body: '{"location": "global", "sku": {"name": "F0"}, "kind": "Bot", "properties": + {"displayName": "this is a test bot", "description": "this is a description + for a test bot", "endpoint": "https://bing.com/messages/", "msaAppId": "41a220b9-6571-4f0b-bbd2-43f1c1d82f51", + "developerAppInsightKey": "59513bad-10a7-4d41-b4d0-b1c34c6af52a", "developerAppInsightsApiKey": + "w24iw5ocbhcig71su7ibaj63hey5ieaozeuwdv2r", "developerAppInsightsApplicationId": + "cf03484e-3fdb-4b5e-9ad7-94bde32e5a2b"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['479'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/python_test_botadda12ac/providers/Microsoft.BotService/botServices/azurebotserviceadda12ac?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/python_test_botadda12ac/providers/Microsoft.BotService/botServices/azurebotserviceadda12ac","name":"azurebotserviceadda12ac","type":"Microsoft.BotService/botServices","etag":"W/\"datetime''2018-04-02T21%3A45%3A10.3812781Z''\"","location":"global","sku":{"name":"F0"},"kind":"Bot","properties":{"displayName":"this + is a test bot","description":"this is a description for a test bot","iconUrl":"//intercom-scratch.azureedge.net/bot-icons-v1/bot-framework-default.png","endpoint":"https://bing.com/messages/","msaAppId":"41a220b9-6571-4f0b-bbd2-43f1c1d82f51","developerAppInsightKey":"59513bad-10a7-4d41-b4d0-b1c34c6af52a","developerAppInsightsApplicationId":"cf03484e-3fdb-4b5e-9ad7-94bde32e5a2b","luisAppIds":[],"endpointVersion":"3.0","configuredChannels":["webchat"],"enabledChannels":["webchat","directline"],"isDeveloperAppInsightsApiKeySet":true,"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['955'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 21:45:09 GMT'] + etag: [W/"datetime'2018-04-02T21%3A45%3A10.3812781Z'"] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/python_test_botadda12ac/providers/Microsoft.BotService/botServices/azurebotserviceadda12ac?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/python_test_botadda12ac/providers/Microsoft.BotService/botServices/azurebotserviceadda12ac","name":"azurebotserviceadda12ac","type":"Microsoft.BotService/botServices","etag":"W/\"datetime''2018-04-02T21%3A45%3A10.3812781Z''\"","location":"global","sku":{"name":"F0"},"kind":"Bot","properties":{"displayName":"this + is a test bot","description":"this is a description for a test bot","iconUrl":"//intercom-scratch.azureedge.net/bot-icons-v1/bot-framework-default.png","endpoint":"https://bing.com/messages/","msaAppId":"41a220b9-6571-4f0b-bbd2-43f1c1d82f51","developerAppInsightKey":"59513bad-10a7-4d41-b4d0-b1c34c6af52a","developerAppInsightsApplicationId":"cf03484e-3fdb-4b5e-9ad7-94bde32e5a2b","luisAppIds":[],"endpointVersion":"3.0","configuredChannels":["webchat"],"enabledChannels":["webchat","directline"],"isDeveloperAppInsightsApiKeySet":true,"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['955'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 21:45:11 GMT'] + etag: [W/"datetime'2018-04-02T21%3A45%3A10.3812781Z'"] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: '{"properties": {"displayName": "this is a test bot", "description": "this + is another description", "iconUrl": "//intercom-scratch.azureedge.net/bot-icons-v1/bot-framework-default.png", + "endpoint": "https://bing.com/messages/", "msaAppId": "41a220b9-6571-4f0b-bbd2-43f1c1d82f51", + "developerAppInsightKey": "59513bad-10a7-4d41-b4d0-b1c34c6af52a", "developerAppInsightsApplicationId": + "cf03484e-3fdb-4b5e-9ad7-94bde32e5a2b", "luisAppIds": []}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['440'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/python_test_botadda12ac/providers/Microsoft.BotService/botServices/azurebotserviceadda12ac?api-version=2017-12-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/python_test_botadda12ac/providers/Microsoft.BotService/botServices/azurebotserviceadda12ac","name":"azurebotserviceadda12ac","type":"Microsoft.BotService/botServices","etag":"W/\"datetime''2018-04-02T21%3A45%3A15.0887934Z''\"","location":"global","sku":{"name":"F0"},"kind":"Bot","properties":{"displayName":"this + is a test bot","description":"this is another description","iconUrl":"//intercom-scratch.azureedge.net/bot-icons-v1/bot-framework-default.png","endpoint":"https://bing.com/messages/","msaAppId":"41a220b9-6571-4f0b-bbd2-43f1c1d82f51","developerAppInsightKey":"59513bad-10a7-4d41-b4d0-b1c34c6af52a","developerAppInsightsApplicationId":"cf03484e-3fdb-4b5e-9ad7-94bde32e5a2b","luisAppIds":[],"endpointVersion":"3.0","configuredChannels":["webchat"],"enabledChannels":["webchat","directline"],"isDeveloperAppInsightsApiKeySet":true,"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['946'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 21:45:15 GMT'] + etag: [W/"datetime'2018-04-02T21%3A45%3A15.0887934Z'"] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/python_test_botadda12ac/providers/Microsoft.BotService/botServices/azurebotserviceadda12ac?api-version=2017-12-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Mon, 02 Apr 2018 21:45:20 GMT'] + expires: ['-1'] + pragma: [no-cache] + request-context: ['appId=cid-v1:bb9497da-769a-4aa5-9960-4ba1cbfd7df7'] + server: [Microsoft-IIS/10.0] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.1 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.26 + msrest_azure/0.4.21 azure-mgmt-botservice/0.1.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/python_test_botadda12ac/providers/Microsoft.BotService/botServices/azurebotserviceadda12ac?api-version=2017-12-01 + response: + body: {string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.BotService/botServices/azurebotserviceadda12ac'' + under resource group ''python_test_botadda12ac'' was not found."}}'} + headers: + cache-control: [no-cache] + content-length: ['183'] + content-type: [application/json; charset=utf-8] + date: ['Mon, 02 Apr 2018 21:45:21 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-failure-cause: [gateway] + status: {code: 404, message: Not Found} +version: 1 diff --git a/azure-mgmt-botservice/tests/test_mgmt_botservice_channels.py b/azure-mgmt-botservice/tests/test_mgmt_botservice_channels.py new file mode 100644 index 000000000000..cb5aded2d875 --- /dev/null +++ b/azure-mgmt-botservice/tests/test_mgmt_botservice_channels.py @@ -0,0 +1,177 @@ +from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer +from azure.mgmt.botservice import AzureBotService +from azure.mgmt.botservice.models import ( + Bot, + BotProperties, + BotChannel, + ErrorException, + sku +) + +class BotServiceChannelsTestCase(AzureMgmtTestCase): + def setUp(self): + super(BotServiceChannelsTestCase, self).setUp() + #create a bot here + self.client = self.create_mgmt_client(AzureBotService) + self.resource_name = self.get_resource_name('azurebotservice') + + def createBot(self): + location = 'global' + sku_name = 'Free' + kind= 'Bot' + display_name = "this is a test bot" + description= "this is a description for a test bot" + endpoint = "https://bing.com/messages/" + msa_app_id = "056d9ad9-17a9-4cc7-aebb-43bf6f293a08" + developer_app_insight_key = '59513bad-10a7-4d41-b4d0-b1c34c6af511' + developer_app_insights_api_key = 'w24iw5ocbhcig71su7ibaj63hey5ieaozeuwdv11' + developer_app_insights_application_id = 'cf03484e-3fdb-4b5e-9ad7-94bde32e5a11' + bot = self.client.bots.create( + resource_group_name = self.resource_group_name, + resource_name = self.resource_name, + parameters = Bot( + location= location, + sku = sku.Sku(sku_name), + kind= kind, + properties= BotProperties( + display_name = display_name, + description= description, + endpoint = endpoint, + msa_app_id = msa_app_id, + developer_app_insight_key = developer_app_insight_key, + developer_app_insights_api_key = developer_app_insights_api_key, + developer_app_insights_application_id = developer_app_insights_application_id, + ) + ) + ) + + def tearDown(self): + super(BotServiceChannelsTestCase, self).tearDown() + self.client.bots.delete( + resource_group_name = self.resource_group_name, + resource_name = self.resource_name + ) + + def validateCreateGetAndDeleteChannel(self, channel_name, channel_properties): + self.createBot() + + botChannel = BotChannel( + location = 'global', + properties = channel_properties + ) + + self.client.channels.create( + resource_group_name = self.resource_group_name, + resource_name = self.resource_name, + channel_name = channel_name, + parameters = botChannel + ) + + channel = self.client.channels.get( + resource_group_name = self.resource_group_name, + resource_name = self.resource_name, + channel_name = channel_name + ) + + self.assertIsNotNone(channel) + #is_enabled being true means that the service has managed to get the channel working. + if channel_name == 'DirectLineChannel': + self.assertTrue(channel.properties.properties.sites[0].is_enabled) + else: + self.assertTrue(channel.properties.properties.is_enabled) + + channel = self.client.channels.delete( + resource_group_name = self.resource_group_name, + resource_name = self.resource_name, + channel_name = channel_name + ) + with self.assertRaises(ErrorException): + channel = self.client.channels.get( + resource_group_name = self.resource_group_name, + resource_name = self.resource_name, + channel_name = channel_name + ) + + @ResourceGroupPreparer(name_prefix='pythonsdkbot') + def test_email_channel(self, resource_group): + self.resource_group_name = resource_group.name + from azure.mgmt.botservice.models import EmailChannel,EmailChannelProperties + channel = EmailChannel( + properties = EmailChannelProperties( + email_address = 'swagatm2@outlook.com', + password = 'Botuser123@', + is_enabled = True + ) + ) + + self.validateCreateGetAndDeleteChannel( + channel_name = 'EmailChannel', + channel_properties = channel + ) + + # @ResourceGroupPreparer(name_prefix='pythonsdkbot') + # def test_msteams_channel(self, resource_group): + # from azure.mgmt.botservice.models import MsTeamsChannel,MsTeamsChannelProperties + # self.resource_group_name = resource_group.name + # channel = MsTeamsChannel( + # properties = MsTeamsChannelProperties( + # is_enabled = True, + # enable_messaging = True, + # ) + # ) + + # self.validateCreateGetAndDeleteChannel( + # channel_name = 'MsTeamsChannel', + # channel_properties = channel + # ) + + # @ResourceGroupPreparer(name_prefix='pythonsdkbot') + # def test_skype_channel(self, resource_group): + # from azure.mgmt.botservice.models import SkypeChannel,SkypeChannelProperties + # self.resource_group_name = resource_group.name + # channel = SkypeChannel( + # properties = SkypeChannelProperties( + # is_enabled = True, + # enable_messaging = True, + # ) + # ) + + # self.validateCreateGetAndDeleteChannel( + # channel_name = 'SkypeChannel', + # channel_properties = channel + # ) + + @ResourceGroupPreparer(name_prefix='pythonsdkbot') + def test_telegram_channel(self, resource_group): + from azure.mgmt.botservice.models import TelegramChannel,TelegramChannelProperties + self.resource_group_name = resource_group.name + channel = TelegramChannel( + properties = TelegramChannelProperties( + access_token = '520413022:AAF12lBf6s4tSqntaXEZnvrn6XOVrjQ6YN4', + is_enabled = True, + ) + ) + + self.validateCreateGetAndDeleteChannel( + channel_name = 'TelegramChannel', + channel_properties = channel + ) + + @ResourceGroupPreparer(name_prefix='pythonsdkbot') + def test_sms_channel(self, resource_group): + from azure.mgmt.botservice.models import SmsChannel,SmsChannelProperties + self.resource_group_name = resource_group.name + channel = SmsChannel( + properties = SmsChannelProperties( + phone = '+15153258725', + account_sid = 'AC421cab6999e0c8c0d1a90c6643db8f05', + auth_token = '507d2f4f9a832fdd042d05c500b3a88f', + is_enabled = True, + is_validated = False + ) + ) + + self.validateCreateGetAndDeleteChannel( + channel_name = 'SmsChannel', + channel_properties = channel + ) diff --git a/azure-mgmt-botservice/tests/test_mgmt_botservice_crud.py b/azure-mgmt-botservice/tests/test_mgmt_botservice_crud.py new file mode 100644 index 000000000000..4d5f979012be --- /dev/null +++ b/azure-mgmt-botservice/tests/test_mgmt_botservice_crud.py @@ -0,0 +1,87 @@ +from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer +from azure.mgmt.botservice import AzureBotService +from azure.mgmt.botservice.models import ( + Bot, + BotProperties, + sku, + ErrorException +) + +class CoreBotServiceTestCase(AzureMgmtTestCase): + def setUp(self): + super(CoreBotServiceTestCase, self).setUp() + self.client = self.create_mgmt_client(AzureBotService) + self.resource_name = self.get_resource_name('azurebotservice') + self.location = 'global' + self.sku_name = 'F0' + self.kind= 'Bot' + self.display_name = "this is a test bot" + self.description= "this is a description for a test bot" + self.endpoint = "https://bing.com/messages/" + self.msa_app_id = "41a220b9-6571-4f0b-bbd2-43f1c1d82f51" + self.developer_app_insight_key = '59513bad-10a7-4d41-b4d0-b1c34c6af52a' + self.developer_app_insights_api_key = 'w24iw5ocbhcig71su7ibaj63hey5ieaozeuwdv2r' + self.developer_app_insights_application_id = 'cf03484e-3fdb-4b5e-9ad7-94bde32e5a2b' + + def validate_bot_properties(self, bot): + self.assertEqual(bot.id, '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.BotService/botServices/{2}'.format(self.client.config.subscription_id,self.resource_group_name,self.resource_name)) + self.assertEqual(bot.name, self.resource_name) + self.assertEqual(bot.location, self.location) + self.assertEqual(bot.sku.name, self.sku_name) + self.assertEqual(bot.kind, self.kind) + self.assertEqual(bot.properties.display_name, self.display_name) + self.assertEqual(bot.properties.description, self.description) + self.assertEqual(bot.properties.endpoint, self.endpoint) + self.assertEqual(bot.properties.msa_app_id, self.msa_app_id) + self.assertEqual(bot.properties.developer_app_insight_key, self.developer_app_insight_key) + self.assertEqual(bot.properties.developer_app_insights_api_key, None) #this password should not be returned in the response + self.assertEqual(bot.properties.developer_app_insights_application_id, self.developer_app_insights_application_id) + + @ResourceGroupPreparer(name_prefix='python_test_bot') + def test_bot_operations(self, resource_group): + self.resource_group_name = resource_group.name + bot = self.client.bots.create( + resource_group_name = self.resource_group_name, + resource_name = self.resource_name, + parameters = Bot( + location= self.location, + sku = sku.Sku(self.sku_name), + kind= self.kind, + properties= BotProperties( + display_name = self.display_name, + description= self.description, + endpoint = self.endpoint, + msa_app_id = self.msa_app_id, + developer_app_insight_key = self.developer_app_insight_key, + developer_app_insights_api_key = self.developer_app_insights_api_key, + developer_app_insights_application_id = self.developer_app_insights_application_id, + ) + ) + ) + self.validate_bot_properties(bot) + + bot = self.client.bots.get( + resource_group_name = self.resource_group_name, + resource_name = self.resource_name, + ) + self.validate_bot_properties(bot) + + bot.properties.description = 'this is another description' + self.description = bot.properties.description + bot = self.client.bots.update( + resource_group_name = self.resource_group_name, + resource_name = self.resource_name, + properties = bot.properties + ) + self.validate_bot_properties(bot) + bot = self.client.bots.delete( + resource_group_name = self.resource_group_name, + resource_name = self.resource_name, + ) + + #ensure that the bot was not found with a get + with self.assertRaises(ErrorException): + bot = self.client.bots.get( + resource_group_name = self.resource_group_name, + resource_name = self.resource_name + )