From 75248e3d3ba8b8a36259ccea9023123a4bbaa208 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sun, 11 May 2025 05:30:17 +0000 Subject: [PATCH] CodeGen from PR 34585 in Azure/azure-rest-api-specs Merge bc97f23e5b36baa44ea0dd8d6768028ef1c666e0 into 4e8d16d3793228046ac6171eadda4b8d26ad2b4f --- .../azure-mgmt-botservice/CHANGELOG.md | 4 + .../azure-mgmt-botservice/README.md | 14 +- .../azure-mgmt-botservice/_meta.json | 11 +- .../apiview-properties.json | 179 + .../azure/mgmt/botservice/__init__.py | 16 +- .../mgmt/botservice/_azure_bot_service.py | 142 - .../azure/mgmt/botservice/_client.py | 189 + .../azure/mgmt/botservice/_configuration.py | 40 +- .../azure/mgmt/botservice/_patch.py | 344 +- .../azure/mgmt/botservice/_utils/__init__.py | 6 + .../mgmt/botservice/_utils/model_base.py | 1232 +++++ .../serialization.py} | 731 +-- .../azure/mgmt/botservice/_vendor.py | 27 - .../azure/mgmt/botservice/_version.py | 4 +- .../azure/mgmt/botservice/aio/__init__.py | 16 +- .../mgmt/botservice/aio/_azure_bot_service.py | 142 - .../azure/mgmt/botservice/aio/_client.py | 194 + .../mgmt/botservice/aio/_configuration.py | 40 +- .../azure/mgmt/botservice/aio/_patch.py | 40 +- .../botservice/aio/operations/__init__.py | 52 +- .../operations/_bot_connection_operations.py | 737 --- .../aio/operations/_bots_operations.py | 719 --- .../aio/operations/_channels_operations.py | 645 --- .../aio/operations/_direct_line_operations.py | 216 - .../aio/operations/_email_operations.py | 122 - .../operations/_host_settings_operations.py | 111 - .../_operation_results_operations.py | 180 - .../botservice/aio/operations/_operations.py | 3777 ++++++++++++- .../mgmt/botservice/aio/operations/_patch.py | 9 +- ...private_endpoint_connections_operations.py | 452 -- .../_private_link_resources_operations.py | 122 - .../_qn_amaker_endpoint_keys_operations.py | 171 - .../azure/mgmt/botservice/models/__init__.py | 245 +- ...{_azure_bot_service_enums.py => _enums.py} | 80 +- .../azure/mgmt/botservice/models/_models.py | 4580 ++++++++++++++++ .../mgmt/botservice/models/_models_py3.py | 4613 ---------------- .../azure/mgmt/botservice/models/_patch.py | 9 +- .../mgmt/botservice/operations/__init__.py | 52 +- .../operations/_bot_connection_operations.py | 1042 ---- .../botservice/operations/_bots_operations.py | 958 ---- .../operations/_channels_operations.py | 905 ---- .../operations/_direct_line_operations.py | 267 - .../operations/_email_operations.py | 165 - .../operations/_host_settings_operations.py | 138 - .../_operation_results_operations.py | 207 - .../mgmt/botservice/operations/_operations.py | 4745 ++++++++++++++++- .../mgmt/botservice/operations/_patch.py | 9 +- ...private_endpoint_connections_operations.py | 632 --- .../_private_link_resources_operations.py | 165 - .../_qn_amaker_endpoint_keys_operations.py | 203 - .../check_name_availability.py | 11 +- .../generated_samples/create_bot.py | 12 +- .../create_email_sign_in_url.py | 13 +- .../generated_samples/delete_bot.py | 14 +- .../generated_samples/delete_channel.py | 14 +- .../generated_samples/delete_connection.py | 14 +- .../delete_direct_line_speech_channel.py | 14 +- .../delete_private_endpoint_connection.py | 14 +- .../directline_regenerate_keys.py | 13 +- .../generated_samples/get_alexa_channel.py | 13 +- .../generated_samples/get_bot.py | 11 +- .../generated_samples/get_channel.py | 13 +- .../generated_samples/get_connection.py | 13 +- .../get_direct_line_speech_channel.py | 13 +- .../generated_samples/get_host_settings.py | 13 +- .../generated_samples/get_line_channel.py | 13 +- ...etwork_security_perimeter_configuration.py | 43 + .../generated_samples/get_operations.py | 9 +- .../get_private_endpoint_connection.py | 11 +- .../list_bots_by_resource_group.py | 11 +- .../list_bots_by_subscription.py | 11 +- .../generated_samples/list_channel.py | 13 +- .../list_channels_by_bot_service.py | 13 +- .../list_connections_by_bot_service.py | 13 +- ...twork_security_perimeter_configurations.py | 43 + .../list_private_endpoint_connections.py | 11 +- .../list_private_link_resources.py | 13 +- .../list_qn_amaker_endpoint_keys.py | 13 +- .../list_service_providers.py | 13 +- .../operation_results_get.py | 13 +- .../generated_samples/put_alexa_channel.py | 13 +- .../generated_samples/put_channel.py | 13 +- .../generated_samples/put_connection.py | 13 +- .../put_direct_line_speech_channel.py | 13 +- .../generated_samples/put_email_channel.py | 13 +- .../generated_samples/put_line_channel.py | 13 +- .../put_private_endpoint_connection.py | 11 +- ...etwork_security_perimeter_configuration.py | 43 + .../generated_samples/update_alexa_channel.py | 20 +- .../generated_samples/update_bot.py | 39 +- .../generated_samples/update_channel.py | 20 +- .../generated_samples/update_connection.py | 15 +- .../update_direct_line_speech_channel.py | 24 +- .../generated_samples/update_line_channel.py | 24 +- .../web_chat_regenerate_keys.py | 13 +- .../generated_tests/conftest.py | 35 + ...est_bot_service_bot_channels_operations.py | 143 + ...t_service_bot_channels_operations_async.py | 144 + ...t_connection_operation_group_operations.py | 27 + ...ection_operation_group_operations_async.py | 28 + ...service_bots_operation_group_operations.py | 29 + ...e_bots_operation_group_operations_async.py | 30 + .../test_bot_service_bots_operations.py | 401 ++ .../test_bot_service_bots_operations_async.py | 402 ++ ..._service_connection_settings_operations.py | 152 + ...ce_connection_settings_operations_async.py | 153 + ...ost_settings_operation_group_operations.py | 27 + ...ttings_operation_group_operations_async.py | 28 + ...ity_perimeter_configurations_operations.py | 54 + ...rimeter_configurations_operations_async.py | 57 + ...tion_results_operation_group_operations.py | 29 + ...esults_operation_group_operations_async.py | 32 + .../test_bot_service_operations.py | 27 + .../test_bot_service_operations_async.py | 28 + ...private_endpoint_connections_operations.py | 89 + ...e_endpoint_connections_operations_async.py | 90 + ...ndpoint_keys_operation_group_operations.py | 29 + ...t_keys_operation_group_operations_async.py | 30 + sdk/botservice/azure-mgmt-botservice/setup.py | 85 +- .../disable_test_mgmt_botservice_channels.py | 206 +- ...isable_test_mgmt_botservice_connections.py | 103 +- .../disable_test_mgmt_botservice_crud.py | 87 +- .../tests/test_mgmt_botservice_model.py | 2 +- .../azure-mgmt-botservice/tsp-location.yaml | 4 + 124 files changed, 18342 insertions(+), 14633 deletions(-) create mode 100644 sdk/botservice/azure-mgmt-botservice/apiview-properties.json delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_azure_bot_service.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_client.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_utils/__init__.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_utils/model_base.py rename sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/{_serialization.py => _utils/serialization.py} (77%) delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_vendor.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_azure_bot_service.py create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_client.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bot_connection_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bots_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_channels_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_direct_line_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_email_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_host_settings_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operation_results_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_link_resources_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_qn_amaker_endpoint_keys_operations.py rename sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/{_azure_bot_service_enums.py => _enums.py} (61%) create mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models_py3.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bot_connection_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bots_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_channels_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_direct_line_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_email_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_host_settings_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operation_results_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_link_resources_operations.py delete mode 100644 sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_qn_amaker_endpoint_keys_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_samples/get_network_security_perimeter_configuration.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_samples/list_network_security_perimeter_configurations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_samples/reconcile_network_security_perimeter_configuration.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/conftest.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_channels_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_channels_operations_async.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_connection_operation_group_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_connection_operation_group_operations_async.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operation_group_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operation_group_operations_async.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operations_async.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_connection_settings_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_connection_settings_operations_async.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_host_settings_operation_group_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_host_settings_operation_group_operations_async.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_network_security_perimeter_configurations_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_network_security_perimeter_configurations_operations_async.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operation_results_operation_group_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operation_results_operation_group_operations_async.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operations_async.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_private_endpoint_connections_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_private_endpoint_connections_operations_async.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_qn_amaker_endpoint_keys_operation_group_operations.py create mode 100644 sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_qn_amaker_endpoint_keys_operation_group_operations_async.py create mode 100644 sdk/botservice/azure-mgmt-botservice/tsp-location.yaml diff --git a/sdk/botservice/azure-mgmt-botservice/CHANGELOG.md b/sdk/botservice/azure-mgmt-botservice/CHANGELOG.md index c43df2fcd76d..0bc6cf2d44f6 100644 --- a/sdk/botservice/azure-mgmt-botservice/CHANGELOG.md +++ b/sdk/botservice/azure-mgmt-botservice/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.0.0b1 (2025-05-11) + +change log generation failed!!! + ## 2.0.0 (2023-01-12) ### Features Added diff --git a/sdk/botservice/azure-mgmt-botservice/README.md b/sdk/botservice/azure-mgmt-botservice/README.md index b3c800f46d8f..e59a9f2c5168 100644 --- a/sdk/botservice/azure-mgmt-botservice/README.md +++ b/sdk/botservice/azure-mgmt-botservice/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Bot Service Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. @@ -45,8 +45,9 @@ client = AzureBotService(credential=DefaultAzureCredential(), subscription_id=su ## Examples - -Code samples for this package can be found at [Bot Service](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) +Code samples for this package can be found at: +- [Search Bot Service](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) ## Troubleshooting @@ -58,6 +59,3 @@ Code samples for this package can be found at [Bot Service](https://docs.microso If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. - - - diff --git a/sdk/botservice/azure-mgmt-botservice/_meta.json b/sdk/botservice/azure-mgmt-botservice/_meta.json index 0d85a464e792..4040c5ba70b1 100644 --- a/sdk/botservice/azure-mgmt-botservice/_meta.json +++ b/sdk/botservice/azure-mgmt-botservice/_meta.json @@ -1,11 +1,6 @@ { - "commit": "c0f92082a788895368a738a9200e24971157d7ca", + "commit": "7be0444544b6bdd1aad8f9103f7620602aec7a1c", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", - "use": [ - "@autorest/python@6.2.7", - "@autorest/modelerfour@4.24.3" - ], - "autorest_command": "autorest specification/botservice/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", - "readme": "specification/botservice/resource-manager/readme.md" + "typespec_src": "specification/botservice/BotService.Management", + "@azure-tools/typespec-python": "0.44.2" } \ No newline at end of file diff --git a/sdk/botservice/azure-mgmt-botservice/apiview-properties.json b/sdk/botservice/azure-mgmt-botservice/apiview-properties.json new file mode 100644 index 000000000000..26fe54f16163 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/apiview-properties.json @@ -0,0 +1,179 @@ +{ + "CrossLanguagePackageId": "Microsoft.BotService", + "CrossLanguageDefinitionId": { + "azure.mgmt.botservice.models.Channel": "Microsoft.BotService.Channel", + "azure.mgmt.botservice.models.AcsChatChannel": "Microsoft.BotService.AcsChatChannel", + "azure.mgmt.botservice.models.AlexaChannel": "Microsoft.BotService.AlexaChannel", + "azure.mgmt.botservice.models.AlexaChannelProperties": "Microsoft.BotService.AlexaChannelProperties", + "azure.mgmt.botservice.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.botservice.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.botservice.models.Bot": "Microsoft.BotService.Bot", + "azure.mgmt.botservice.models.BotChannel": "Microsoft.BotService.BotChannel", + "azure.mgmt.botservice.models.BotProperties": "Microsoft.BotService.BotProperties", + "azure.mgmt.botservice.models.ChannelSettings": "Microsoft.BotService.ChannelSettings", + "azure.mgmt.botservice.models.CheckNameAvailabilityRequestBody": "Microsoft.BotService.CheckNameAvailabilityRequestBody", + "azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody": "Microsoft.BotService.CheckNameAvailabilityResponseBody", + "azure.mgmt.botservice.models.ConnectionSetting": "Microsoft.BotService.ConnectionSetting", + "azure.mgmt.botservice.models.ConnectionSettingParameter": "Microsoft.BotService.ConnectionSettingParameter", + "azure.mgmt.botservice.models.ConnectionSettingProperties": "Microsoft.BotService.ConnectionSettingProperties", + "azure.mgmt.botservice.models.CreateEmailSignInUrlResponse": "Microsoft.BotService.CreateEmailSignInUrlResponse", + "azure.mgmt.botservice.models.CreateEmailSignInUrlResponseProperties": "Microsoft.BotService.CreateEmailSignInUrlResponseProperties", + "azure.mgmt.botservice.models.DirectLineChannel": "Microsoft.BotService.DirectLineChannel", + "azure.mgmt.botservice.models.DirectLineChannelProperties": "Microsoft.BotService.DirectLineChannelProperties", + "azure.mgmt.botservice.models.Site": "Microsoft.BotService.Site", + "azure.mgmt.botservice.models.DirectLineSite": "Microsoft.BotService.DirectLineSite", + "azure.mgmt.botservice.models.DirectLineSpeechChannel": "Microsoft.BotService.DirectLineSpeechChannel", + "azure.mgmt.botservice.models.DirectLineSpeechChannelProperties": "Microsoft.BotService.DirectLineSpeechChannelProperties", + "azure.mgmt.botservice.models.EmailChannel": "Microsoft.BotService.EmailChannel", + "azure.mgmt.botservice.models.EmailChannelProperties": "Microsoft.BotService.EmailChannelProperties", + "azure.mgmt.botservice.models.Error": "Microsoft.BotService.Error", + "azure.mgmt.botservice.models.ErrorBody": "Microsoft.BotService.ErrorBody", + "azure.mgmt.botservice.models.FacebookChannel": "Microsoft.BotService.FacebookChannel", + "azure.mgmt.botservice.models.FacebookChannelProperties": "Microsoft.BotService.FacebookChannelProperties", + "azure.mgmt.botservice.models.FacebookPage": "Microsoft.BotService.FacebookPage", + "azure.mgmt.botservice.models.HostSettingsResponse": "Microsoft.BotService.HostSettingsResponse", + "azure.mgmt.botservice.models.KikChannel": "Microsoft.BotService.KikChannel", + "azure.mgmt.botservice.models.KikChannelProperties": "Microsoft.BotService.KikChannelProperties", + "azure.mgmt.botservice.models.LineChannel": "Microsoft.BotService.LineChannel", + "azure.mgmt.botservice.models.LineChannelProperties": "Microsoft.BotService.LineChannelProperties", + "azure.mgmt.botservice.models.LineRegistration": "Microsoft.BotService.LineRegistration", + "azure.mgmt.botservice.models.ListChannelWithKeysResponse": "Microsoft.BotService.ListChannelWithKeysResponse", + "azure.mgmt.botservice.models.M365Extensions": "Microsoft.BotService.M365Extensions", + "azure.mgmt.botservice.models.MsTeamsChannel": "Microsoft.BotService.MsTeamsChannel", + "azure.mgmt.botservice.models.MsTeamsChannelProperties": "Microsoft.BotService.MsTeamsChannelProperties", + "azure.mgmt.botservice.models.NetworkSecurityPerimeter": "Microsoft.BotService.NetworkSecurityPerimeter", + "azure.mgmt.botservice.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration": "Microsoft.BotService.NetworkSecurityPerimeterConfiguration", + "azure.mgmt.botservice.models.NetworkSecurityPerimeterConfigurationProperties": "Microsoft.BotService.NetworkSecurityPerimeterConfigurationProperties", + "azure.mgmt.botservice.models.NspAccessRule": "Microsoft.BotService.NspAccessRule", + "azure.mgmt.botservice.models.NspAccessRuleProperties": "Microsoft.BotService.NspAccessRuleProperties", + "azure.mgmt.botservice.models.NspAccessRulePropertiesSubscriptionsItem": "Microsoft.BotService.NspAccessRulePropertiesSubscriptionsItem", + "azure.mgmt.botservice.models.Omnichannel": "Microsoft.BotService.Omnichannel", + "azure.mgmt.botservice.models.OperationDisplayInfo": "Microsoft.BotService.OperationDisplayInfo", + "azure.mgmt.botservice.models.OperationEntity": "Microsoft.BotService.OperationEntity", + "azure.mgmt.botservice.models.OperationResultsDescription": "Microsoft.BotService.OperationResultsDescription", + "azure.mgmt.botservice.models.OutlookChannel": "Microsoft.BotService.OutlookChannel", + "azure.mgmt.botservice.models.PrivateEndpoint": "Microsoft.BotService.PrivateEndpoint", + "azure.mgmt.botservice.models.PrivateEndpointConnection": "Microsoft.BotService.PrivateEndpointConnection", + "azure.mgmt.botservice.models.PrivateEndpointConnectionProperties": "Microsoft.BotService.PrivateEndpointConnectionProperties", + "azure.mgmt.botservice.models.PrivateLinkResourceBase": "Microsoft.BotService.PrivateLinkResourceBase", + "azure.mgmt.botservice.models.PrivateLinkResource": "Microsoft.BotService.PrivateLinkResource", + "azure.mgmt.botservice.models.PrivateLinkResourceListResult": "Microsoft.BotService.PrivateLinkResourceListResult", + "azure.mgmt.botservice.models.PrivateLinkResourceProperties": "Microsoft.BotService.PrivateLinkResourceProperties", + "azure.mgmt.botservice.models.PrivateLinkServiceConnectionState": "Microsoft.BotService.PrivateLinkServiceConnectionState", + "azure.mgmt.botservice.models.Profile": "Microsoft.BotService.Profile", + "azure.mgmt.botservice.models.ProvisioningIssue": "Microsoft.BotService.ProvisioningIssue", + "azure.mgmt.botservice.models.ProvisioningIssueProperties": "Microsoft.BotService.ProvisioningIssueProperties", + "azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody": "Microsoft.BotService.QnAMakerEndpointKeysRequestBody", + "azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse": "Microsoft.BotService.QnAMakerEndpointKeysResponse", + "azure.mgmt.botservice.models.ResourceAssociation": "Microsoft.BotService.ResourceAssociation", + "azure.mgmt.botservice.models.SearchAssistant": "Microsoft.BotService.SearchAssistant", + "azure.mgmt.botservice.models.ServiceProvider": "Microsoft.BotService.ServiceProvider", + "azure.mgmt.botservice.models.ServiceProviderParameter": "Microsoft.BotService.ServiceProviderParameter", + "azure.mgmt.botservice.models.ServiceProviderParameterMetadata": "Microsoft.BotService.ServiceProviderParameterMetadata", + "azure.mgmt.botservice.models.ServiceProviderParameterMetadataConstraints": "Microsoft.BotService.ServiceProviderParameterMetadataConstraints", + "azure.mgmt.botservice.models.ServiceProviderProperties": "Microsoft.BotService.ServiceProviderProperties", + "azure.mgmt.botservice.models.ServiceProviderResponseList": "Microsoft.BotService.ServiceProviderResponseList", + "azure.mgmt.botservice.models.SiteInfo": "Microsoft.BotService.SiteInfo", + "azure.mgmt.botservice.models.Sku": "Microsoft.BotService.Sku", + "azure.mgmt.botservice.models.SkypeChannel": "Microsoft.BotService.SkypeChannel", + "azure.mgmt.botservice.models.SkypeChannelProperties": "Microsoft.BotService.SkypeChannelProperties", + "azure.mgmt.botservice.models.SlackChannel": "Microsoft.BotService.SlackChannel", + "azure.mgmt.botservice.models.SlackChannelProperties": "Microsoft.BotService.SlackChannelProperties", + "azure.mgmt.botservice.models.SmsChannel": "Microsoft.BotService.SmsChannel", + "azure.mgmt.botservice.models.SmsChannelProperties": "Microsoft.BotService.SmsChannelProperties", + "azure.mgmt.botservice.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.botservice.models.TelegramChannel": "Microsoft.BotService.TelegramChannel", + "azure.mgmt.botservice.models.TelegramChannelProperties": "Microsoft.BotService.TelegramChannelProperties", + "azure.mgmt.botservice.models.TelephonyChannel": "Microsoft.BotService.TelephonyChannel", + "azure.mgmt.botservice.models.TelephonyChannelProperties": "Microsoft.BotService.TelephonyChannelProperties", + "azure.mgmt.botservice.models.TelephonyChannelResourceApiConfiguration": "Microsoft.BotService.TelephonyChannelResourceApiConfiguration", + "azure.mgmt.botservice.models.TelephonyPhoneNumbers": "Microsoft.BotService.TelephonyPhoneNumbers", + "azure.mgmt.botservice.models.WebChatChannel": "Microsoft.BotService.WebChatChannel", + "azure.mgmt.botservice.models.WebChatChannelProperties": "Microsoft.BotService.WebChatChannelProperties", + "azure.mgmt.botservice.models.WebChatSite": "Microsoft.BotService.WebChatSite", + "azure.mgmt.botservice.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.botservice.models.MsaAppType": "Microsoft.BotService.MsaAppType", + "azure.mgmt.botservice.models.PublicNetworkAccess": "Microsoft.BotService.PublicNetworkAccess", + "azure.mgmt.botservice.models.PrivateEndpointServiceConnectionStatus": "Microsoft.BotService.PrivateEndpointServiceConnectionStatus", + "azure.mgmt.botservice.models.PrivateEndpointConnectionProvisioningState": "Microsoft.BotService.PrivateEndpointConnectionProvisioningState", + "azure.mgmt.botservice.models.ProvisioningState": "Microsoft.BotService.ProvisioningState", + "azure.mgmt.botservice.models.Severity": "Microsoft.BotService.Severity", + "azure.mgmt.botservice.models.NspAccessRuleDirection": "Microsoft.BotService.NspAccessRuleDirection", + "azure.mgmt.botservice.models.AccessMode": "Microsoft.BotService.AccessMode", + "azure.mgmt.botservice.models.SkuName": "Microsoft.BotService.SkuName", + "azure.mgmt.botservice.models.SkuTier": "Microsoft.BotService.SkuTier", + "azure.mgmt.botservice.models.Kind": "Microsoft.BotService.Kind", + "azure.mgmt.botservice.models.EmailChannelAuthMethod": "Microsoft.BotService.EmailChannelAuthMethod", + "azure.mgmt.botservice.models.Key": "Microsoft.BotService.Key", + "azure.mgmt.botservice.models.OperationResultStatus": "Microsoft.BotService.OperationResultStatus", + "azure.mgmt.botservice.operations.Operations.list": "Microsoft.BotService.Operations.list", + "azure.mgmt.botservice.aio.operations.Operations.list": "Microsoft.BotService.Operations.list", + "azure.mgmt.botservice.operations.BotsOperations.get": "Microsoft.BotService.Bots.get", + "azure.mgmt.botservice.aio.operations.BotsOperations.get": "Microsoft.BotService.Bots.get", + "azure.mgmt.botservice.operations.BotsOperations.create": "Microsoft.BotService.Bots.create", + "azure.mgmt.botservice.aio.operations.BotsOperations.create": "Microsoft.BotService.Bots.create", + "azure.mgmt.botservice.operations.BotsOperations.update": "Microsoft.BotService.Bots.update", + "azure.mgmt.botservice.aio.operations.BotsOperations.update": "Microsoft.BotService.Bots.update", + "azure.mgmt.botservice.operations.BotsOperations.delete": "Microsoft.BotService.Bots.delete", + "azure.mgmt.botservice.aio.operations.BotsOperations.delete": "Microsoft.BotService.Bots.delete", + "azure.mgmt.botservice.operations.BotsOperations.list_by_resource_group": "Microsoft.BotService.Bots.listByResourceGroup", + "azure.mgmt.botservice.aio.operations.BotsOperations.list_by_resource_group": "Microsoft.BotService.Bots.listByResourceGroup", + "azure.mgmt.botservice.operations.BotsOperations.list": "Microsoft.BotService.Bots.list", + "azure.mgmt.botservice.aio.operations.BotsOperations.list": "Microsoft.BotService.Bots.list", + "azure.mgmt.botservice.operations.BotsOperations.create_sign_in_url": "Microsoft.BotService.Bots.createSignInUrl", + "azure.mgmt.botservice.aio.operations.BotsOperations.create_sign_in_url": "Microsoft.BotService.Bots.createSignInUrl", + "azure.mgmt.botservice.operations.BotsOperations.list_by_bot_resource": "Microsoft.BotService.Bots.listByBotResource", + "azure.mgmt.botservice.aio.operations.BotsOperations.list_by_bot_resource": "Microsoft.BotService.Bots.listByBotResource", + "azure.mgmt.botservice.operations.BotChannelsOperations.get": "Microsoft.BotService.BotChannels.get", + "azure.mgmt.botservice.aio.operations.BotChannelsOperations.get": "Microsoft.BotService.BotChannels.get", + "azure.mgmt.botservice.operations.BotChannelsOperations.create": "Microsoft.BotService.BotChannels.create", + "azure.mgmt.botservice.aio.operations.BotChannelsOperations.create": "Microsoft.BotService.BotChannels.create", + "azure.mgmt.botservice.operations.BotChannelsOperations.update": "Microsoft.BotService.BotChannels.update", + "azure.mgmt.botservice.aio.operations.BotChannelsOperations.update": "Microsoft.BotService.BotChannels.update", + "azure.mgmt.botservice.operations.BotChannelsOperations.delete": "Microsoft.BotService.BotChannels.delete", + "azure.mgmt.botservice.aio.operations.BotChannelsOperations.delete": "Microsoft.BotService.BotChannels.delete", + "azure.mgmt.botservice.operations.BotChannelsOperations.list_by_resource_group": "Microsoft.BotService.BotChannels.listByResourceGroup", + "azure.mgmt.botservice.aio.operations.BotChannelsOperations.list_by_resource_group": "Microsoft.BotService.BotChannels.listByResourceGroup", + "azure.mgmt.botservice.operations.BotChannelsOperations.list_with_keys": "Microsoft.BotService.BotChannels.listWithKeys", + "azure.mgmt.botservice.aio.operations.BotChannelsOperations.list_with_keys": "Microsoft.BotService.BotChannels.listWithKeys", + "azure.mgmt.botservice.operations.BotChannelsOperations.regenerate_keys": "Microsoft.BotService.BotChannels.regenerateKeys", + "azure.mgmt.botservice.aio.operations.BotChannelsOperations.regenerate_keys": "Microsoft.BotService.BotChannels.regenerateKeys", + "azure.mgmt.botservice.operations.ConnectionSettingsOperations.get": "Microsoft.BotService.ConnectionSettings.get", + "azure.mgmt.botservice.aio.operations.ConnectionSettingsOperations.get": "Microsoft.BotService.ConnectionSettings.get", + "azure.mgmt.botservice.operations.ConnectionSettingsOperations.create": "Microsoft.BotService.ConnectionSettings.create", + "azure.mgmt.botservice.aio.operations.ConnectionSettingsOperations.create": "Microsoft.BotService.ConnectionSettings.create", + "azure.mgmt.botservice.operations.ConnectionSettingsOperations.update": "Microsoft.BotService.ConnectionSettings.update", + "azure.mgmt.botservice.aio.operations.ConnectionSettingsOperations.update": "Microsoft.BotService.ConnectionSettings.update", + "azure.mgmt.botservice.operations.ConnectionSettingsOperations.delete": "Microsoft.BotService.ConnectionSettings.delete", + "azure.mgmt.botservice.aio.operations.ConnectionSettingsOperations.delete": "Microsoft.BotService.ConnectionSettings.delete", + "azure.mgmt.botservice.operations.ConnectionSettingsOperations.list_by_bot_service": "Microsoft.BotService.ConnectionSettings.listByBotService", + "azure.mgmt.botservice.aio.operations.ConnectionSettingsOperations.list_by_bot_service": "Microsoft.BotService.ConnectionSettings.listByBotService", + "azure.mgmt.botservice.operations.ConnectionSettingsOperations.list_with_secrets": "Microsoft.BotService.ConnectionSettings.listWithSecrets", + "azure.mgmt.botservice.aio.operations.ConnectionSettingsOperations.list_with_secrets": "Microsoft.BotService.ConnectionSettings.listWithSecrets", + "azure.mgmt.botservice.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.BotService.PrivateEndpointConnections.get", + "azure.mgmt.botservice.aio.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.BotService.PrivateEndpointConnections.get", + "azure.mgmt.botservice.operations.PrivateEndpointConnectionsOperations.create": "Microsoft.BotService.PrivateEndpointConnections.create", + "azure.mgmt.botservice.aio.operations.PrivateEndpointConnectionsOperations.create": "Microsoft.BotService.PrivateEndpointConnections.create", + "azure.mgmt.botservice.operations.PrivateEndpointConnectionsOperations.delete": "Microsoft.BotService.PrivateEndpointConnections.delete", + "azure.mgmt.botservice.aio.operations.PrivateEndpointConnectionsOperations.delete": "Microsoft.BotService.PrivateEndpointConnections.delete", + "azure.mgmt.botservice.operations.PrivateEndpointConnectionsOperations.list": "Microsoft.BotService.PrivateEndpointConnections.list", + "azure.mgmt.botservice.aio.operations.PrivateEndpointConnectionsOperations.list": "Microsoft.BotService.PrivateEndpointConnections.list", + "azure.mgmt.botservice.operations.NetworkSecurityPerimeterConfigurationsOperations.get": "Microsoft.BotService.NetworkSecurityPerimeterConfigurations.get", + "azure.mgmt.botservice.aio.operations.NetworkSecurityPerimeterConfigurationsOperations.get": "Microsoft.BotService.NetworkSecurityPerimeterConfigurations.get", + "azure.mgmt.botservice.operations.NetworkSecurityPerimeterConfigurationsOperations.list": "Microsoft.BotService.NetworkSecurityPerimeterConfigurations.list", + "azure.mgmt.botservice.aio.operations.NetworkSecurityPerimeterConfigurationsOperations.list": "Microsoft.BotService.NetworkSecurityPerimeterConfigurations.list", + "azure.mgmt.botservice.operations.NetworkSecurityPerimeterConfigurationsOperations.begin_reconcile": "Microsoft.BotService.NetworkSecurityPerimeterConfigurations.reconcile", + "azure.mgmt.botservice.aio.operations.NetworkSecurityPerimeterConfigurationsOperations.begin_reconcile": "Microsoft.BotService.NetworkSecurityPerimeterConfigurations.reconcile", + "azure.mgmt.botservice.operations.BotsOperationGroupOperations.get_check_name_availability": "Microsoft.BotService.BotsOperationGroup.getCheckNameAvailability", + "azure.mgmt.botservice.aio.operations.BotsOperationGroupOperations.get_check_name_availability": "Microsoft.BotService.BotsOperationGroup.getCheckNameAvailability", + "azure.mgmt.botservice.operations.BotConnectionOperationGroupOperations.list_service_providers": "Microsoft.BotService.BotConnectionOperationGroup.listServiceProviders", + "azure.mgmt.botservice.aio.operations.BotConnectionOperationGroupOperations.list_service_providers": "Microsoft.BotService.BotConnectionOperationGroup.listServiceProviders", + "azure.mgmt.botservice.operations.QnAMakerEndpointKeysOperationGroupOperations.get": "Microsoft.BotService.QnAMakerEndpointKeysOperationGroup.get", + "azure.mgmt.botservice.aio.operations.QnAMakerEndpointKeysOperationGroupOperations.get": "Microsoft.BotService.QnAMakerEndpointKeysOperationGroup.get", + "azure.mgmt.botservice.operations.HostSettingsOperationGroupOperations.get": "Microsoft.BotService.HostSettingsOperationGroup.get", + "azure.mgmt.botservice.aio.operations.HostSettingsOperationGroupOperations.get": "Microsoft.BotService.HostSettingsOperationGroup.get", + "azure.mgmt.botservice.operations.OperationResultsOperationGroupOperations.begin_get": "Microsoft.BotService.OperationResultsOperationGroup.get", + "azure.mgmt.botservice.aio.operations.OperationResultsOperationGroupOperations.begin_get": "Microsoft.BotService.OperationResultsOperationGroup.get" + } +} \ No newline at end of file diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/__init__.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/__init__.py index a5e028c01afa..08a27d10fa4a 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/__init__.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/__init__.py @@ -2,25 +2,31 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._azure_bot_service import AzureBotService +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import BotServiceClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AzureBotService", + "BotServiceClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_azure_bot_service.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_azure_bot_service.py deleted file mode 100644 index 44db9f168a6a..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_azure_bot_service.py +++ /dev/null @@ -1,142 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models as _models -from ._configuration import AzureBotServiceConfiguration -from ._serialization import Deserializer, Serializer -from .operations import ( - BotConnectionOperations, - BotsOperations, - ChannelsOperations, - DirectLineOperations, - EmailOperations, - HostSettingsOperations, - OperationResultsOperations, - Operations, - PrivateEndpointConnectionsOperations, - PrivateLinkResourcesOperations, - QnAMakerEndpointKeysOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AzureBotService: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Azure Bot Service is a platform for creating smart conversational agents. - - :ivar bots: BotsOperations operations - :vartype bots: azure.mgmt.botservice.operations.BotsOperations - :ivar channels: ChannelsOperations operations - :vartype channels: azure.mgmt.botservice.operations.ChannelsOperations - :ivar direct_line: DirectLineOperations operations - :vartype direct_line: azure.mgmt.botservice.operations.DirectLineOperations - :ivar email: EmailOperations operations - :vartype email: azure.mgmt.botservice.operations.EmailOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.botservice.operations.Operations - :ivar bot_connection: BotConnectionOperations operations - :vartype bot_connection: azure.mgmt.botservice.operations.BotConnectionOperations - :ivar qn_amaker_endpoint_keys: QnAMakerEndpointKeysOperations operations - :vartype qn_amaker_endpoint_keys: - azure.mgmt.botservice.operations.QnAMakerEndpointKeysOperations - :ivar host_settings: HostSettingsOperations operations - :vartype host_settings: azure.mgmt.botservice.operations.HostSettingsOperations - :ivar operation_results: OperationResultsOperations operations - :vartype operation_results: azure.mgmt.botservice.operations.OperationResultsOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.botservice.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.botservice.operations.PrivateLinkResourcesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Azure Subscription ID. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-15". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AzureBotServiceConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.bots = BotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.channels = ChannelsOperations(self._client, self._config, self._serialize, self._deserialize) - self.direct_line = DirectLineOperations(self._client, self._config, self._serialize, self._deserialize) - self.email = EmailOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.bot_connection = BotConnectionOperations(self._client, self._config, self._serialize, self._deserialize) - self.qn_amaker_endpoint_keys = QnAMakerEndpointKeysOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.host_settings = HostSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operation_results = OperationResultsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "AzureBotService": - self._client.__enter__() - return self - - def __exit__(self, *exc_details) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_client.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_client.py new file mode 100644 index 000000000000..6d9dc553129d --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_client.py @@ -0,0 +1,189 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from ._configuration import BotServiceClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import ( + BotChannelsOperations, + BotConnectionOperationGroupOperations, + BotsOperationGroupOperations, + BotsOperations, + ConnectionSettingsOperations, + HostSettingsOperationGroupOperations, + NetworkSecurityPerimeterConfigurationsOperations, + OperationResultsOperationGroupOperations, + Operations, + PrivateEndpointConnectionsOperations, + QnAMakerEndpointKeysOperationGroupOperations, +) + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + + +class BotServiceClient: # pylint: disable=too-many-instance-attributes + """Azure Bot Service is a platform for creating smart conversational agents. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.botservice.operations.Operations + :ivar bots: BotsOperations operations + :vartype bots: azure.mgmt.botservice.operations.BotsOperations + :ivar bot_channels: BotChannelsOperations operations + :vartype bot_channels: azure.mgmt.botservice.operations.BotChannelsOperations + :ivar connection_settings: ConnectionSettingsOperations operations + :vartype connection_settings: azure.mgmt.botservice.operations.ConnectionSettingsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.botservice.operations.PrivateEndpointConnectionsOperations + :ivar network_security_perimeter_configurations: + NetworkSecurityPerimeterConfigurationsOperations operations + :vartype network_security_perimeter_configurations: + azure.mgmt.botservice.operations.NetworkSecurityPerimeterConfigurationsOperations + :ivar bots_operation_group: BotsOperationGroupOperations operations + :vartype bots_operation_group: azure.mgmt.botservice.operations.BotsOperationGroupOperations + :ivar bot_connection_operation_group: BotConnectionOperationGroupOperations operations + :vartype bot_connection_operation_group: + azure.mgmt.botservice.operations.BotConnectionOperationGroupOperations + :ivar qn_amaker_endpoint_keys_operation_group: QnAMakerEndpointKeysOperationGroupOperations + operations + :vartype qn_amaker_endpoint_keys_operation_group: + azure.mgmt.botservice.operations.QnAMakerEndpointKeysOperationGroupOperations + :ivar host_settings_operation_group: HostSettingsOperationGroupOperations operations + :vartype host_settings_operation_group: + azure.mgmt.botservice.operations.HostSettingsOperationGroupOperations + :ivar operation_results_operation_group: OperationResultsOperationGroupOperations operations + :vartype operation_results_operation_group: + azure.mgmt.botservice.operations.OperationResultsOperationGroupOperations + :param credential: Credential used to authenticate requests to the service. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :param base_url: Service host. Default value is None. + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is + "2023-09-15-preview". Note that overriding this default value may result in unsupported + behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + ) -> None: + _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = BotServiceClientConfiguration( + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.bots = BotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bot_channels = BotChannelsOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_settings = ConnectionSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bots_operation_group = BotsOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bot_connection_operation_group = BotConnectionOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.qn_amaker_endpoint_keys_operation_group = QnAMakerEndpointKeysOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.host_settings_operation_group = HostSettingsOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operation_results_operation_group = OperationResultsOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_configuration.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_configuration.py index 540805c9b9db..b5c09cebd49e 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_configuration.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_configuration.py @@ -2,47 +2,47 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class AzureBotServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AzureBotService. +class BotServiceClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for BotServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Azure Subscription ID. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-15". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is + "2023-09-15-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(AzureBotServiceConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", "2022-09-15") + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,9 +51,11 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-botservice/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -62,9 +64,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_patch.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_patch.py index 528ff53dfeb8..8bcb627aa475 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_patch.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_patch.py @@ -1,343 +1,21 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------- -from typing import Optional, List -import importlib -import msrest +"""Customize generated code here. +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List -class WebChatSite(msrest.serialization.Model): - """A site for the Webchat channel. +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar site_id: Site Id. - :vartype site_id: str - :ivar site_name: Required. Site name. - :vartype site_name: str - :ivar key: Primary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key: str - :ivar key2: Secondary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key2: str - :ivar is_enabled: Required. Whether this site is enabled for DirectLine channel. - :vartype is_enabled: bool - :ivar is_webchat_preview_enabled: Required. Whether this site is enabled for preview versions - of Webchat. - :vartype is_webchat_preview_enabled: bool - """ - - _validation = { - "site_id": {"readonly": True}, - "site_name": {"required": True}, - "key": {"readonly": True}, - "key2": {"readonly": True}, - "is_enabled": {"required": True}, - "is_webchat_preview_enabled": {"required": True}, - } - - _attribute_map = { - "site_id": {"key": "siteId", "type": "str"}, - "site_name": {"key": "siteName", "type": "str"}, - "key": {"key": "key", "type": "str"}, - "key2": {"key": "key2", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "is_webchat_preview_enabled": {"key": "isWebchatPreviewEnabled", "type": "bool"}, - } - - def __init__(self, *, site_name: str, is_enabled: bool, is_webchat_preview_enabled: bool, **kwargs): - """ - :keyword site_name: Required. Site name. - :paramtype site_name: str - :keyword is_enabled: Required. Whether this site is enabled for DirectLine channel. - :paramtype is_enabled: bool - :keyword is_webchat_preview_enabled: Required. Whether this site is enabled for preview - versions of Webchat. - :paramtype is_webchat_preview_enabled: bool - """ - super(WebChatSite, self).__init__( - site_name=site_name, is_enabled=is_enabled, is_webchat_preview_enabled=is_webchat_preview_enabled, **kwargs - ) - self.site_id = None - self.site_name = site_name - self.key = None - self.key2 = None - self.is_enabled = is_enabled - self.is_webchat_preview_enabled = is_webchat_preview_enabled - - -class DirectLineSite(msrest.serialization.Model): - """A site for the Direct Line channel. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar site_id: Site Id. - :vartype site_id: str - :ivar site_name: Required. Site name. - :vartype site_name: str - :ivar key: Primary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key: str - :ivar key2: Secondary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key2: str - :ivar is_enabled: Required. Whether this site is enabled for DirectLine channel. - :vartype is_enabled: bool - :ivar is_v1_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :vartype is_v1_enabled: bool - :ivar is_v3_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :vartype is_v3_enabled: bool - :ivar is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :vartype is_secure_site_enabled: bool - :ivar is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :vartype is_block_user_upload_enabled: bool - :ivar trusted_origins: List of Trusted Origin URLs for this site. This field is applicable only - if isSecureSiteEnabled is True. - :vartype trusted_origins: list[str] - """ - - _validation = { - "site_id": {"readonly": True}, - "site_name": {"required": True}, - "key": {"readonly": True}, - "key2": {"readonly": True}, - "is_enabled": {"required": True}, - "is_v1_enabled": {"required": True}, - "is_v3_enabled": {"required": True}, - } - - _attribute_map = { - "site_id": {"key": "siteId", "type": "str"}, - "site_name": {"key": "siteName", "type": "str"}, - "key": {"key": "key", "type": "str"}, - "key2": {"key": "key2", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "is_v1_enabled": {"key": "isV1Enabled", "type": "bool"}, - "is_v3_enabled": {"key": "isV3Enabled", "type": "bool"}, - "is_secure_site_enabled": {"key": "isSecureSiteEnabled", "type": "bool"}, - "is_block_user_upload_enabled": {"key": "isBlockUserUploadEnabled", "type": "bool"}, - "trusted_origins": {"key": "trustedOrigins", "type": "[str]"}, - } - - def __init__( - self, - *, - site_name: str, - is_enabled: bool, - is_v1_enabled: bool, - is_v3_enabled: bool, - is_secure_site_enabled: Optional[bool] = None, - is_block_user_upload_enabled: Optional[bool] = None, - trusted_origins: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword site_name: Required. Site name. - :paramtype site_name: str - :keyword is_enabled: Required. Whether this site is enabled for DirectLine channel. - :paramtype is_enabled: bool - :keyword is_v1_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :paramtype is_v1_enabled: bool - :keyword is_v3_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :paramtype is_v3_enabled: bool - :keyword is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :paramtype is_secure_site_enabled: bool - :keyword is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :paramtype is_block_user_upload_enabled: bool - :keyword trusted_origins: List of Trusted Origin URLs for this site. This field is applicable - only if isSecureSiteEnabled is True. - :paramtype trusted_origins: list[str] - """ - super(DirectLineSite, self).__init__( - site_name=site_name, - is_enabled=is_enabled, - is_v1_enabled=is_v1_enabled, - is_v3_enabled=is_v3_enabled, - is_secure_site_enabled=is_secure_site_enabled, - is_block_user_upload_enabled=is_block_user_upload_enabled, - **kwargs - ) - 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 - self.is_secure_site_enabled = is_secure_site_enabled - self.is_block_user_upload_enabled = is_block_user_upload_enabled - self.trusted_origins = trusted_origins - - -class Site(WebChatSite, DirectLineSite): - """A site for the channel. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. +def patch_sdk(): + """Do not remove from this file. - :ivar is_v1_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :vartype is_v1_enabled: bool - :ivar is_v3_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :vartype is_v3_enabled: bool - :ivar is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :vartype is_secure_site_enabled: bool - :ivar is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :vartype is_block_user_upload_enabled: bool - :ivar trusted_origins: List of Trusted Origin URLs for this site. This field is applicable only - if isSecureSiteEnabled is True. - :vartype trusted_origins: list[str] - :ivar site_id: Site Id. - :vartype site_id: str - :ivar site_name: Required. Site name. - :vartype site_name: str - :ivar key: Primary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key: str - :ivar key2: Secondary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key2: str - :ivar is_enabled: Required. Whether this site is enabled for DirectLine channel. - :vartype is_enabled: bool - :ivar is_webchat_preview_enabled: Required. Whether this site is enabled for preview versions - of Webchat. - :vartype is_webchat_preview_enabled: bool - :ivar is_token_enabled: Whether this site is token enabled for channel. - :vartype is_token_enabled: bool - :ivar e_tag: Entity Tag. - :vartype e_tag: str + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize """ - - _validation = { - "is_v1_enabled": {"required": True}, - "is_v3_enabled": {"required": True}, - "site_id": {"readonly": True}, - "site_name": {"required": True}, - "key": {"readonly": True}, - "key2": {"readonly": True}, - "is_enabled": {"required": True}, - "is_webchat_preview_enabled": {"required": True}, - } - - _attribute_map = { - "is_v1_enabled": {"key": "isV1Enabled", "type": "bool"}, - "is_v3_enabled": {"key": "isV3Enabled", "type": "bool"}, - "is_secure_site_enabled": {"key": "isSecureSiteEnabled", "type": "bool"}, - "is_block_user_upload_enabled": {"key": "isBlockUserUploadEnabled", "type": "bool"}, - "trusted_origins": {"key": "trustedOrigins", "type": "[str]"}, - "site_id": {"key": "siteId", "type": "str"}, - "site_name": {"key": "siteName", "type": "str"}, - "key": {"key": "key", "type": "str"}, - "key2": {"key": "key2", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "is_webchat_preview_enabled": {"key": "isWebchatPreviewEnabled", "type": "bool"}, - "is_token_enabled": {"key": "isTokenEnabled", "type": "bool"}, - "e_tag": {"key": "eTag", "type": "str"}, - } - - def __init__( - self, - *, - is_v1_enabled: bool, - is_v3_enabled: bool, - site_name: str, - is_enabled: bool, - is_webchat_preview_enabled: bool, - is_secure_site_enabled: Optional[bool] = None, - is_block_user_upload_enabled: Optional[bool] = None, - trusted_origins: Optional[List[str]] = None, - is_token_enabled: Optional[bool] = None, - e_tag: Optional[str] = None, - **kwargs - ): - """ - :keyword is_v1_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :paramtype is_v1_enabled: bool - :keyword is_v3_enabled: Required. Whether this site is enabled for Bot Framework V1 protocol. - :paramtype is_v3_enabled: bool - :keyword is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :paramtype is_secure_site_enabled: bool - :keyword is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :paramtype is_block_user_upload_enabled: bool - :keyword trusted_origins: List of Trusted Origin URLs for this site. This field is applicable - only if isSecureSiteEnabled is True. - :paramtype trusted_origins: list[str] - :keyword site_name: Required. Site name. - :paramtype site_name: str - :keyword is_enabled: Required. Whether this site is enabled for DirectLine channel. - :paramtype is_enabled: bool - :keyword is_webchat_preview_enabled: Required. Whether this site is enabled for preview - versions of Webchat. - :paramtype is_webchat_preview_enabled: bool - :keyword is_token_enabled: Whether this site is token enabled for channel. - :paramtype is_token_enabled: bool - :keyword e_tag: Entity Tag. - :paramtype e_tag: str - """ - super(Site, self).__init__( - site_name=site_name, - is_enabled=is_enabled, - is_webchat_preview_enabled=is_webchat_preview_enabled, - is_v1_enabled=is_v1_enabled, - is_v3_enabled=is_v3_enabled, - is_secure_site_enabled=is_secure_site_enabled, - is_block_user_upload_enabled=is_block_user_upload_enabled, - trusted_origins=trusted_origins, - **kwargs - ) - self.is_v1_enabled = is_v1_enabled - self.is_v3_enabled = is_v3_enabled - self.is_secure_site_enabled = is_secure_site_enabled - self.is_block_user_upload_enabled = is_block_user_upload_enabled - self.trusted_origins = trusted_origins - self.is_token_enabled = is_token_enabled - self.e_tag = e_tag - self.site_id = None - self.site_name = site_name - self.key = None - self.key2 = None - self.is_enabled = is_enabled - self.is_webchat_preview_enabled = is_webchat_preview_enabled - self.is_token_enabled = is_token_enabled - self.e_tag = e_tag - - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - curr_package = importlib.import_module("azure.mgmt.botservice") - curr_package.models.WebChatSite = WebChatSite - curr_package.models.DirectLineSite = DirectLineSite - curr_package.models.Site = Site diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_utils/__init__.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_utils/__init__.py new file mode 100644 index 000000000000..8026245c2abc --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_utils/model_base.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_utils/model_base.py new file mode 100644 index 000000000000..49d5c7259389 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_utils/model_base.py @@ -0,0 +1,1232 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: typing.Dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> typing.Tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field( + attr_to_rest_field: typing.Dict[str, "_RestField"], rest_name: str +) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: typing.Set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: typing.Dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: typing.Dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: typing.List[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + if annotation._name == "Dict": # pyright: ignore + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, value, module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + value: typing.Any, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, value) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + return getattr(self._type, "args", [None])[0] + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + item = obj.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + return _deserialize(self._type, _serialize(item, self._format), rf=self) + + def __set__(self, obj: Model, value) -> None: + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[typing.Dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, typing.List[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[typing.Dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element(tag, prefix=None, ns=None): + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: typing.Dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: typing.List[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_serialization.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_utils/serialization.py similarity index 77% rename from sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_serialization.py rename to sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_utils/serialization.py index 2c170e28dbca..eb86ea23c965 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_serialization.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_utils/serialization.py @@ -1,30 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -38,7 +20,19 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, + List, +) try: from urllib import quote # type: ignore @@ -47,13 +41,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self -from typing import Dict, Any, cast - -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -74,6 +70,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -95,7 +93,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -107,7 +105,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -126,7 +124,9 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -136,6 +136,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -153,13 +158,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -167,80 +165,31 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" - - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[Dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -287,25 +243,35 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): - """Compare objects by comparing all attributes.""" + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): - """Compare objects by comparing all attributes.""" + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -314,7 +280,11 @@ def is_xml_model(cls): @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -322,8 +292,8 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): - """Return the JSON that would be sent to azure from this model. + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -334,10 +304,17 @@ def serialize(self, keep_readonly=False, **kwargs): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -363,12 +340,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -378,25 +358,31 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -404,13 +390,15 @@ def from_dict(cls, data, key_extractors=None, content_type=None): and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -418,7 +406,7 @@ def from_dict(cls, data, key_extractors=None, content_type=None): if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -426,21 +414,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -479,11 +471,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -518,7 +512,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,17 +528,20 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -570,12 +567,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -602,7 +601,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -611,7 +610,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -622,12 +622,11 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -636,28 +635,29 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) - else: - return serialized + raise SerializationError(msg) from err + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -681,20 +681,22 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -703,30 +705,30 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -736,19 +738,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -757,30 +760,31 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") try: + if data is CoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -795,12 +799,11 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) - else: - return self._serialize(data, **kwargs) + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -816,23 +819,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -846,8 +852,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -857,13 +862,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -875,9 +880,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -913,16 +923,17 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -937,7 +948,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -945,6 +956,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -955,7 +967,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -969,7 +981,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1000,56 +1012,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1057,11 +1074,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1071,30 +1089,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1107,12 +1127,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1132,19 +1153,20 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1152,16 +1174,17 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1170,14 +1193,15 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1191,7 +1215,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1199,17 +1222,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1242,11 +1277,11 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1266,7 +1301,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1298,22 +1333,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1321,7 +1355,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1330,9 +1364,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1386,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1368,27 +1402,29 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1405,15 +1441,15 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1442,10 +1478,9 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1471,22 +1506,24 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,12 +1533,14 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1519,10 +1558,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1539,31 +1580,42 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1572,15 +1624,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1594,7 +1647,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1613,15 +1670,15 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) - else: - return self._deserialize(obj_type, data) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1638,6 +1695,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1648,20 +1706,21 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1687,11 +1746,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1699,8 +1757,9 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1710,24 +1769,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1735,6 +1793,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1748,8 +1807,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1761,6 +1819,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1769,12 +1828,11 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1790,8 +1848,9 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1802,8 +1861,9 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1817,24 +1877,26 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1845,8 +1907,9 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1854,32 +1917,33 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) - else: - return duration + raise DeserializationError(msg) from err + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1892,31 +1956,32 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1943,9 +2008,8 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj @staticmethod def deserialize_unix(attr): @@ -1953,15 +2017,16 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_vendor.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_vendor.py deleted file mode 100644 index 9aad73fc743e..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_version.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_version.py index 48944bf3938a..1c3e62080bab 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_version.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/_version.py @@ -2,8 +2,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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "0.0.0b1" diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/__init__.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/__init__.py index 0073804a3bde..85f2ad1cc9e9 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/__init__.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/__init__.py @@ -2,22 +2,28 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._azure_bot_service import AzureBotService +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import BotServiceClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AzureBotService", + "BotServiceClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_azure_bot_service.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_azure_bot_service.py deleted file mode 100644 index 6e270fe50648..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_azure_bot_service.py +++ /dev/null @@ -1,142 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import AzureBotServiceConfiguration -from .operations import ( - BotConnectionOperations, - BotsOperations, - ChannelsOperations, - DirectLineOperations, - EmailOperations, - HostSettingsOperations, - OperationResultsOperations, - Operations, - PrivateEndpointConnectionsOperations, - PrivateLinkResourcesOperations, - QnAMakerEndpointKeysOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AzureBotService: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Azure Bot Service is a platform for creating smart conversational agents. - - :ivar bots: BotsOperations operations - :vartype bots: azure.mgmt.botservice.aio.operations.BotsOperations - :ivar channels: ChannelsOperations operations - :vartype channels: azure.mgmt.botservice.aio.operations.ChannelsOperations - :ivar direct_line: DirectLineOperations operations - :vartype direct_line: azure.mgmt.botservice.aio.operations.DirectLineOperations - :ivar email: EmailOperations operations - :vartype email: azure.mgmt.botservice.aio.operations.EmailOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.botservice.aio.operations.Operations - :ivar bot_connection: BotConnectionOperations operations - :vartype bot_connection: azure.mgmt.botservice.aio.operations.BotConnectionOperations - :ivar qn_amaker_endpoint_keys: QnAMakerEndpointKeysOperations operations - :vartype qn_amaker_endpoint_keys: - azure.mgmt.botservice.aio.operations.QnAMakerEndpointKeysOperations - :ivar host_settings: HostSettingsOperations operations - :vartype host_settings: azure.mgmt.botservice.aio.operations.HostSettingsOperations - :ivar operation_results: OperationResultsOperations operations - :vartype operation_results: azure.mgmt.botservice.aio.operations.OperationResultsOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.botservice.aio.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.botservice.aio.operations.PrivateLinkResourcesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Azure Subscription ID. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-15". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AzureBotServiceConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.bots = BotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.channels = ChannelsOperations(self._client, self._config, self._serialize, self._deserialize) - self.direct_line = DirectLineOperations(self._client, self._config, self._serialize, self._deserialize) - self.email = EmailOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.bot_connection = BotConnectionOperations(self._client, self._config, self._serialize, self._deserialize) - self.qn_amaker_endpoint_keys = QnAMakerEndpointKeysOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.host_settings = HostSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operation_results = OperationResultsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "AzureBotService": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_client.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_client.py new file mode 100644 index 000000000000..d3a4dae2d1f0 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_client.py @@ -0,0 +1,194 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .._utils.serialization import Deserializer, Serializer +from ._configuration import BotServiceClientConfiguration +from .operations import ( + BotChannelsOperations, + BotConnectionOperationGroupOperations, + BotsOperationGroupOperations, + BotsOperations, + ConnectionSettingsOperations, + HostSettingsOperationGroupOperations, + NetworkSecurityPerimeterConfigurationsOperations, + OperationResultsOperationGroupOperations, + Operations, + PrivateEndpointConnectionsOperations, + QnAMakerEndpointKeysOperationGroupOperations, +) + +if TYPE_CHECKING: + from azure.core.credentials_async import AsyncTokenCredential + + +class BotServiceClient: # pylint: disable=too-many-instance-attributes + """Azure Bot Service is a platform for creating smart conversational agents. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.botservice.aio.operations.Operations + :ivar bots: BotsOperations operations + :vartype bots: azure.mgmt.botservice.aio.operations.BotsOperations + :ivar bot_channels: BotChannelsOperations operations + :vartype bot_channels: azure.mgmt.botservice.aio.operations.BotChannelsOperations + :ivar connection_settings: ConnectionSettingsOperations operations + :vartype connection_settings: azure.mgmt.botservice.aio.operations.ConnectionSettingsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.botservice.aio.operations.PrivateEndpointConnectionsOperations + :ivar network_security_perimeter_configurations: + NetworkSecurityPerimeterConfigurationsOperations operations + :vartype network_security_perimeter_configurations: + azure.mgmt.botservice.aio.operations.NetworkSecurityPerimeterConfigurationsOperations + :ivar bots_operation_group: BotsOperationGroupOperations operations + :vartype bots_operation_group: + azure.mgmt.botservice.aio.operations.BotsOperationGroupOperations + :ivar bot_connection_operation_group: BotConnectionOperationGroupOperations operations + :vartype bot_connection_operation_group: + azure.mgmt.botservice.aio.operations.BotConnectionOperationGroupOperations + :ivar qn_amaker_endpoint_keys_operation_group: QnAMakerEndpointKeysOperationGroupOperations + operations + :vartype qn_amaker_endpoint_keys_operation_group: + azure.mgmt.botservice.aio.operations.QnAMakerEndpointKeysOperationGroupOperations + :ivar host_settings_operation_group: HostSettingsOperationGroupOperations operations + :vartype host_settings_operation_group: + azure.mgmt.botservice.aio.operations.HostSettingsOperationGroupOperations + :ivar operation_results_operation_group: OperationResultsOperationGroupOperations operations + :vartype operation_results_operation_group: + azure.mgmt.botservice.aio.operations.OperationResultsOperationGroupOperations + :param credential: Credential used to authenticate requests to the service. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :param base_url: Service host. Default value is None. + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is + "2023-09-15-preview". Note that overriding this default value may result in unsupported + behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + ) -> None: + _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = BotServiceClientConfiguration( + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, _endpoint), policies=_policies, **kwargs + ) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.bots = BotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bot_channels = BotChannelsOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_settings = ConnectionSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bots_operation_group = BotsOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bot_connection_operation_group = BotConnectionOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.qn_amaker_endpoint_keys_operation_group = QnAMakerEndpointKeysOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.host_settings_operation_group = HostSettingsOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operation_results_operation_group = OperationResultsOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_configuration.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_configuration.py index 4c071fe5af6f..47fab6ecc8c8 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_configuration.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_configuration.py @@ -2,47 +2,47 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class AzureBotServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AzureBotService. +class BotServiceClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for BotServiceClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Azure Subscription ID. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-15". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is + "2023-09-15-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(AzureBotServiceConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", "2022-09-15") + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2023-09-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,9 +51,11 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-botservice/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -62,9 +64,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_patch.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_patch.py index f99e77fef986..8bcb627aa475 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_patch.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/_patch.py @@ -1,31 +1,21 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/__init__.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/__init__.py index 67f6c5b0276c..8a0bcb442acb 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/__init__.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/__init__.py @@ -2,38 +2,44 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._bots_operations import BotsOperations -from ._channels_operations import ChannelsOperations -from ._direct_line_operations import DirectLineOperations -from ._email_operations import EmailOperations -from ._operations import Operations -from ._bot_connection_operations import BotConnectionOperations -from ._qn_amaker_endpoint_keys_operations import QnAMakerEndpointKeysOperations -from ._host_settings_operations import HostSettingsOperations -from ._operation_results_operations import OperationResultsOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import BotsOperations # type: ignore +from ._operations import BotChannelsOperations # type: ignore +from ._operations import ConnectionSettingsOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._operations import BotsOperationGroupOperations # type: ignore +from ._operations import BotConnectionOperationGroupOperations # type: ignore +from ._operations import QnAMakerEndpointKeysOperationGroupOperations # type: ignore +from ._operations import HostSettingsOperationGroupOperations # type: ignore +from ._operations import OperationResultsOperationGroupOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "BotsOperations", - "ChannelsOperations", - "DirectLineOperations", - "EmailOperations", "Operations", - "BotConnectionOperations", - "QnAMakerEndpointKeysOperations", - "HostSettingsOperations", - "OperationResultsOperations", + "BotsOperations", + "BotChannelsOperations", + "ConnectionSettingsOperations", "PrivateEndpointConnectionsOperations", - "PrivateLinkResourcesOperations", + "NetworkSecurityPerimeterConfigurationsOperations", + "BotsOperationGroupOperations", + "BotConnectionOperationGroupOperations", + "QnAMakerEndpointKeysOperationGroupOperations", + "HostSettingsOperationGroupOperations", + "OperationResultsOperationGroupOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bot_connection_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bot_connection_operations.py deleted file mode 100644 index af7e836b0bf2..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bot_connection_operations.py +++ /dev/null @@ -1,737 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._bot_connection_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_bot_service_request, - build_list_service_providers_request, - build_list_with_secrets_request, - build_update_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BotConnectionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.aio.AzureBotService`'s - :attr:`bot_connection` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list_service_providers(self, **kwargs: Any) -> _models.ServiceProviderResponseList: - """Lists the available Service Providers for creating Connection Settings. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ServiceProviderResponseList or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ServiceProviderResponseList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ServiceProviderResponseList] = kwargs.pop("cls", None) - - request = build_list_service_providers_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_service_providers.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServiceProviderResponseList", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_service_providers.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders" - } - - @distributed_trace_async - async def list_with_secrets( - self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any - ) -> _models.ConnectionSetting: - """Get a Connection Setting registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) - - request = build_list_with_secrets_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_with_secrets.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConnectionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_with_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets" - } - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - connection_name: str, - parameters: _models.ConnectionSetting, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionSetting: - """Register a new Auth Connection for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :param parameters: The parameters to provide for creating the Connection Setting. Required. - :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - connection_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionSetting: - """Register a new Auth Connection for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :param parameters: The parameters to provide for creating the Connection Setting. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - resource_name: str, - connection_name: str, - parameters: Union[_models.ConnectionSetting, IO], - **kwargs: Any - ) -> _models.ConnectionSetting: - """Register a new Auth Connection for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :param parameters: The parameters to provide for creating the Connection Setting. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ConnectionSetting") - - request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ConnectionSetting", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ConnectionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - connection_name: str, - parameters: _models.ConnectionSetting, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionSetting: - """Updates a Connection Setting registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :param parameters: The parameters to provide for updating the Connection Setting. Required. - :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - connection_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionSetting: - """Updates a Connection Setting registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :param parameters: The parameters to provide for updating the Connection Setting. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - connection_name: str, - parameters: Union[_models.ConnectionSetting, IO], - **kwargs: Any - ) -> _models.ConnectionSetting: - """Updates a Connection Setting registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :param parameters: The parameters to provide for updating the Connection Setting. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ConnectionSetting") - - request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ConnectionSetting", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ConnectionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any - ) -> _models.ConnectionSetting: - """Get a Connection Setting registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConnectionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any - ) -> None: - """Deletes a Connection Setting registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } - - @distributed_trace - def list_by_bot_service( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ConnectionSetting"]: - """Returns all the Connection Settings registered to a particular BotService resource. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConnectionSetting or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.ConnectionSetting] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ConnectionSettingResponseList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_bot_service_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_bot_service.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ConnectionSettingResponseList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_bot_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bots_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bots_operations.py deleted file mode 100644 index d70d0bbdd4dd..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_bots_operations.py +++ /dev/null @@ -1,719 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._bots_operations import ( - build_create_request, - build_delete_request, - build_get_check_name_availability_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BotsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.aio.AzureBotService`'s - :attr:`bots` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.Bot, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Bot: - """Creates a Bot Service. Bot Service is a resource group wide resource type. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param parameters: The parameters to provide for the created bot. Required. - :type parameters: ~azure.mgmt.botservice.models.Bot - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Bot or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.Bot - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Bot: - """Creates a Bot Service. Bot Service is a resource group wide resource type. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param parameters: The parameters to provide for the created bot. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Bot or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.Bot - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, resource_group_name: str, resource_name: str, parameters: Union[_models.Bot, IO], **kwargs: Any - ) -> _models.Bot: - """Creates a Bot Service. Bot Service is a resource group wide resource type. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param parameters: The parameters to provide for the created bot. Is either a model type or a - IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.Bot or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Bot or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.Bot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Bot] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Bot") - - request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Bot", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Bot", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional[_models.Sku] = None, - kind: Optional[Union[str, _models.Kind]] = None, - etag: Optional[str] = None, - properties: Optional[_models.BotProperties] = None, - **kwargs: Any - ) -> _models.Bot: - """Updates a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param location: Specifies the location of the resource. Default value is None. - :type location: str - :param tags: Contains resource tags defined as key/value pairs. Default value is None. - :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. Default value is None. - :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". Default value is None. - :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. Default value is None. - :type etag: str - :param properties: The set of properties specific to bot resource. Default value is None. - :type properties: ~azure.mgmt.botservice.models.BotProperties - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Bot or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.Bot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) - cls: ClsType[_models.Bot] = kwargs.pop("cls", None) - - _parameters = _models.Bot(etag=etag, kind=kind, location=location, properties=properties, sku=sku, tags=tags) - _json = self._serialize.body(_parameters, "Bot") - - request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Bot", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Bot", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Deletes a Bot Service from the resource group. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } - - @distributed_trace_async - async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Bot: - """Returns a BotService specified by the parameters. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Bot or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.Bot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Bot] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Bot", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Bot"]: - """Returns all the resources of a particular type belonging to a resource group. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Bot or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.Bot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.BotResponseList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BotResponseList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices" - } - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Bot"]: - """Returns all the resources of a particular type belonging to a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Bot or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.Bot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.BotResponseList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BotResponseList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices"} - - @overload - async def get_check_name_availability( - self, - parameters: _models.CheckNameAvailabilityRequestBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CheckNameAvailabilityResponseBody: - """Check whether a bot name is available. - - :param parameters: The request body parameters to provide for the check name availability - request. Required. - :type parameters: ~azure.mgmt.botservice.models.CheckNameAvailabilityRequestBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponseBody or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def get_check_name_availability( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CheckNameAvailabilityResponseBody: - """Check whether a bot name is available. - - :param parameters: The request body parameters to provide for the check name availability - request. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponseBody or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def get_check_name_availability( - self, parameters: Union[_models.CheckNameAvailabilityRequestBody, IO], **kwargs: Any - ) -> _models.CheckNameAvailabilityResponseBody: - """Check whether a bot name is available. - - :param parameters: The request body parameters to provide for the check name availability - request. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.CheckNameAvailabilityRequestBody or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponseBody or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckNameAvailabilityResponseBody] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CheckNameAvailabilityRequestBody") - - request = build_get_check_name_availability_request( - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.get_check_name_availability.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckNameAvailabilityResponseBody", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_check_name_availability.metadata = {"url": "/providers/Microsoft.BotService/checkNameAvailability"} diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_channels_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_channels_operations.py deleted file mode 100644 index 211cb9cf12e2..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_channels_operations.py +++ /dev/null @@ -1,645 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._channels_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_with_keys_request, - build_update_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ChannelsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.aio.AzureBotService`'s - :attr:`channels` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.ChannelName], - parameters: _models.BotChannel, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.BotChannel: - """Creates a Channel registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource. Known values are: "AlexaChannel", - "FacebookChannel", "EmailChannel", "KikChannel", "TelegramChannel", "SlackChannel", - "MsTeamsChannel", "SkypeChannel", "WebChatChannel", "DirectLineChannel", "SmsChannel", - "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", - "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :param parameters: The parameters to provide for the created bot. Required. - :type parameters: ~azure.mgmt.botservice.models.BotChannel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.ChannelName], - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.BotChannel: - """Creates a Channel registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource. Known values are: "AlexaChannel", - "FacebookChannel", "EmailChannel", "KikChannel", "TelegramChannel", "SlackChannel", - "MsTeamsChannel", "SkypeChannel", "WebChatChannel", "DirectLineChannel", "SmsChannel", - "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", - "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :param parameters: The parameters to provide for the created bot. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.ChannelName], - parameters: Union[_models.BotChannel, IO], - **kwargs: Any - ) -> _models.BotChannel: - """Creates a Channel registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource. Known values are: "AlexaChannel", - "FacebookChannel", "EmailChannel", "KikChannel", "TelegramChannel", "SlackChannel", - "MsTeamsChannel", "SkypeChannel", "WebChatChannel", "DirectLineChannel", "SmsChannel", - "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", - "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :param parameters: The parameters to provide for the created bot. Is either a model type or a - IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.BotChannel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "BotChannel") - - request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - channel_name=channel_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BotChannel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BotChannel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.ChannelName], - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional[_models.Sku] = None, - kind: Optional[Union[str, _models.Kind]] = None, - etag: Optional[str] = None, - properties: Optional[_models.Channel] = None, - **kwargs: Any - ) -> _models.BotChannel: - """Updates a Channel registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource. Known values are: "AlexaChannel", - "FacebookChannel", "EmailChannel", "KikChannel", "TelegramChannel", "SlackChannel", - "MsTeamsChannel", "SkypeChannel", "WebChatChannel", "DirectLineChannel", "SmsChannel", - "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", - "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :param location: Specifies the location of the resource. Default value is None. - :type location: str - :param tags: Contains resource tags defined as key/value pairs. Default value is None. - :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. Default value is None. - :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". Default value is None. - :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. Default value is None. - :type etag: str - :param properties: The set of properties specific to bot channel resource. Default value is - None. - :type properties: ~azure.mgmt.botservice.models.Channel - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) - cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) - - _parameters = _models.BotChannel( - etag=etag, kind=kind, location=location, properties=properties, sku=sku, tags=tags - ) - _json = self._serialize.body(_parameters, "BotChannel") - - request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - channel_name=channel_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BotChannel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BotChannel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, channel_name: str, **kwargs: Any - ) -> None: - """Deletes a Channel registration from a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Bot resource. Required. - :type channel_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - channel_name=channel_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, channel_name: str, **kwargs: Any - ) -> _models.BotChannel: - """Returns a BotService Channel registration specified by the parameters. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Bot resource. Required. - :type channel_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - channel_name=channel_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BotChannel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } - - @distributed_trace_async - async def list_with_keys( - self, resource_group_name: str, resource_name: str, channel_name: Union[str, _models.ChannelName], **kwargs: Any - ) -> _models.ListChannelWithKeysResponse: - """Lists a Channel registration for a Bot Service including secrets. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource. Known values are: "AlexaChannel", - "FacebookChannel", "EmailChannel", "KikChannel", "TelegramChannel", "SlackChannel", - "MsTeamsChannel", "SkypeChannel", "WebChatChannel", "DirectLineChannel", "SmsChannel", - "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", - "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListChannelWithKeysResponse or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ListChannelWithKeysResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ListChannelWithKeysResponse] = kwargs.pop("cls", None) - - request = build_list_with_keys_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - channel_name=channel_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_with_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ListChannelWithKeysResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_with_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BotChannel"]: - """Returns all the Channel registrations of a particular BotService resource. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BotChannel or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.BotChannel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ChannelResponseList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ChannelResponseList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_direct_line_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_direct_line_operations.py deleted file mode 100644 index 136c3f25abd9..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_direct_line_operations.py +++ /dev/null @@ -1,216 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._direct_line_operations import build_regenerate_keys_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DirectLineOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.aio.AzureBotService`'s - :attr:`direct_line` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def regenerate_keys( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.RegenerateKeysChannelName], - parameters: _models.SiteInfo, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.BotChannel: - """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService - resource. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource for which keys are to be regenerated. - Known values are: "WebChatChannel" and "DirectLineChannel". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.RegenerateKeysChannelName - :param parameters: The parameters to provide for the created bot. Required. - :type parameters: ~azure.mgmt.botservice.models.SiteInfo - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_keys( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.RegenerateKeysChannelName], - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.BotChannel: - """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService - resource. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource for which keys are to be regenerated. - Known values are: "WebChatChannel" and "DirectLineChannel". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.RegenerateKeysChannelName - :param parameters: The parameters to provide for the created bot. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_keys( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.RegenerateKeysChannelName], - parameters: Union[_models.SiteInfo, IO], - **kwargs: Any - ) -> _models.BotChannel: - """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService - resource. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource for which keys are to be regenerated. - Known values are: "WebChatChannel" and "DirectLineChannel". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.RegenerateKeysChannelName - :param parameters: The parameters to provide for the created bot. Is either a model type or a - IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.SiteInfo or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SiteInfo") - - request = build_regenerate_keys_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - channel_name=channel_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.regenerate_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BotChannel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - regenerate_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_email_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_email_operations.py deleted file mode 100644 index 8f7f40aff2b6..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_email_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._email_operations import build_create_sign_in_url_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EmailOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.aio.AzureBotService`'s - :attr:`email` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def create_sign_in_url( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.CreateEmailSignInUrlResponse: - """Creates an email channel sign in url for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CreateEmailSignInUrlResponse or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.CreateEmailSignInUrlResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.CreateEmailSignInUrlResponse] = kwargs.pop("cls", None) - - request = build_create_sign_in_url_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.create_sign_in_url.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CreateEmailSignInUrlResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_sign_in_url.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/createEmailSignInUrl" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_host_settings_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_host_settings_operations.py deleted file mode 100644 index 29e8ffea13f8..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_host_settings_operations.py +++ /dev/null @@ -1,111 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._host_settings_operations import build_get_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class HostSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.aio.AzureBotService`'s - :attr:`host_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, **kwargs: Any) -> _models.HostSettingsResponse: - """Get per subscription settings needed to host bot in compute resource such as Azure App Service. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HostSettingsResponse or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.HostSettingsResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.HostSettingsResponse] = kwargs.pop("cls", None) - - request = build_get_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("HostSettingsResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings"} diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operation_results_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operation_results_operations.py deleted file mode 100644 index 448d2de6d45b..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operation_results_operations.py +++ /dev/null @@ -1,180 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operation_results_operations import build_get_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class OperationResultsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.aio.AzureBotService`'s - :attr:`operation_results` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _get_initial( - self, operation_result_id: str, **kwargs: Any - ) -> Optional[_models.OperationResultsDescription]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[Optional[_models.OperationResultsDescription]] = kwargs.pop("cls", None) - - request = build_get_request( - operation_result_id=operation_result_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._get_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("OperationResultsDescription", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _get_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}" - } - - @distributed_trace_async - async def begin_get( - self, operation_result_id: str, **kwargs: Any - ) -> AsyncLROPoller[_models.OperationResultsDescription]: - """Get the operation result for a long running operation. - - :param operation_result_id: The ID of the operation result to get. Required. - :type operation_result_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OperationResultsDescription or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.botservice.models.OperationResultsDescription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.OperationResultsDescription] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._get_initial( - operation_result_id=operation_result_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationResultsDescription", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operations.py index 59c08e55779a..a27ae727b638 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_operations.py @@ -3,13 +3,16 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,25 +20,63 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer +from ...operations._operations import ( + build_bot_channels_create_request, + build_bot_channels_delete_request, + build_bot_channels_get_request, + build_bot_channels_list_by_resource_group_request, + build_bot_channels_list_with_keys_request, + build_bot_channels_regenerate_keys_request, + build_bot_channels_update_request, + build_bot_connection_operation_group_list_service_providers_request, + build_bots_create_request, + build_bots_create_sign_in_url_request, + build_bots_delete_request, + build_bots_get_request, + build_bots_list_by_bot_resource_request, + build_bots_list_by_resource_group_request, + build_bots_list_request, + build_bots_operation_group_get_check_name_availability_request, + build_bots_update_request, + build_connection_settings_create_request, + build_connection_settings_delete_request, + build_connection_settings_get_request, + build_connection_settings_list_by_bot_service_request, + build_connection_settings_list_with_secrets_request, + build_connection_settings_update_request, + build_host_settings_operation_group_get_request, + build_network_security_perimeter_configurations_get_request, + build_network_security_perimeter_configurations_list_request, + build_network_security_perimeter_configurations_reconcile_request, + build_operation_results_operation_group_get_request, + build_operations_list_request, + build_private_endpoint_connections_create_request, + build_private_endpoint_connections_delete_request, + build_private_endpoint_connections_get_request, + build_private_endpoint_connections_list_request, + build_qn_amaker_endpoint_keys_operation_group_get_request, +) +from .._configuration import BotServiceClientConfiguration -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] class Operations: @@ -44,37 +85,672 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.aio.AzureBotService`'s + :class:`~azure.mgmt.botservice.aio.BotServiceClient`'s :attr:`operations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationEntity"]: - """Lists all the available BotService operations. + """List the operations for the provider. - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationEntity or the result of cls(response) + :return: An iterator like instance of OperationEntity :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.OperationEntity] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OperationEntity]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OperationEntity], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class BotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.BotServiceClient`'s + :attr:`bots` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Bot: + """Returns a BotService specified by the parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Bot] = kwargs.pop("cls", None) + + _request = build_bots_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Bot, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.Bot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Bot: + """Creates a Bot Service. Bot Service is a resource group wide resource type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: ~azure.mgmt.botservice.models.Bot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Bot: + """Creates a Bot Service. Bot Service is a resource group wide resource type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Bot: + """Creates a Bot Service. Bot Service is a resource group wide resource type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.Bot, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Bot: + """Creates a Bot Service. Bot Service is a resource group wide resource type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Is one of the following + types: Bot, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.Bot or JSON or IO[bytes] + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Bot] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bots_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Bot, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.Bot, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Bot: + """Updates a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: ~azure.mgmt.botservice.models.Bot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Bot: + """Updates a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Bot: + """Updates a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.Bot, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Bot: + """Updates a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Is one of the following + types: Bot, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.Bot or JSON or IO[bytes] + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Bot] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bots_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Bot, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: + """Deletes a Bot Service from the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_bots_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - cls: ClsType[_models.OperationEntityListResult] = kwargs.pop("cls", None) - error_map = { + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Bot"]: + """Returns all the resources of a particular type belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Bot + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.Bot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Bot]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_bots_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Bot], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Bot"]: + """Returns all the resources of a particular type belonging to a subscription. + + :return: An iterator like instance of Bot + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.Bot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Bot]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -85,14 +761,18 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationEntity"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], + _request = build_bots_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -104,36 +784,3047 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationEntityListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Bot], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + error = _failsafe_deserialize(_models.Error, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.BotService/operations"} + @distributed_trace_async + async def create_sign_in_url( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.CreateEmailSignInUrlResponse: + """Creates an email channel sign in url for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: CreateEmailSignInUrlResponse. The CreateEmailSignInUrlResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.CreateEmailSignInUrlResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CreateEmailSignInUrlResponse] = kwargs.pop("cls", None) + + _request = build_bots_create_sign_in_url_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CreateEmailSignInUrlResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_by_bot_resource( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourceListResult: + """Gets the private link resources that need to be created for a Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: PrivateLinkResourceListResult. The PrivateLinkResourceListResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.PrivateLinkResourceListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + _request = build_bots_list_by_bot_resource_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateLinkResourceListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class BotChannelsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.BotServiceClient`'s + :attr:`bot_channels` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, channel_name: str, **kwargs: Any + ) -> _models.BotChannel: + """Returns a BotService Channel registration specified by the parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) + + _request = build_bot_channels_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BotChannel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: _models.BotChannel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BotChannel: + """Creates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: ~azure.mgmt.botservice.models.BotChannel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BotChannel: + """Creates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BotChannel: + """Creates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: Union[_models.BotChannel, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.BotChannel: + """Creates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Is one of the following + types: BotChannel, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.BotChannel or JSON or IO[bytes] + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bot_channels_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BotChannel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: _models.BotChannel, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BotChannel: + """Updates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: ~azure.mgmt.botservice.models.BotChannel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BotChannel: + """Updates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BotChannel: + """Updates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: Union[_models.BotChannel, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.BotChannel: + """Updates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Is one of the following + types: BotChannel, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.BotChannel or JSON or IO[bytes] + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bot_channels_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BotChannel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, channel_name: str, **kwargs: Any) -> None: + """Deletes a Channel registration from a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_bot_channels_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BotChannel"]: + """Returns all the Channel registrations of a particular BotService resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: An iterator like instance of BotChannel + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.BotChannel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BotChannel]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_bot_channels_list_by_resource_group_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.BotChannel], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def list_with_keys( + self, resource_group_name: str, resource_name: str, channel_name: str, **kwargs: Any + ) -> _models.ListChannelWithKeysResponse: + """Lists a Channel registration for a Bot Service including secrets. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :return: ListChannelWithKeysResponse. The ListChannelWithKeysResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.ListChannelWithKeysResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ListChannelWithKeysResponse] = kwargs.pop("cls", None) + + _request = build_bot_channels_list_with_keys_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ListChannelWithKeysResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: _models.SiteInfo, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BotChannel: + """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: ~azure.mgmt.botservice.models.SiteInfo + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BotChannel: + """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.BotChannel: + """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: Union[_models.SiteInfo, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.BotChannel: + """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Is one of the following + types: SiteInfo, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.SiteInfo or JSON or IO[bytes] + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bot_channels_regenerate_keys_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BotChannel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ConnectionSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.BotServiceClient`'s + :attr:`connection_settings` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any + ) -> _models.ConnectionSetting: + """Get a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) + + _request = build_connection_settings_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ConnectionSetting, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: _models.ConnectionSetting, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionSetting: + """Register a new Auth Connection for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for creating the Connection Setting. Required. + :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionSetting: + """Register a new Auth Connection for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for creating the Connection Setting. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionSetting: + """Register a new Auth Connection for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for creating the Connection Setting. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: Union[_models.ConnectionSetting, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ConnectionSetting: + """Register a new Auth Connection for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for creating the Connection Setting. Is one of the + following types: ConnectionSetting, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting or JSON or IO[bytes] + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connection_settings_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ConnectionSetting, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: _models.ConnectionSetting, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionSetting: + """Updates a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for updating the Connection Setting. Required. + :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionSetting: + """Updates a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for updating the Connection Setting. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionSetting: + """Updates a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for updating the Connection Setting. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: Union[_models.ConnectionSetting, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ConnectionSetting: + """Updates a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for updating the Connection Setting. Is one of the + following types: ConnectionSetting, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting or JSON or IO[bytes] + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connection_settings_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ConnectionSetting, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any) -> None: + """Deletes a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_connection_settings_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_bot_service( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ConnectionSetting"]: + """Returns all the Connection Settings registered to a particular BotService resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: An iterator like instance of ConnectionSetting + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.ConnectionSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ConnectionSetting]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_connection_settings_list_by_bot_service_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ConnectionSetting], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def list_with_secrets( + self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any + ) -> _models.ConnectionSetting: + """Get a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) + + _request = build_connection_settings_list_with_secrets_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ConnectionSetting, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.BotServiceClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the specified private endpoint connection associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + properties: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Update the state of specified private endpoint connection associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Update the state of specified private endpoint connection associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Update the state of specified private endpoint connection associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + properties: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Update the state of specified private endpoint connection associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Is one of the following types: + PrivateEndpointConnection, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.botservice.models.PrivateEndpointConnection or JSON or IO[bytes] + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + """Deletes the specified private endpoint connection associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: + """List all the private endpoint connections associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.BotServiceClient`'s + :attr:`network_security_perimeter_configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> _models.NetworkSecurityPerimeterConfiguration: + """Gets the specified Network Security Perimeter configuration associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param network_security_perimeter_configuration_name: The resource association Name. Composed + of parameter guid and association name. Required. + :type network_security_perimeter_configuration_name: str + :return: NetworkSecurityPerimeterConfiguration. The NetworkSecurityPerimeterConfiguration is + compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkSecurityPerimeterConfiguration"]: + """List Network Security Perimeter configurations associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: An iterator like instance of NetworkSecurityPerimeterConfiguration + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NetworkSecurityPerimeterConfiguration]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_network_security_perimeter_configurations_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NetworkSecurityPerimeterConfiguration], deserialized.get("value", []) + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _reconcile_initial( + self, + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_reconcile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_reconcile( + self, + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkSecurityPerimeterConfiguration]: + """Reconcile the specified Network Security Perimeter configuration associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param network_security_perimeter_configuration_name: The resource association Name. Composed + of parameter guid and association name. Required. + :type network_security_perimeter_configuration_name: str + :return: An instance of AsyncLROPoller that returns NetworkSecurityPerimeterConfiguration. The + NetworkSecurityPerimeterConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reconcile_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.NetworkSecurityPerimeterConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NetworkSecurityPerimeterConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class BotsOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.BotServiceClient`'s + :attr:`bots_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def get_check_name_availability( + self, + parameters: _models.CheckNameAvailabilityRequestBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseBody: + """Check whether a bot name is available. + + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.botservice.models.CheckNameAvailabilityRequestBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResponseBody. The CheckNameAvailabilityResponseBody is compatible + with MutableMapping + :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_check_name_availability( + self, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseBody: + """Check whether a bot name is available. + + :param parameters: The request body. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResponseBody. The CheckNameAvailabilityResponseBody is compatible + with MutableMapping + :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_check_name_availability( + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseBody: + """Check whether a bot name is available. + + :param parameters: The request body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResponseBody. The CheckNameAvailabilityResponseBody is compatible + with MutableMapping + :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_check_name_availability( + self, parameters: Union[_models.CheckNameAvailabilityRequestBody, JSON, IO[bytes]], **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseBody: + """Check whether a bot name is available. + + :param parameters: The request body. Is one of the following types: + CheckNameAvailabilityRequestBody, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.CheckNameAvailabilityRequestBody or JSON or + IO[bytes] + :return: CheckNameAvailabilityResponseBody. The CheckNameAvailabilityResponseBody is compatible + with MutableMapping + :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponseBody] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bots_operation_group_get_check_name_availability_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityResponseBody, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class BotConnectionOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.BotServiceClient`'s + :attr:`bot_connection_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list_service_providers(self, **kwargs: Any) -> _models.ServiceProviderResponseList: + """Lists the available Service Providers for creating Connection Settings. + + :return: ServiceProviderResponseList. The ServiceProviderResponseList is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.ServiceProviderResponseList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ServiceProviderResponseList] = kwargs.pop("cls", None) + + _request = build_bot_connection_operation_group_list_service_providers_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ServiceProviderResponseList, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class QnAMakerEndpointKeysOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.BotServiceClient`'s + :attr:`qn_amaker_endpoint_keys_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def get( + self, + parameters: _models.QnAMakerEndpointKeysRequestBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.QnAMakerEndpointKeysResponse: + """Lists the QnA Maker endpoint keys. + + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: QnAMakerEndpointKeysResponse. The QnAMakerEndpointKeysResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get( + self, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.QnAMakerEndpointKeysResponse: + """Lists the QnA Maker endpoint keys. + + :param parameters: The request body. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: QnAMakerEndpointKeysResponse. The QnAMakerEndpointKeysResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get( + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.QnAMakerEndpointKeysResponse: + """Lists the QnA Maker endpoint keys. + + :param parameters: The request body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: QnAMakerEndpointKeysResponse. The QnAMakerEndpointKeysResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get( + self, parameters: Union[_models.QnAMakerEndpointKeysRequestBody, JSON, IO[bytes]], **kwargs: Any + ) -> _models.QnAMakerEndpointKeysResponse: + """Lists the QnA Maker endpoint keys. + + :param parameters: The request body. Is one of the following types: + QnAMakerEndpointKeysRequestBody, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody or JSON or + IO[bytes] + :return: QnAMakerEndpointKeysResponse. The QnAMakerEndpointKeysResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QnAMakerEndpointKeysResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_qn_amaker_endpoint_keys_operation_group_get_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.QnAMakerEndpointKeysResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class HostSettingsOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.BotServiceClient`'s + :attr:`host_settings_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, **kwargs: Any) -> _models.HostSettingsResponse: + """Get per subscription settings needed to host bot in compute resource such as Azure App Service. + + :return: HostSettingsResponse. The HostSettingsResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.HostSettingsResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.HostSettingsResponse] = kwargs.pop("cls", None) + + _request = build_host_settings_operation_group_get_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.HostSettingsResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OperationResultsOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.aio.BotServiceClient`'s + :attr:`operation_results_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _get_initial(self, operation_result_id: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_operation_results_operation_group_get_request( + operation_result_id=operation_result_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_get( + self, operation_result_id: str, **kwargs: Any + ) -> AsyncLROPoller[_models.OperationResultsDescription]: + """Get the operation result for a long running operation. + + :param operation_result_id: The ID of the operation result to get. Required. + :type operation_result_id: str + :return: An instance of AsyncLROPoller that returns OperationResultsDescription. The + OperationResultsDescription is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.botservice.models.OperationResultsDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationResultsDescription] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._get_initial( + operation_result_id=operation_result_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationResultsDescription, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.OperationResultsDescription].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OperationResultsDescription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_patch.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_patch.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_endpoint_connections_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 635716e2980b..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,452 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_endpoint_connections_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.aio.AzureBotService`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnection"]: - """List all the private endpoint connections associated with the Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.botservice.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections" - } - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets the specified private endpoint connection associated with the Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - properties: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Update the state of specified private endpoint connection associated with the Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: ~azure.mgmt.botservice.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - properties: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Update the state of specified private endpoint connection associated with the Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Update the state of specified private endpoint connection associated with the Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Is either a model type or a IO - type. Required. - :type properties: ~azure.mgmt.botservice.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IO, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "PrivateEndpointConnection") - - request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - """Deletes the specified private endpoint connection associated with the Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_link_resources_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_link_resources_operations.py deleted file mode 100644 index 11a39921edab..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._private_link_resources_operations import build_list_by_bot_resource_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.aio.AzureBotService`'s - :attr:`private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list_by_bot_resource( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.PrivateLinkResourceListResult: - """Gets the private link resources that need to be created for a Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.PrivateLinkResourceListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - request = build_list_by_bot_resource_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_bot_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_by_bot_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_qn_amaker_endpoint_keys_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_qn_amaker_endpoint_keys_operations.py deleted file mode 100644 index e1e28a0a90e5..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/aio/operations/_qn_amaker_endpoint_keys_operations.py +++ /dev/null @@ -1,171 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._qn_amaker_endpoint_keys_operations import build_get_request - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class QnAMakerEndpointKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.aio.AzureBotService`'s - :attr:`qn_amaker_endpoint_keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def get( - self, - parameters: _models.QnAMakerEndpointKeysRequestBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.QnAMakerEndpointKeysResponse: - """Lists the QnA Maker endpoint keys. - - :param parameters: The request body parameters to provide for the check name availability - request. Required. - :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: QnAMakerEndpointKeysResponse or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def get( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.QnAMakerEndpointKeysResponse: - """Lists the QnA Maker endpoint keys. - - :param parameters: The request body parameters to provide for the check name availability - request. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: QnAMakerEndpointKeysResponse or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def get( - self, parameters: Union[_models.QnAMakerEndpointKeysRequestBody, IO], **kwargs: Any - ) -> _models.QnAMakerEndpointKeysResponse: - """Lists the QnA Maker endpoint keys. - - :param parameters: The request body parameters to provide for the check name availability - request. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: QnAMakerEndpointKeysResponse or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.QnAMakerEndpointKeysResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "QnAMakerEndpointKeysRequestBody") - - request = build_get_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("QnAMakerEndpointKeysResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listQnAMakerEndpointKeys"} diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py index a679b8e73964..31839ec79e2a 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py @@ -2,107 +2,130 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AcsChatChannel -from ._models_py3 import AlexaChannel -from ._models_py3 import AlexaChannelProperties -from ._models_py3 import Bot -from ._models_py3 import BotChannel -from ._models_py3 import BotProperties -from ._models_py3 import BotResponseList -from ._models_py3 import Channel -from ._models_py3 import ChannelResponseList -from ._models_py3 import ChannelSettings -from ._models_py3 import CheckNameAvailabilityRequestBody -from ._models_py3 import CheckNameAvailabilityResponseBody -from ._models_py3 import ConnectionItemName -from ._models_py3 import ConnectionSetting -from ._models_py3 import ConnectionSettingParameter -from ._models_py3 import ConnectionSettingProperties -from ._models_py3 import ConnectionSettingResponseList -from ._models_py3 import CreateEmailSignInUrlResponse -from ._models_py3 import CreateEmailSignInUrlResponseProperties -from ._models_py3 import DirectLineChannel -from ._models_py3 import DirectLineChannelProperties -from ._models_py3 import DirectLineSite -from ._models_py3 import DirectLineSpeechChannel -from ._models_py3 import DirectLineSpeechChannelProperties -from ._models_py3 import EmailChannel -from ._models_py3 import EmailChannelProperties -from ._models_py3 import Error -from ._models_py3 import ErrorBody -from ._models_py3 import FacebookChannel -from ._models_py3 import FacebookChannelProperties -from ._models_py3 import FacebookPage -from ._models_py3 import HostSettingsResponse -from ._models_py3 import KikChannel -from ._models_py3 import KikChannelProperties -from ._models_py3 import LineChannel -from ._models_py3 import LineChannelProperties -from ._models_py3 import LineRegistration -from ._models_py3 import ListChannelWithKeysResponse -from ._models_py3 import M365Extensions -from ._models_py3 import MsTeamsChannel -from ._models_py3 import MsTeamsChannelProperties -from ._models_py3 import Omnichannel -from ._models_py3 import OperationDisplayInfo -from ._models_py3 import OperationEntity -from ._models_py3 import OperationEntityListResult -from ._models_py3 import OperationResultsDescription -from ._models_py3 import OutlookChannel -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceBase -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import QnAMakerEndpointKeysRequestBody -from ._models_py3 import QnAMakerEndpointKeysResponse -from ._models_py3 import Resource -from ._models_py3 import SearchAssistant -from ._models_py3 import ServiceProvider -from ._models_py3 import ServiceProviderParameter -from ._models_py3 import ServiceProviderParameterMetadata -from ._models_py3 import ServiceProviderParameterMetadataConstraints -from ._models_py3 import ServiceProviderProperties -from ._models_py3 import ServiceProviderResponseList -from ._models_py3 import Site -from ._models_py3 import SiteInfo -from ._models_py3 import Sku -from ._models_py3 import SkypeChannel -from ._models_py3 import SkypeChannelProperties -from ._models_py3 import SlackChannel -from ._models_py3 import SlackChannelProperties -from ._models_py3 import SmsChannel -from ._models_py3 import SmsChannelProperties -from ._models_py3 import TelegramChannel -from ._models_py3 import TelegramChannelProperties -from ._models_py3 import TelephonyChannel -from ._models_py3 import TelephonyChannelProperties -from ._models_py3 import TelephonyChannelResourceApiConfiguration -from ._models_py3 import TelephonyPhoneNumbers -from ._models_py3 import WebChatChannel -from ._models_py3 import WebChatChannelProperties -from ._models_py3 import WebChatSite +from typing import TYPE_CHECKING -from ._azure_bot_service_enums import ChannelName -from ._azure_bot_service_enums import EmailChannelAuthMethod -from ._azure_bot_service_enums import Key -from ._azure_bot_service_enums import Kind -from ._azure_bot_service_enums import MsaAppType -from ._azure_bot_service_enums import OperationResultStatus -from ._azure_bot_service_enums import PrivateEndpointConnectionProvisioningState -from ._azure_bot_service_enums import PrivateEndpointServiceConnectionStatus -from ._azure_bot_service_enums import PublicNetworkAccess -from ._azure_bot_service_enums import RegenerateKeysChannelName -from ._azure_bot_service_enums import SkuName -from ._azure_bot_service_enums import SkuTier +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models import ( # type: ignore + AcsChatChannel, + AlexaChannel, + AlexaChannelProperties, + Bot, + BotChannel, + BotProperties, + Channel, + ChannelSettings, + CheckNameAvailabilityRequestBody, + CheckNameAvailabilityResponseBody, + ConnectionSetting, + ConnectionSettingParameter, + ConnectionSettingProperties, + CreateEmailSignInUrlResponse, + CreateEmailSignInUrlResponseProperties, + DirectLineChannel, + DirectLineChannelProperties, + DirectLineSite, + DirectLineSpeechChannel, + DirectLineSpeechChannelProperties, + EmailChannel, + EmailChannelProperties, + Error, + ErrorBody, + FacebookChannel, + FacebookChannelProperties, + FacebookPage, + HostSettingsResponse, + KikChannel, + KikChannelProperties, + LineChannel, + LineChannelProperties, + LineRegistration, + ListChannelWithKeysResponse, + M365Extensions, + MsTeamsChannel, + MsTeamsChannelProperties, + NetworkSecurityPerimeter, + NetworkSecurityPerimeterConfiguration, + NetworkSecurityPerimeterConfigurationProperties, + NspAccessRule, + NspAccessRuleProperties, + NspAccessRulePropertiesSubscriptionsItem, + Omnichannel, + OperationDisplayInfo, + OperationEntity, + OperationResultsDescription, + OutlookChannel, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionProperties, + PrivateLinkResource, + PrivateLinkResourceBase, + PrivateLinkResourceListResult, + PrivateLinkResourceProperties, + PrivateLinkServiceConnectionState, + Profile, + ProvisioningIssue, + ProvisioningIssueProperties, + ProxyResource, + QnAMakerEndpointKeysRequestBody, + QnAMakerEndpointKeysResponse, + Resource, + ResourceAssociation, + SearchAssistant, + ServiceProvider, + ServiceProviderParameter, + ServiceProviderParameterMetadata, + ServiceProviderParameterMetadataConstraints, + ServiceProviderProperties, + ServiceProviderResponseList, + Site, + SiteInfo, + Sku, + SkypeChannel, + SkypeChannelProperties, + SlackChannel, + SlackChannelProperties, + SmsChannel, + SmsChannelProperties, + SystemData, + TelegramChannel, + TelegramChannelProperties, + TelephonyChannel, + TelephonyChannelProperties, + TelephonyChannelResourceApiConfiguration, + TelephonyPhoneNumbers, + TrackedResource, + WebChatChannel, + WebChatChannelProperties, + WebChatSite, +) + +from ._enums import ( # type: ignore + AccessMode, + CreatedByType, + EmailChannelAuthMethod, + Key, + Kind, + MsaAppType, + NspAccessRuleDirection, + OperationResultStatus, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicNetworkAccess, + Severity, + SkuName, + SkuTier, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -112,17 +135,13 @@ "Bot", "BotChannel", "BotProperties", - "BotResponseList", "Channel", - "ChannelResponseList", "ChannelSettings", "CheckNameAvailabilityRequestBody", "CheckNameAvailabilityResponseBody", - "ConnectionItemName", "ConnectionSetting", "ConnectionSettingParameter", "ConnectionSettingProperties", - "ConnectionSettingResponseList", "CreateEmailSignInUrlResponse", "CreateEmailSignInUrlResponseProperties", "DirectLineChannel", @@ -147,22 +166,33 @@ "M365Extensions", "MsTeamsChannel", "MsTeamsChannelProperties", + "NetworkSecurityPerimeter", + "NetworkSecurityPerimeterConfiguration", + "NetworkSecurityPerimeterConfigurationProperties", + "NspAccessRule", + "NspAccessRuleProperties", + "NspAccessRulePropertiesSubscriptionsItem", "Omnichannel", "OperationDisplayInfo", "OperationEntity", - "OperationEntityListResult", "OperationResultsDescription", "OutlookChannel", "PrivateEndpoint", "PrivateEndpointConnection", - "PrivateEndpointConnectionListResult", + "PrivateEndpointConnectionProperties", "PrivateLinkResource", "PrivateLinkResourceBase", "PrivateLinkResourceListResult", + "PrivateLinkResourceProperties", "PrivateLinkServiceConnectionState", + "Profile", + "ProvisioningIssue", + "ProvisioningIssueProperties", + "ProxyResource", "QnAMakerEndpointKeysRequestBody", "QnAMakerEndpointKeysResponse", "Resource", + "ResourceAssociation", "SearchAssistant", "ServiceProvider", "ServiceProviderParameter", @@ -179,27 +209,32 @@ "SlackChannelProperties", "SmsChannel", "SmsChannelProperties", + "SystemData", "TelegramChannel", "TelegramChannelProperties", "TelephonyChannel", "TelephonyChannelProperties", "TelephonyChannelResourceApiConfiguration", "TelephonyPhoneNumbers", + "TrackedResource", "WebChatChannel", "WebChatChannelProperties", "WebChatSite", - "ChannelName", + "AccessMode", + "CreatedByType", "EmailChannelAuthMethod", "Key", "Kind", "MsaAppType", + "NspAccessRuleDirection", "OperationResultStatus", "PrivateEndpointConnectionProvisioningState", "PrivateEndpointServiceConnectionStatus", + "ProvisioningState", "PublicNetworkAccess", - "RegenerateKeysChannelName", + "Severity", "SkuName", "SkuTier", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_azure_bot_service_enums.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_enums.py similarity index 61% rename from sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_azure_bot_service_enums.py rename to sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_enums.py index 24dd86f7728e..792530e2ca37 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_azure_bot_service_enums.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_enums.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -10,37 +10,34 @@ from azure.core import CaseInsensitiveEnumMeta -class ChannelName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ChannelName.""" - - ALEXA_CHANNEL = "AlexaChannel" - FACEBOOK_CHANNEL = "FacebookChannel" - EMAIL_CHANNEL = "EmailChannel" - KIK_CHANNEL = "KikChannel" - TELEGRAM_CHANNEL = "TelegramChannel" - SLACK_CHANNEL = "SlackChannel" - MS_TEAMS_CHANNEL = "MsTeamsChannel" - SKYPE_CHANNEL = "SkypeChannel" - WEB_CHAT_CHANNEL = "WebChatChannel" - DIRECT_LINE_CHANNEL = "DirectLineChannel" - SMS_CHANNEL = "SmsChannel" - LINE_CHANNEL = "LineChannel" - DIRECT_LINE_SPEECH_CHANNEL = "DirectLineSpeechChannel" - OUTLOOK_CHANNEL = "OutlookChannel" - OMNICHANNEL = "Omnichannel" - TELEPHONY_CHANNEL = "TelephonyChannel" - ACS_CHAT_CHANNEL = "AcsChatChannel" - SEARCH_ASSISTANT = "SearchAssistant" - M365_EXTENSIONS = "M365Extensions" - - -class EmailChannelAuthMethod(float, Enum, metaclass=CaseInsensitiveEnumMeta): +class AccessMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Access Mode of the resource association.""" + + ENFORCED = "Enforced" + LEARNING = "Learning" + AUDIT = "Audit" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of entity that created the resource.""" + + USER = "User" + """The entity was created by a user.""" + APPLICATION = "Application" + """The entity was created by an application.""" + MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" + KEY = "Key" + """The entity was created by a key.""" + + +class EmailChannelAuthMethod(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Email channel auth method. 0 Password (Default); 1 Graph.""" - #: Basic authentication. PASSWORD = 0 - #: Modern authentication. + """Basic authentication.""" GRAPH = 1 + """Modern authentication.""" class Key(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -68,6 +65,13 @@ class MsaAppType(str, Enum, metaclass=CaseInsensitiveEnumMeta): MULTI_TENANT = "MultiTenant" +class NspAccessRuleDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Direction of Access Rule.""" + + INBOUND = "Inbound" + OUTBOUND = "Outbound" + + class OperationResultStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the operation being performed.""" @@ -95,18 +99,30 @@ class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiv REJECTED = "Rejected" +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ProvisioningState.""" + + CREATING = "Creating" + UPDATING = "Updating" + ACCEPTED = "Accepted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Whether the bot is in an isolated network.""" ENABLED = "Enabled" DISABLED = "Disabled" + SECURED_BY_PERIMETER = "SecuredByPerimeter" -class RegenerateKeysChannelName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """RegenerateKeysChannelName.""" +class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of Network Security Perimeter configuration propagation.""" - WEB_CHAT_CHANNEL = "WebChatChannel" - DIRECT_LINE_CHANNEL = "DirectLineChannel" + WARNING = "Warning" + ERROR = "Error" class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models.py new file mode 100644 index 000000000000..729e9dde1d0d --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models.py @@ -0,0 +1,4580 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Dict, List, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_discriminator, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class Channel(_Model): + """Channel definition. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AcsChatChannel, AlexaChannel, DirectLineChannel, DirectLineSpeechChannel, EmailChannel, + FacebookChannel, KikChannel, LineChannel, M365Extensions, MsTeamsChannel, Omnichannel, + OutlookChannel, SearchAssistant, SkypeChannel, SlackChannel, SmsChannel, TelegramChannel, + TelephonyChannel, WebChatChannel + + :ivar channel_name: The channel name. Required. Default value is None. + :vartype channel_name: str + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + """ + + __mapping__: Dict[str, _Model] = {} + channel_name: str = rest_discriminator( + name="channelName", visibility=["read", "create", "update", "delete", "query"] + ) + """The channel name. Required. Default value is None.""" + etag: Optional[str] = rest_field(visibility=["read", "create"]) + """Entity Tag of the resource.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """Provisioning state of the resource.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the location of the resource.""" + + @overload + def __init__( + self, + *, + channel_name: str, + etag: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AcsChatChannel(Channel, discriminator="AcsChatChannel"): + """AcsChat channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar channel_name: The channel name. Required. Default value is "AcsChatChannel". + :vartype channel_name: str + """ + + channel_name: Literal["AcsChatChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"AcsChatChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="AcsChatChannel", **kwargs) + + +class AlexaChannel(Channel, discriminator="AlexaChannel"): + """Alexa channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to Alexa channel resource. + :vartype properties: ~azure.mgmt.botservice.models.AlexaChannelProperties + :ivar channel_name: The channel name. Required. Default value is "AlexaChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.AlexaChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to Alexa channel resource.""" + channel_name: Literal["AlexaChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"AlexaChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.AlexaChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="AlexaChannel", **kwargs) + + +class AlexaChannelProperties(_Model): + """The parameters to provide for the Alexa channel. + + :ivar alexa_skill_id: The Alexa skill Id. Required. + :vartype alexa_skill_id: str + :ivar url_fragment: Url fragment used in part of the Uri configured in Alexa. + :vartype url_fragment: str + :ivar service_endpoint_uri: Full Uri used to configured the skill in Alexa. + :vartype service_endpoint_uri: str + :ivar is_enabled: Whether this channel is enabled for the bot. Required. + :vartype is_enabled: bool + """ + + alexa_skill_id: str = rest_field(name="alexaSkillId", visibility=["read", "create", "update", "delete", "query"]) + """The Alexa skill Id. Required.""" + url_fragment: Optional[str] = rest_field(name="urlFragment", visibility=["read"]) + """Url fragment used in part of the Uri configured in Alexa.""" + service_endpoint_uri: Optional[str] = rest_field(name="serviceEndpointUri", visibility=["read"]) + """Full Uri used to configured the skill in Alexa.""" + is_enabled: bool = rest_field(name="isEnabled", visibility=["read", "create", "update", "delete", "query"]) + """Whether this channel is enabled for the bot. Required.""" + + @overload + def __init__( + self, + *, + alexa_skill_id: str, + is_enabled: bool, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Resource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.botservice.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class TrackedResource(Resource): + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.botservice.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Bot(TrackedResource): + """Bot resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.botservice.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The set of properties specific to bot resource. + :vartype properties: ~azure.mgmt.botservice.models.BotProperties + :ivar sku: Gets or sets the SKU of the resource. + :vartype sku: ~azure.mgmt.botservice.models.Sku + :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", + "designer", "bot", "function", and "azurebot". + :vartype kind: str or ~azure.mgmt.botservice.models.Kind + :ivar etag: Entity Tag. + :vartype etag: str + :ivar zones: Entity zones. + :vartype zones: list[str] + """ + + properties: Optional["_models.BotProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to bot resource.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the SKU of the resource.""" + kind: Optional[Union[str, "_models.Kind"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required. Gets or sets the Kind of the resource. Known values are: \"sdk\", \"designer\", + \"bot\", \"function\", and \"azurebot\".""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Entity Tag.""" + zones: Optional[List[str]] = rest_field(visibility=["read"]) + """Entity zones.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.BotProperties"] = None, + sku: Optional["_models.Sku"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, + etag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BotChannel(TrackedResource): + """Bot channel resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.botservice.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The set of properties specific to bot channel resource. + :vartype properties: ~azure.mgmt.botservice.models.Channel + :ivar sku: Gets or sets the SKU of the resource. + :vartype sku: ~azure.mgmt.botservice.models.Sku + :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", + "designer", "bot", "function", and "azurebot". + :vartype kind: str or ~azure.mgmt.botservice.models.Kind + :ivar etag: Entity Tag. + :vartype etag: str + :ivar zones: Entity zones. + :vartype zones: list[str] + """ + + properties: Optional["_models.Channel"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The set of properties specific to bot channel resource.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the SKU of the resource.""" + kind: Optional[Union[str, "_models.Kind"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required. Gets or sets the Kind of the resource. Known values are: \"sdk\", \"designer\", + \"bot\", \"function\", and \"azurebot\".""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Entity Tag.""" + zones: Optional[List[str]] = rest_field(visibility=["read"]) + """Entity zones.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.Channel"] = None, + sku: Optional["_models.Sku"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, + etag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BotProperties(_Model): + """The parameters to provide for the Bot. + + :ivar display_name: The Name of the bot. Required. + :vartype display_name: str + :ivar description: The description of the bot. + :vartype description: str + :ivar icon_url: The Icon Url of the bot. + :vartype icon_url: str + :ivar endpoint: The bot's endpoint. Required. + :vartype endpoint: str + :ivar endpoint_version: The bot's endpoint version. + :vartype endpoint_version: str + :ivar all_settings: Contains resource all settings defined as key/value pairs. + :vartype all_settings: dict[str, str] + :ivar parameters: Contains resource parameters defined as key/value pairs. + :vartype parameters: dict[str, str] + :ivar manifest_url: The bot's manifest url. + :vartype manifest_url: str + :ivar msa_app_type: Microsoft App Type for the bot. Known values are: "UserAssignedMSI", + "SingleTenant", and "MultiTenant". + :vartype msa_app_type: str or ~azure.mgmt.botservice.models.MsaAppType + :ivar msa_app_id: Microsoft App Id for the bot. Required. + :vartype msa_app_id: str + :ivar msa_app_tenant_id: Microsoft App Tenant Id for the bot. + :vartype msa_app_tenant_id: str + :ivar msa_app_msi_resource_id: Microsoft App Managed Identity Resource Id for the bot. + :vartype msa_app_msi_resource_id: str + :ivar configured_channels: Collection of channels for which the bot is configured. + :vartype configured_channels: list[str] + :ivar enabled_channels: Collection of channels for which the bot is enabled. + :vartype enabled_channels: list[str] + :ivar developer_app_insight_key: The Application Insights key. + :vartype developer_app_insight_key: str + :ivar developer_app_insights_api_key: The Application Insights Api Key. + :vartype developer_app_insights_api_key: str + :ivar developer_app_insights_application_id: The Application Insights App Id. + :vartype developer_app_insights_application_id: str + :ivar luis_app_ids: Collection of LUIS App Ids. + :vartype luis_app_ids: list[str] + :ivar luis_key: The LUIS Key. + :vartype luis_key: str + :ivar is_cmek_enabled: Whether Cmek is enabled. + :vartype is_cmek_enabled: bool + :ivar cmek_key_vault_url: The CMK Url. + :vartype cmek_key_vault_url: str + :ivar cmek_encryption_status: The CMK encryption status. + :vartype cmek_encryption_status: str + :ivar tenant_id: The Tenant Id for the bot. + :vartype tenant_id: str + :ivar public_network_access: Whether the bot is in an isolated network. Known values are: + "Enabled", "Disabled", and "SecuredByPerimeter". + :vartype public_network_access: str or ~azure.mgmt.botservice.models.PublicNetworkAccess + :ivar is_streaming_supported: Whether the bot is streaming supported. + :vartype is_streaming_supported: bool + :ivar is_developer_app_insights_api_key_set: Whether the bot is developerAppInsightsApiKey set. + :vartype is_developer_app_insights_api_key_set: bool + :ivar migration_token: Token used to migrate non Azure bot to azure subscription. + :vartype migration_token: str + :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :vartype disable_local_auth: bool + :ivar schema_transformation_version: The channel schema transformation version for the bot. + :vartype schema_transformation_version: str + :ivar storage_resource_id: The storage resourceId for the bot. + :vartype storage_resource_id: str + :ivar private_endpoint_connections: List of Private Endpoint Connections configured for the + bot. + :vartype private_endpoint_connections: + list[~azure.mgmt.botservice.models.PrivateEndpointConnection] + :ivar network_security_perimeter_configurations: List of Network Security Perimeter + configurations for the bot. + :vartype network_security_perimeter_configurations: + list[~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration] + :ivar open_with_hint: The hint to browser (e.g. protocol handler) on how to open the bot for + authoring. + :vartype open_with_hint: str + :ivar app_password_hint: The hint (e.g. keyVault secret resourceId) on how to fetch the app + secret. + :vartype app_password_hint: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar publishing_credentials: Publishing credentials of the resource. + :vartype publishing_credentials: str + """ + + display_name: str = rest_field(name="displayName", visibility=["read", "create", "update", "delete", "query"]) + """The Name of the bot. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of the bot.""" + icon_url: Optional[str] = rest_field(name="iconUrl", visibility=["read", "create", "update", "delete", "query"]) + """The Icon Url of the bot.""" + endpoint: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The bot's endpoint. Required.""" + endpoint_version: Optional[str] = rest_field(name="endpointVersion", visibility=["read"]) + """The bot's endpoint version.""" + all_settings: Optional[Dict[str, str]] = rest_field( + name="allSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains resource all settings defined as key/value pairs.""" + parameters: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Contains resource parameters defined as key/value pairs.""" + manifest_url: Optional[str] = rest_field( + name="manifestUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """The bot's manifest url.""" + msa_app_type: Optional[Union[str, "_models.MsaAppType"]] = rest_field( + name="msaAppType", visibility=["read", "create", "update", "delete", "query"] + ) + """Microsoft App Type for the bot. Known values are: \"UserAssignedMSI\", \"SingleTenant\", and + \"MultiTenant\".""" + msa_app_id: str = rest_field(name="msaAppId", visibility=["read", "create"]) + """Microsoft App Id for the bot. Required.""" + msa_app_tenant_id: Optional[str] = rest_field(name="msaAppTenantId", visibility=["read", "create"]) + """Microsoft App Tenant Id for the bot.""" + msa_app_msi_resource_id: Optional[str] = rest_field( + name="msaAppMSIResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Microsoft App Managed Identity Resource Id for the bot.""" + configured_channels: Optional[List[str]] = rest_field(name="configuredChannels", visibility=["read"]) + """Collection of channels for which the bot is configured.""" + enabled_channels: Optional[List[str]] = rest_field(name="enabledChannels", visibility=["read"]) + """Collection of channels for which the bot is enabled.""" + developer_app_insight_key: Optional[str] = rest_field( + name="developerAppInsightKey", visibility=["read", "create", "update", "delete", "query"] + ) + """The Application Insights key.""" + developer_app_insights_api_key: Optional[str] = rest_field( + name="developerAppInsightsApiKey", visibility=["read", "create", "update", "delete", "query"] + ) + """The Application Insights Api Key.""" + developer_app_insights_application_id: Optional[str] = rest_field( + name="developerAppInsightsApplicationId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Application Insights App Id.""" + luis_app_ids: Optional[List[str]] = rest_field( + name="luisAppIds", visibility=["read", "create", "update", "delete", "query"] + ) + """Collection of LUIS App Ids.""" + luis_key: Optional[str] = rest_field(name="luisKey", visibility=["read", "create", "update", "delete", "query"]) + """The LUIS Key.""" + is_cmek_enabled: Optional[bool] = rest_field( + name="isCmekEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether Cmek is enabled.""" + cmek_key_vault_url: Optional[str] = rest_field( + name="cmekKeyVaultUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """The CMK Url.""" + cmek_encryption_status: Optional[str] = rest_field(name="cmekEncryptionStatus", visibility=["read"]) + """The CMK encryption status.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create"]) + """The Tenant Id for the bot.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether the bot is in an isolated network. Known values are: \"Enabled\", \"Disabled\", and + \"SecuredByPerimeter\".""" + is_streaming_supported: Optional[bool] = rest_field( + name="isStreamingSupported", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether the bot is streaming supported.""" + is_developer_app_insights_api_key_set: Optional[bool] = rest_field( + name="isDeveloperAppInsightsApiKeySet", visibility=["read"] + ) + """Whether the bot is developerAppInsightsApiKey set.""" + migration_token: Optional[str] = rest_field(name="migrationToken", visibility=["read"]) + """Token used to migrate non Azure bot to azure subscription.""" + disable_local_auth: Optional[bool] = rest_field( + name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for + authentication.""" + schema_transformation_version: Optional[str] = rest_field( + name="schemaTransformationVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The channel schema transformation version for the bot.""" + storage_resource_id: Optional[str] = rest_field( + name="storageResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The storage resourceId for the bot.""" + private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = rest_field( + name="privateEndpointConnections", visibility=["read"] + ) + """List of Private Endpoint Connections configured for the bot.""" + network_security_perimeter_configurations: Optional[List["_models.NetworkSecurityPerimeterConfiguration"]] = ( + rest_field(name="networkSecurityPerimeterConfigurations", visibility=["read"]) + ) + """List of Network Security Perimeter configurations for the bot.""" + open_with_hint: Optional[str] = rest_field( + name="openWithHint", visibility=["read", "create", "update", "delete", "query"] + ) + """The hint to browser (e.g. protocol handler) on how to open the bot for authoring.""" + app_password_hint: Optional[str] = rest_field( + name="appPasswordHint", visibility=["read", "create", "update", "delete", "query"] + ) + """The hint (e.g. keyVault secret resourceId) on how to fetch the app secret.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """Provisioning state of the resource.""" + publishing_credentials: Optional[str] = rest_field( + name="publishingCredentials", visibility=["read", "create", "update", "delete", "query"] + ) + """Publishing credentials of the resource.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + display_name: str, + endpoint: str, + msa_app_id: str, + description: Optional[str] = None, + icon_url: Optional[str] = None, + all_settings: Optional[Dict[str, str]] = None, + parameters: Optional[Dict[str, str]] = None, + manifest_url: Optional[str] = None, + msa_app_type: Optional[Union[str, "_models.MsaAppType"]] = None, + msa_app_tenant_id: Optional[str] = None, + msa_app_msi_resource_id: Optional[str] = None, + developer_app_insight_key: Optional[str] = None, + developer_app_insights_api_key: Optional[str] = None, + developer_app_insights_application_id: Optional[str] = None, + luis_app_ids: Optional[List[str]] = None, + luis_key: Optional[str] = None, + is_cmek_enabled: Optional[bool] = None, + cmek_key_vault_url: Optional[str] = None, + tenant_id: Optional[str] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + is_streaming_supported: Optional[bool] = None, + disable_local_auth: Optional[bool] = None, + schema_transformation_version: Optional[str] = None, + storage_resource_id: Optional[str] = None, + open_with_hint: Optional[str] = None, + app_password_hint: Optional[str] = None, + publishing_credentials: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ChannelSettings(_Model): + """Channel settings definition. + + :ivar extension_key1: The extensionKey1. + :vartype extension_key1: str + :ivar extension_key2: The extensionKey2. + :vartype extension_key2: str + :ivar sites: The list of sites. + :vartype sites: list[~azure.mgmt.botservice.models.Site] + :ivar channel_id: The channel id. + :vartype channel_id: str + :ivar channel_display_name: The channel display name. + :vartype channel_display_name: str + :ivar bot_id: The bot id. + :vartype bot_id: str + :ivar bot_icon_url: The bot icon url. + :vartype bot_icon_url: str + :ivar is_enabled: Whether this channel is enabled for the bot. + :vartype is_enabled: bool + :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :vartype disable_local_auth: bool + :ivar require_terms_agreement: Whether customer needs to agree to new terms. + :vartype require_terms_agreement: bool + """ + + extension_key1: Optional[str] = rest_field( + name="extensionKey1", visibility=["read", "create", "update", "delete", "query"] + ) + """The extensionKey1.""" + extension_key2: Optional[str] = rest_field( + name="extensionKey2", visibility=["read", "create", "update", "delete", "query"] + ) + """The extensionKey2.""" + sites: Optional[List["_models.Site"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of sites.""" + channel_id: Optional[str] = rest_field(name="channelId", visibility=["read", "create", "update", "delete", "query"]) + """The channel id.""" + channel_display_name: Optional[str] = rest_field( + name="channelDisplayName", visibility=["read", "create", "update", "delete", "query"] + ) + """The channel display name.""" + bot_id: Optional[str] = rest_field(name="botId", visibility=["read", "create", "update", "delete", "query"]) + """The bot id.""" + bot_icon_url: Optional[str] = rest_field( + name="botIconUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """The bot icon url.""" + is_enabled: Optional[bool] = rest_field( + name="isEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this channel is enabled for the bot.""" + disable_local_auth: Optional[bool] = rest_field( + name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for + authentication.""" + require_terms_agreement: Optional[bool] = rest_field( + name="requireTermsAgreement", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether customer needs to agree to new terms.""" + + @overload + def __init__( + self, + *, + extension_key1: Optional[str] = None, + extension_key2: Optional[str] = None, + sites: Optional[List["_models.Site"]] = None, + channel_id: Optional[str] = None, + channel_display_name: Optional[str] = None, + bot_id: Optional[str] = None, + bot_icon_url: Optional[str] = None, + is_enabled: Optional[bool] = None, + disable_local_auth: Optional[bool] = None, + require_terms_agreement: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckNameAvailabilityRequestBody(_Model): + """The request body for a request to Bot Service Management to check availability of a bot name. + + :ivar name: the name of the bot for which availability needs to be checked. + :vartype name: str + :ivar type: the type of the bot for which availability needs to be checked. + :vartype type: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """the name of the bot for which availability needs to be checked.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """the type of the bot for which availability needs to be checked.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckNameAvailabilityResponseBody(_Model): + """The response body returned for a request to Bot Service Management to check availability of a + bot name. + + :ivar valid: indicates if the bot name is valid. + :vartype valid: bool + :ivar message: additional message from the bot management api showing why a bot name is not + available. + :vartype message: str + :ivar abs_code: response code from ABS. + :vartype abs_code: str + """ + + valid: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """indicates if the bot name is valid.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """additional message from the bot management api showing why a bot name is not available.""" + abs_code: Optional[str] = rest_field(name="absCode", visibility=["read", "create", "update", "delete", "query"]) + """response code from ABS.""" + + @overload + def __init__( + self, + *, + valid: Optional[bool] = None, + message: Optional[str] = None, + abs_code: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConnectionSetting(TrackedResource): + """Bot channel resource definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.botservice.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The set of properties specific to bot channel resource. + :vartype properties: ~azure.mgmt.botservice.models.ConnectionSettingProperties + :ivar sku: Gets or sets the SKU of the resource. + :vartype sku: ~azure.mgmt.botservice.models.Sku + :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", + "designer", "bot", "function", and "azurebot". + :vartype kind: str or ~azure.mgmt.botservice.models.Kind + :ivar etag: Entity Tag. + :vartype etag: str + :ivar zones: Entity zones. + :vartype zones: list[str] + """ + + properties: Optional["_models.ConnectionSettingProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to bot channel resource.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Gets or sets the SKU of the resource.""" + kind: Optional[Union[str, "_models.Kind"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required. Gets or sets the Kind of the resource. Known values are: \"sdk\", \"designer\", + \"bot\", \"function\", and \"azurebot\".""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Entity Tag.""" + zones: Optional[List[str]] = rest_field(visibility=["read"]) + """Entity zones.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ConnectionSettingProperties"] = None, + sku: Optional["_models.Sku"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, + etag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConnectionSettingParameter(_Model): + """Extra Parameter in a Connection Setting Properties to indicate service provider specific + properties. + + :ivar key: Key for the Connection Setting Parameter. + :vartype key: str + :ivar value: Value associated with the Connection Setting Parameter. + :vartype value: str + """ + + key: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Key for the Connection Setting Parameter.""" + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Value associated with the Connection Setting Parameter.""" + + @overload + def __init__( + self, + *, + key: Optional[str] = None, + value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConnectionSettingProperties(_Model): + """Properties for a Connection Setting Item. + + :ivar id: Id of the Connection Setting. + :vartype id: str + :ivar name: Name of the Connection Setting. + :vartype name: str + :ivar client_id: Client Id associated with the Connection Setting. + :vartype client_id: str + :ivar setting_id: Setting Id set by the service for the Connection Setting. + :vartype setting_id: str + :ivar client_secret: Client Secret associated with the Connection Setting. + :vartype client_secret: str + :ivar scopes: Scopes associated with the Connection Setting. + :vartype scopes: str + :ivar service_provider_id: Service Provider Id associated with the Connection Setting. + :vartype service_provider_id: str + :ivar service_provider_display_name: Service Provider Display Name associated with the + Connection Setting. + :vartype service_provider_display_name: str + :ivar parameters: Service Provider Parameters associated with the Connection Setting. + :vartype parameters: list[~azure.mgmt.botservice.models.ConnectionSettingParameter] + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Id of the Connection Setting.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Connection Setting.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read", "create", "update", "delete", "query"]) + """Client Id associated with the Connection Setting.""" + setting_id: Optional[str] = rest_field(name="settingId", visibility=["read"]) + """Setting Id set by the service for the Connection Setting.""" + client_secret: Optional[str] = rest_field( + name="clientSecret", visibility=["read", "create", "update", "delete", "query"] + ) + """Client Secret associated with the Connection Setting.""" + scopes: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Scopes associated with the Connection Setting.""" + service_provider_id: Optional[str] = rest_field( + name="serviceProviderId", visibility=["read", "create", "update", "delete", "query"] + ) + """Service Provider Id associated with the Connection Setting.""" + service_provider_display_name: Optional[str] = rest_field( + name="serviceProviderDisplayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Service Provider Display Name associated with the Connection Setting.""" + parameters: Optional[List["_models.ConnectionSettingParameter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Service Provider Parameters associated with the Connection Setting.""" + provisioning_state: Optional[str] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """Provisioning state of the resource.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + scopes: Optional[str] = None, + service_provider_id: Optional[str] = None, + service_provider_display_name: Optional[str] = None, + parameters: Optional[List["_models.ConnectionSettingParameter"]] = None, + provisioning_state: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CreateEmailSignInUrlResponse(_Model): + """The ARM create email sign in url operation response. + + :ivar id: Specifies the resource ID. + :vartype id: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to sign in url. + :vartype properties: ~azure.mgmt.botservice.models.CreateEmailSignInUrlResponseProperties + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Specifies the resource ID.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the location of the resource.""" + properties: Optional["_models.CreateEmailSignInUrlResponseProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to sign in url.""" + + @overload + def __init__( + self, + *, + location: Optional[str] = None, + properties: Optional["_models.CreateEmailSignInUrlResponseProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CreateEmailSignInUrlResponseProperties(_Model): + """The set of properties specific to sign in url. + + :ivar url: Sign in url. + :vartype url: str + """ + + url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Sign in url.""" + + @overload + def __init__( + self, + *, + url: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DirectLineChannel(Channel, discriminator="DirectLineChannel"): + """Direct Line channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to Direct Line channel resource. + :vartype properties: ~azure.mgmt.botservice.models.DirectLineChannelProperties + :ivar channel_name: The channel name. Required. Default value is "DirectLineChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.DirectLineChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to Direct Line channel resource.""" + channel_name: Literal["DirectLineChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"DirectLineChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.DirectLineChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="DirectLineChannel", **kwargs) + + +class DirectLineChannelProperties(_Model): + """The parameters to provide for the Direct Line channel. + + :ivar sites: The list of Direct Line sites. + :vartype sites: list[~azure.mgmt.botservice.models.DirectLineSite] + :ivar extension_key1: The extensionKey1. + :vartype extension_key1: str + :ivar extension_key2: The extensionKey2. + :vartype extension_key2: str + :ivar direct_line_embed_code: Direct Line embed code of the resource. + :vartype direct_line_embed_code: str + """ + + sites: Optional[List["_models.DirectLineSite"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of Direct Line sites.""" + extension_key1: Optional[str] = rest_field( + name="extensionKey1", visibility=["read", "create", "update", "delete", "query"] + ) + """The extensionKey1.""" + extension_key2: Optional[str] = rest_field( + name="extensionKey2", visibility=["read", "create", "update", "delete", "query"] + ) + """The extensionKey2.""" + direct_line_embed_code: Optional[str] = rest_field( + name="DirectLineEmbedCode", visibility=["read", "create", "update", "delete", "query"] + ) + """Direct Line embed code of the resource.""" + + @overload + def __init__( + self, + *, + sites: Optional[List["_models.DirectLineSite"]] = None, + extension_key1: Optional[str] = None, + extension_key2: Optional[str] = None, + direct_line_embed_code: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Site(_Model): + """A site for the channel. + + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :ivar site_id: Site Id. + :vartype site_id: str + :ivar site_name: Site name. Required. + :vartype site_name: str + :ivar key: Primary key. Value only returned through POST to the action Channel List API, + otherwise empty. + :vartype key: str + :ivar key2: Secondary key. Value only returned through POST to the action Channel List API, + otherwise empty. + :vartype key2: str + :ivar is_enabled: Whether this site is enabled for DirectLine channel. Required. + :vartype is_enabled: bool + :ivar is_token_enabled: Whether this site is token enabled for channel. + :vartype is_token_enabled: bool + :ivar is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for + channel. + :vartype is_endpoint_parameters_enabled: bool + :ivar is_detailed_logging_enabled: Whether this site is disabled detailed logging for. + :vartype is_detailed_logging_enabled: bool + :ivar is_block_user_upload_enabled: Whether this site is enabled for block user upload. + :vartype is_block_user_upload_enabled: bool + :ivar is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. + :vartype is_no_storage_enabled: bool + :ivar e_tag: Entity Tag. + :vartype e_tag: str + :ivar app_id: DirectLine application id. + :vartype app_id: str + :ivar is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. + :vartype is_v1_enabled: bool + :ivar is_v3_enabled: Whether this site is enabled for Bot Framework V3 protocol. + :vartype is_v3_enabled: bool + :ivar is_secure_site_enabled: Whether this site is enabled for authentication with Bot + Framework. + :vartype is_secure_site_enabled: bool + :ivar trusted_origins: List of Trusted Origin URLs for this site. This field is applicable only + if isSecureSiteEnabled is True. + :vartype trusted_origins: list[str] + :ivar is_web_chat_speech_enabled: Whether this site is enabled for Webchat Speech. + :vartype is_web_chat_speech_enabled: bool + :ivar is_webchat_preview_enabled: Whether this site is enabled for preview versions of Webchat. + :vartype is_webchat_preview_enabled: bool + """ + + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """Tenant Id.""" + site_id: Optional[str] = rest_field(name="siteId", visibility=["read"]) + """Site Id.""" + site_name: str = rest_field(name="siteName", visibility=["read", "create"]) + """Site name. Required.""" + key: Optional[str] = rest_field(visibility=["read"]) + """Primary key. Value only returned through POST to the action Channel List API, otherwise empty.""" + key2: Optional[str] = rest_field(visibility=["read"]) + """Secondary key. Value only returned through POST to the action Channel List API, otherwise + empty.""" + is_enabled: bool = rest_field(name="isEnabled", visibility=["read", "create", "update", "delete", "query"]) + """Whether this site is enabled for DirectLine channel. Required.""" + is_token_enabled: Optional[bool] = rest_field(name="isTokenEnabled", visibility=["read"]) + """Whether this site is token enabled for channel.""" + is_endpoint_parameters_enabled: Optional[bool] = rest_field( + name="isEndpointParametersEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this site is EndpointParameters enabled for channel.""" + is_detailed_logging_enabled: Optional[bool] = rest_field( + name="isDetailedLoggingEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this site is disabled detailed logging for.""" + is_block_user_upload_enabled: Optional[bool] = rest_field( + name="isBlockUserUploadEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this site is enabled for block user upload.""" + is_no_storage_enabled: Optional[bool] = rest_field( + name="isNoStorageEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this no-storage site is disabled detailed logging for.""" + e_tag: Optional[str] = rest_field(name="eTag", visibility=["read", "create", "update", "delete", "query"]) + """Entity Tag.""" + app_id: Optional[str] = rest_field(name="appId", visibility=["read", "create", "update", "delete", "query"]) + """DirectLine application id.""" + is_v1_enabled: Optional[bool] = rest_field(name="isV1Enabled", visibility=["read", "create"]) + """Whether this site is enabled for Bot Framework V1 protocol.""" + is_v3_enabled: Optional[bool] = rest_field( + name="isV3Enabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this site is enabled for Bot Framework V3 protocol.""" + is_secure_site_enabled: Optional[bool] = rest_field( + name="isSecureSiteEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this site is enabled for authentication with Bot Framework.""" + trusted_origins: Optional[List[str]] = rest_field( + name="trustedOrigins", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Trusted Origin URLs for this site. This field is applicable only if isSecureSiteEnabled + is True.""" + is_web_chat_speech_enabled: Optional[bool] = rest_field( + name="isWebChatSpeechEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this site is enabled for Webchat Speech.""" + is_webchat_preview_enabled: Optional[bool] = rest_field( + name="isWebchatPreviewEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this site is enabled for preview versions of Webchat.""" + + @overload + def __init__( + self, + *, + site_name: str, + is_enabled: bool, + tenant_id: Optional[str] = None, + is_endpoint_parameters_enabled: Optional[bool] = None, + is_detailed_logging_enabled: Optional[bool] = None, + is_block_user_upload_enabled: Optional[bool] = None, + is_no_storage_enabled: Optional[bool] = None, + e_tag: Optional[str] = None, + app_id: Optional[str] = None, + is_v1_enabled: Optional[bool] = None, + is_v3_enabled: Optional[bool] = None, + is_secure_site_enabled: Optional[bool] = None, + trusted_origins: Optional[List[str]] = None, + is_web_chat_speech_enabled: Optional[bool] = None, + is_webchat_preview_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DirectLineSite(Site): + """A site for the Direct Line channel. + + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :ivar site_id: Site Id. + :vartype site_id: str + :ivar site_name: Site name. Required. + :vartype site_name: str + :ivar key: Primary key. Value only returned through POST to the action Channel List API, + otherwise empty. + :vartype key: str + :ivar key2: Secondary key. Value only returned through POST to the action Channel List API, + otherwise empty. + :vartype key2: str + :ivar is_enabled: Whether this site is enabled for DirectLine channel. Required. + :vartype is_enabled: bool + :ivar is_token_enabled: Whether this site is token enabled for channel. + :vartype is_token_enabled: bool + :ivar is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for + channel. + :vartype is_endpoint_parameters_enabled: bool + :ivar is_detailed_logging_enabled: Whether this site is disabled detailed logging for. + :vartype is_detailed_logging_enabled: bool + :ivar is_block_user_upload_enabled: Whether this site is enabled for block user upload. + :vartype is_block_user_upload_enabled: bool + :ivar is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. + :vartype is_no_storage_enabled: bool + :ivar e_tag: Entity Tag. + :vartype e_tag: str + :ivar app_id: DirectLine application id. + :vartype app_id: str + :ivar is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. + :vartype is_v1_enabled: bool + :ivar is_v3_enabled: Whether this site is enabled for Bot Framework V3 protocol. + :vartype is_v3_enabled: bool + :ivar is_secure_site_enabled: Whether this site is enabled for authentication with Bot + Framework. + :vartype is_secure_site_enabled: bool + :ivar trusted_origins: List of Trusted Origin URLs for this site. This field is applicable only + if isSecureSiteEnabled is True. + :vartype trusted_origins: list[str] + :ivar is_web_chat_speech_enabled: Whether this site is enabled for Webchat Speech. + :vartype is_web_chat_speech_enabled: bool + :ivar is_webchat_preview_enabled: Whether this site is enabled for preview versions of Webchat. + :vartype is_webchat_preview_enabled: bool + """ + + @overload + def __init__( + self, + *, + site_name: str, + is_enabled: bool, + tenant_id: Optional[str] = None, + is_endpoint_parameters_enabled: Optional[bool] = None, + is_detailed_logging_enabled: Optional[bool] = None, + is_block_user_upload_enabled: Optional[bool] = None, + is_no_storage_enabled: Optional[bool] = None, + e_tag: Optional[str] = None, + app_id: Optional[str] = None, + is_v1_enabled: Optional[bool] = None, + is_v3_enabled: Optional[bool] = None, + is_secure_site_enabled: Optional[bool] = None, + trusted_origins: Optional[List[str]] = None, + is_web_chat_speech_enabled: Optional[bool] = None, + is_webchat_preview_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DirectLineSpeechChannel(Channel, discriminator="DirectLineSpeechChannel"): + """DirectLine Speech channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to DirectLine Speech channel resource. + :vartype properties: ~azure.mgmt.botservice.models.DirectLineSpeechChannelProperties + :ivar channel_name: The channel name. Required. Default value is "DirectLineSpeechChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.DirectLineSpeechChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to DirectLine Speech channel resource.""" + channel_name: Literal["DirectLineSpeechChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"DirectLineSpeechChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.DirectLineSpeechChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="DirectLineSpeechChannel", **kwargs) + + +class DirectLineSpeechChannelProperties(_Model): + """The parameters to provide for the DirectLine Speech channel. + + :ivar cognitive_service_resource_id: The cognitive service id with this channel registration. + :vartype cognitive_service_resource_id: str + :ivar cognitive_service_region: The cognitive service region with this channel registration. + :vartype cognitive_service_region: str + :ivar cognitive_service_subscription_key: The cognitive service subscription key to use with + this channel registration. + :vartype cognitive_service_subscription_key: str + :ivar is_enabled: Whether this channel is enabled or not. + :vartype is_enabled: bool + :ivar custom_voice_deployment_id: Custom speech model id (optional). + :vartype custom_voice_deployment_id: str + :ivar custom_speech_model_id: Custom voice deployment id (optional). + :vartype custom_speech_model_id: str + :ivar is_default_bot_for_cog_svc_account: Make this a default bot for chosen cognitive service + account. + :vartype is_default_bot_for_cog_svc_account: bool + """ + + cognitive_service_resource_id: Optional[str] = rest_field( + name="cognitiveServiceResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The cognitive service id with this channel registration.""" + cognitive_service_region: Optional[str] = rest_field( + name="cognitiveServiceRegion", visibility=["read", "create", "update", "delete", "query"] + ) + """The cognitive service region with this channel registration.""" + cognitive_service_subscription_key: Optional[str] = rest_field( + name="cognitiveServiceSubscriptionKey", visibility=["read", "create", "update", "delete", "query"] + ) + """The cognitive service subscription key to use with this channel registration.""" + is_enabled: Optional[bool] = rest_field( + name="isEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this channel is enabled or not.""" + custom_voice_deployment_id: Optional[str] = rest_field( + name="customVoiceDeploymentId", visibility=["read", "create", "update", "delete", "query"] + ) + """Custom speech model id (optional).""" + custom_speech_model_id: Optional[str] = rest_field( + name="customSpeechModelId", visibility=["read", "create", "update", "delete", "query"] + ) + """Custom voice deployment id (optional).""" + is_default_bot_for_cog_svc_account: Optional[bool] = rest_field( + name="isDefaultBotForCogSvcAccount", visibility=["read", "create", "update", "delete", "query"] + ) + """Make this a default bot for chosen cognitive service account.""" + + @overload + def __init__( + self, + *, + cognitive_service_resource_id: Optional[str] = None, + cognitive_service_region: Optional[str] = None, + cognitive_service_subscription_key: Optional[str] = None, + is_enabled: Optional[bool] = None, + custom_voice_deployment_id: Optional[str] = None, + custom_speech_model_id: Optional[str] = None, + is_default_bot_for_cog_svc_account: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EmailChannel(Channel, discriminator="EmailChannel"): + """Email channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to email channel resource. + :vartype properties: ~azure.mgmt.botservice.models.EmailChannelProperties + :ivar channel_name: The channel name. Required. Default value is "EmailChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.EmailChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to email channel resource.""" + channel_name: Literal["EmailChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"EmailChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.EmailChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="EmailChannel", **kwargs) + + +class EmailChannelProperties(_Model): + """The parameters to provide for the Email channel. + + :ivar email_address: The email address. Required. + :vartype email_address: str + :ivar auth_method: Email channel auth method. 0 Password (Default); 1 Graph. Known values are: + 0 and 1. + :vartype auth_method: int or ~azure.mgmt.botservice.models.EmailChannelAuthMethod + :ivar password: The password for the email address. Value only returned through POST to the + action Channel List API, otherwise empty. + :vartype password: str + :ivar magic_code: The magic code for setting up the modern authentication. + :vartype magic_code: str + :ivar is_enabled: Whether this channel is enabled for the bot. Required. + :vartype is_enabled: bool + """ + + email_address: str = rest_field(name="emailAddress", visibility=["read", "create", "update", "delete", "query"]) + """The email address. Required.""" + auth_method: Optional[Union[int, "_models.EmailChannelAuthMethod"]] = rest_field( + name="authMethod", visibility=["read", "create", "update", "delete", "query"] + ) + """Email channel auth method. 0 Password (Default); 1 Graph. Known values are: 0 and 1.""" + password: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The password for the email address. Value only returned through POST to the action Channel List + API, otherwise empty.""" + magic_code: Optional[str] = rest_field(name="magicCode", visibility=["read", "create", "update", "delete", "query"]) + """The magic code for setting up the modern authentication.""" + is_enabled: bool = rest_field(name="isEnabled", visibility=["read", "create", "update", "delete", "query"]) + """Whether this channel is enabled for the bot. Required.""" + + @overload + def __init__( + self, + *, + email_address: str, + is_enabled: bool, + auth_method: Optional[Union[int, "_models.EmailChannelAuthMethod"]] = None, + password: Optional[str] = None, + magic_code: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Error(_Model): + """Bot Service error object. + + :ivar error: The error body. + :vartype error: ~azure.mgmt.botservice.models.ErrorBody + """ + + error: Optional["_models.ErrorBody"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error body.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorBody"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorBody(_Model): + """Bot Service error body. + + :ivar code: error code. Required. + :vartype code: str + :ivar message: error message. Required. + :vartype message: str + """ + + code: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """error code. Required.""" + message: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """error message. Required.""" + + @overload + def __init__( + self, + *, + code: str, + message: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FacebookChannel(Channel, discriminator="FacebookChannel"): + """Facebook channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to bot facebook channel. + :vartype properties: ~azure.mgmt.botservice.models.FacebookChannelProperties + :ivar channel_name: The channel name. Required. Default value is "FacebookChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.FacebookChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to bot facebook channel.""" + channel_name: Literal["FacebookChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"FacebookChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.FacebookChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="FacebookChannel", **kwargs) + + +class FacebookChannelProperties(_Model): + """The parameters to provide for the Facebook channel. + + :ivar verify_token: Verify token. Value only returned through POST to the action Channel List + API, otherwise empty. + :vartype verify_token: str + :ivar pages: The list of Facebook pages. + :vartype pages: list[~azure.mgmt.botservice.models.FacebookPage] + :ivar app_id: Facebook application id. Required. + :vartype app_id: str + :ivar app_secret: Facebook application secret. Value only returned through POST to the action + Channel List API, otherwise empty. + :vartype app_secret: str + :ivar callback_url: Callback Url. + :vartype callback_url: str + :ivar is_enabled: Whether this channel is enabled for the bot. Required. + :vartype is_enabled: bool + """ + + verify_token: Optional[str] = rest_field(name="verifyToken", visibility=["read"]) + """Verify token. Value only returned through POST to the action Channel List API, otherwise empty.""" + pages: Optional[List["_models.FacebookPage"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of Facebook pages.""" + app_id: str = rest_field(name="appId", visibility=["read", "create", "update", "delete", "query"]) + """Facebook application id. Required.""" + app_secret: Optional[str] = rest_field(name="appSecret", visibility=["read", "create", "update", "delete", "query"]) + """Facebook application secret. Value only returned through POST to the action Channel List API, + otherwise empty.""" + callback_url: Optional[str] = rest_field(name="callbackUrl", visibility=["read"]) + """Callback Url.""" + is_enabled: bool = rest_field(name="isEnabled", visibility=["read", "create", "update", "delete", "query"]) + """Whether this channel is enabled for the bot. Required.""" + + @overload + def __init__( + self, + *, + app_id: str, + is_enabled: bool, + pages: Optional[List["_models.FacebookPage"]] = None, + app_secret: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FacebookPage(_Model): + """A Facebook page for Facebook channel registration. + + :ivar id: Page id. Required. + :vartype id: str + :ivar access_token: Facebook application access token. Value only returned through POST to the + action Channel List API, otherwise empty. + :vartype access_token: str + """ + + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Page id. Required.""" + access_token: Optional[str] = rest_field( + name="accessToken", visibility=["read", "create", "update", "delete", "query"] + ) + """Facebook application access token. Value only returned through POST to the action Channel List + API, otherwise empty.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + access_token: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HostSettingsResponse(_Model): + """The response body returned for a request to Bot Service Management to check per subscription + hostSettings. + + :ivar o_auth_url: For in-conversation bot user authentication. + :vartype o_auth_url: str + :ivar to_bot_from_channel_open_id_metadata_url: For verifying incoming tokens from the + channels. + :vartype to_bot_from_channel_open_id_metadata_url: str + :ivar to_bot_from_channel_token_issuer: For verifying incoming tokens from the channels. + :vartype to_bot_from_channel_token_issuer: str + :ivar to_bot_from_emulator_open_id_metadata_url: For verifying incoming tokens from bot + emulator. + :vartype to_bot_from_emulator_open_id_metadata_url: str + :ivar to_channel_from_bot_login_url: For getting access token to channels from bot host. + :vartype to_channel_from_bot_login_url: str + :ivar to_channel_from_bot_o_auth_scope: For getting access token to channels from bot host. + :vartype to_channel_from_bot_o_auth_scope: str + :ivar validate_authority: Per cloud OAuth setting on whether authority is validated. + :vartype validate_authority: bool + :ivar bot_open_id_metadata: Same as toBotFromChannelOpenIdMetadataUrl, used by SDK < v4.12. + :vartype bot_open_id_metadata: str + """ + + o_auth_url: Optional[str] = rest_field(name="OAuthUrl", visibility=["read", "create", "update", "delete", "query"]) + """For in-conversation bot user authentication.""" + to_bot_from_channel_open_id_metadata_url: Optional[str] = rest_field( + name="ToBotFromChannelOpenIdMetadataUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """For verifying incoming tokens from the channels.""" + to_bot_from_channel_token_issuer: Optional[str] = rest_field( + name="ToBotFromChannelTokenIssuer", visibility=["read", "create", "update", "delete", "query"] + ) + """For verifying incoming tokens from the channels.""" + to_bot_from_emulator_open_id_metadata_url: Optional[str] = rest_field( + name="ToBotFromEmulatorOpenIdMetadataUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """For verifying incoming tokens from bot emulator.""" + to_channel_from_bot_login_url: Optional[str] = rest_field( + name="ToChannelFromBotLoginUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """For getting access token to channels from bot host.""" + to_channel_from_bot_o_auth_scope: Optional[str] = rest_field( + name="ToChannelFromBotOAuthScope", visibility=["read", "create", "update", "delete", "query"] + ) + """For getting access token to channels from bot host.""" + validate_authority: Optional[bool] = rest_field( + name="ValidateAuthority", visibility=["read", "create", "update", "delete", "query"] + ) + """Per cloud OAuth setting on whether authority is validated.""" + bot_open_id_metadata: Optional[str] = rest_field( + name="BotOpenIdMetadata", visibility=["read", "create", "update", "delete", "query"] + ) + """Same as toBotFromChannelOpenIdMetadataUrl, used by SDK < v4.12.""" + + @overload + def __init__( + self, + *, + o_auth_url: Optional[str] = None, + to_bot_from_channel_open_id_metadata_url: Optional[str] = None, + to_bot_from_channel_token_issuer: Optional[str] = None, + to_bot_from_emulator_open_id_metadata_url: Optional[str] = None, + to_channel_from_bot_login_url: Optional[str] = None, + to_channel_from_bot_o_auth_scope: Optional[str] = None, + validate_authority: Optional[bool] = None, + bot_open_id_metadata: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KikChannel(Channel, discriminator="KikChannel"): + """Kik channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to Kik channel resource. + :vartype properties: ~azure.mgmt.botservice.models.KikChannelProperties + :ivar channel_name: The channel name. Required. Default value is "KikChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.KikChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to Kik channel resource.""" + channel_name: Literal["KikChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"KikChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.KikChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="KikChannel", **kwargs) + + +class KikChannelProperties(_Model): + """The parameters to provide for the Kik channel. + + :ivar user_name: The Kik user name. Required. + :vartype user_name: str + :ivar api_key: Kik API key. Value only returned through POST to the action Channel List API, + otherwise empty. + :vartype api_key: str + :ivar is_validated: Whether this channel is validated for the bot. + :vartype is_validated: bool + :ivar is_enabled: Whether this channel is enabled for the bot. Required. + :vartype is_enabled: bool + """ + + user_name: str = rest_field(name="userName", visibility=["read", "create", "update", "delete", "query"]) + """The Kik user name. Required.""" + api_key: Optional[str] = rest_field(name="apiKey", visibility=["read", "create", "update", "delete", "query"]) + """Kik API key. Value only returned through POST to the action Channel List API, otherwise empty.""" + is_validated: Optional[bool] = rest_field( + name="isValidated", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this channel is validated for the bot.""" + is_enabled: bool = rest_field(name="isEnabled", visibility=["read", "create", "update", "delete", "query"]) + """Whether this channel is enabled for the bot. Required.""" + + @overload + def __init__( + self, + *, + user_name: str, + is_enabled: bool, + api_key: Optional[str] = None, + is_validated: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LineChannel(Channel, discriminator="LineChannel"): + """Line channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to line channel resource. + :vartype properties: ~azure.mgmt.botservice.models.LineChannelProperties + :ivar channel_name: The channel name. Required. Default value is "LineChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.LineChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to line channel resource.""" + channel_name: Literal["LineChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"LineChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.LineChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="LineChannel", **kwargs) + + +class LineChannelProperties(_Model): + """The parameters to provide for the Line channel. + + :ivar line_registrations: The list of line channel registrations. Required. + :vartype line_registrations: list[~azure.mgmt.botservice.models.LineRegistration] + :ivar callback_url: Callback Url to enter in line registration. + :vartype callback_url: str + :ivar is_validated: Whether this channel is validated for the bot. + :vartype is_validated: bool + """ + + line_registrations: List["_models.LineRegistration"] = rest_field( + name="lineRegistrations", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of line channel registrations. Required.""" + callback_url: Optional[str] = rest_field(name="callbackUrl", visibility=["read"]) + """Callback Url to enter in line registration.""" + is_validated: Optional[bool] = rest_field(name="isValidated", visibility=["read"]) + """Whether this channel is validated for the bot.""" + + @overload + def __init__( + self, + *, + line_registrations: List["_models.LineRegistration"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LineRegistration(_Model): + """The properties corresponding to a line channel registration. + + :ivar generated_id: Id generated for the line channel registration. + :vartype generated_id: str + :ivar channel_secret: Secret for the line channel registration. + :vartype channel_secret: str + :ivar channel_access_token: Access token for the line channel registration. + :vartype channel_access_token: str + """ + + generated_id: Optional[str] = rest_field(name="generatedId", visibility=["read"]) + """Id generated for the line channel registration.""" + channel_secret: Optional[str] = rest_field( + name="channelSecret", visibility=["read", "create", "update", "delete", "query"] + ) + """Secret for the line channel registration.""" + channel_access_token: Optional[str] = rest_field( + name="channelAccessToken", visibility=["read", "create", "update", "delete", "query"] + ) + """Access token for the line channel registration.""" + + @overload + def __init__( + self, + *, + channel_secret: Optional[str] = None, + channel_access_token: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ListChannelWithKeysResponse(BotChannel): + """The ARM channel of list channel with keys operation response. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.botservice.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The set of properties specific to bot channel resource. + :vartype properties: ~azure.mgmt.botservice.models.Channel + :ivar sku: Gets or sets the SKU of the resource. + :vartype sku: ~azure.mgmt.botservice.models.Sku + :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", + "designer", "bot", "function", and "azurebot". + :vartype kind: str or ~azure.mgmt.botservice.models.Kind + :ivar etag: Entity Tag. + :vartype etag: str + :ivar zones: Entity zones. + :vartype zones: list[str] + :ivar resource: The set of properties specific to bot channel resource. + :vartype resource: ~azure.mgmt.botservice.models.Channel + :ivar setting: Channel settings. + :vartype setting: ~azure.mgmt.botservice.models.ChannelSettings + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar entity_tag: Entity tag of the resource. + :vartype entity_tag: str + :ivar changed_time: Changed time of the resource. + :vartype changed_time: str + """ + + resource: Optional["_models.Channel"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The set of properties specific to bot channel resource.""" + setting: Optional["_models.ChannelSettings"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Channel settings.""" + provisioning_state: Optional[str] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """Provisioning state of the resource.""" + entity_tag: Optional[str] = rest_field(name="entityTag", visibility=["read", "create", "update", "delete", "query"]) + """Entity tag of the resource.""" + changed_time: Optional[str] = rest_field( + name="changedTime", visibility=["read", "create", "update", "delete", "query"] + ) + """Changed time of the resource.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.Channel"] = None, + sku: Optional["_models.Sku"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, + etag: Optional[str] = None, + resource: Optional["_models.Channel"] = None, + setting: Optional["_models.ChannelSettings"] = None, + provisioning_state: Optional[str] = None, + entity_tag: Optional[str] = None, + changed_time: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class M365Extensions(Channel, discriminator="M365Extensions"): + """M365 Extensions definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar channel_name: The channel name. Required. Default value is "M365Extensions". + :vartype channel_name: str + """ + + channel_name: Literal["M365Extensions"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"M365Extensions\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="M365Extensions", **kwargs) + + +class MsTeamsChannel(Channel, discriminator="MsTeamsChannel"): + """Microsoft Teams channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to Microsoft Teams channel resource. + :vartype properties: ~azure.mgmt.botservice.models.MsTeamsChannelProperties + :ivar channel_name: The channel name. Required. Default value is "MsTeamsChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.MsTeamsChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to Microsoft Teams channel resource.""" + channel_name: Literal["MsTeamsChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"MsTeamsChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.MsTeamsChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="MsTeamsChannel", **kwargs) + + +class MsTeamsChannelProperties(_Model): + """The parameters to provide for the Microsoft Teams channel. + + :ivar enable_calling: Enable calling for Microsoft Teams channel. + :vartype enable_calling: bool + :ivar calling_webhook: Webhook for Microsoft Teams channel calls. + :vartype calling_webhook: str + :ivar is_enabled: Whether this channel is enabled for the bot. Required. + :vartype is_enabled: bool + :ivar incoming_call_route: Webhook for Microsoft Teams channel calls. + :vartype incoming_call_route: str + :ivar deployment_environment: Deployment environment for Microsoft Teams channel calls. + :vartype deployment_environment: str + :ivar accepted_terms: Whether this channel accepted terms. + :vartype accepted_terms: bool + """ + + enable_calling: Optional[bool] = rest_field( + name="enableCalling", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable calling for Microsoft Teams channel.""" + calling_webhook: Optional[str] = rest_field( + name="callingWebhook", visibility=["read", "create", "update", "delete", "query"] + ) + """Webhook for Microsoft Teams channel calls.""" + is_enabled: bool = rest_field(name="isEnabled", visibility=["read", "create", "update", "delete", "query"]) + """Whether this channel is enabled for the bot. Required.""" + incoming_call_route: Optional[str] = rest_field( + name="incomingCallRoute", visibility=["read", "create", "update", "delete", "query"] + ) + """Webhook for Microsoft Teams channel calls.""" + deployment_environment: Optional[str] = rest_field( + name="deploymentEnvironment", visibility=["read", "create", "update", "delete", "query"] + ) + """Deployment environment for Microsoft Teams channel calls.""" + accepted_terms: Optional[bool] = rest_field( + name="acceptedTerms", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this channel accepted terms.""" + + @overload + def __init__( + self, + *, + is_enabled: bool, + enable_calling: Optional[bool] = None, + calling_webhook: Optional[str] = None, + incoming_call_route: Optional[str] = None, + deployment_environment: Optional[str] = None, + accepted_terms: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkSecurityPerimeter(_Model): + """Information about Network Security Perimeter. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar perimeter_guid: Guid of the Network Security Perimeter. + :vartype perimeter_guid: str + :ivar location: Location of the Network Security Perimeter. + :vartype location: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. E.g. + \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}\".""" + perimeter_guid: Optional[str] = rest_field( + name="perimeterGuid", visibility=["read", "create", "update", "delete", "query"] + ) + """Guid of the Network Security Perimeter.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Location of the Network Security Perimeter.""" + + @overload + def __init__( + self, + *, + perimeter_guid: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.botservice.models.SystemData + """ + + +class NetworkSecurityPerimeterConfiguration(ProxyResource): + """Network Security Perimeter configuration. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.botservice.models.SystemData + :ivar properties: Properties of the Network Security Perimeter configuration. + :vartype properties: + ~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfigurationProperties + """ + + properties: Optional["_models.NetworkSecurityPerimeterConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the Network Security Perimeter configuration.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.NetworkSecurityPerimeterConfigurationProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkSecurityPerimeterConfigurationProperties(_Model): # pylint: disable=name-too-long + """Properties of Network Security Perimeter configuration. + + :ivar provisioning_state: Known values are: "Creating", "Updating", "Accepted", "Succeeded", + "Failed", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.botservice.models.ProvisioningState + :ivar provisioning_issues: List of Provisioning Issues if any. + :vartype provisioning_issues: list[~azure.mgmt.botservice.models.ProvisioningIssue] + :ivar network_security_perimeter: Information about Network Security Perimeter. + :vartype network_security_perimeter: ~azure.mgmt.botservice.models.NetworkSecurityPerimeter + :ivar resource_association: Information about resource association. + :vartype resource_association: ~azure.mgmt.botservice.models.ResourceAssociation + :ivar profile: Information about profile. + :vartype profile: ~azure.mgmt.botservice.models.Profile + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """Known values are: \"Creating\", \"Updating\", \"Accepted\", \"Succeeded\", \"Failed\", and + \"Deleting\".""" + provisioning_issues: Optional[List["_models.ProvisioningIssue"]] = rest_field( + name="provisioningIssues", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Provisioning Issues if any.""" + network_security_perimeter: Optional["_models.NetworkSecurityPerimeter"] = rest_field( + name="networkSecurityPerimeter", visibility=["read"] + ) + """Information about Network Security Perimeter.""" + resource_association: Optional["_models.ResourceAssociation"] = rest_field( + name="resourceAssociation", visibility=["read"] + ) + """Information about resource association.""" + profile: Optional["_models.Profile"] = rest_field(visibility=["read"]) + """Information about profile.""" + + @overload + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, + provisioning_issues: Optional[List["_models.ProvisioningIssue"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NspAccessRule(_Model): + """Information of Access Rule in a profile. + + :ivar name: Name of the access rule. + :vartype name: str + :ivar properties: Properties of Access Rule. + :vartype properties: ~azure.mgmt.botservice.models.NspAccessRuleProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the access rule.""" + properties: Optional["_models.NspAccessRuleProperties"] = rest_field(visibility=["read"]) + """Properties of Access Rule.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NspAccessRuleProperties(_Model): + """Properties of Access Rule. + + :ivar direction: Direction of Access Rule. Known values are: "Inbound" and "Outbound". + :vartype direction: str or ~azure.mgmt.botservice.models.NspAccessRuleDirection + :ivar address_prefixes: Address prefixes in the CIDR format for inbound rules. + :vartype address_prefixes: list[str] + :ivar subscriptions: Subscriptions for inbound rules. + :vartype subscriptions: + list[~azure.mgmt.botservice.models.NspAccessRulePropertiesSubscriptionsItem] + :ivar network_security_perimeters: NetworkSecurityPerimeters for inbound rules. + :vartype network_security_perimeters: + list[~azure.mgmt.botservice.models.NetworkSecurityPerimeter] + :ivar fully_qualified_domain_names: FQDN for outbound rules. + :vartype fully_qualified_domain_names: list[str] + :ivar email_addresses: Email addresses for outbound rules. + :vartype email_addresses: list[str] + :ivar phone_numbers: Phone numbers for outbound rules. + :vartype phone_numbers: list[str] + """ + + direction: Optional[Union[str, "_models.NspAccessRuleDirection"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Direction of Access Rule. Known values are: \"Inbound\" and \"Outbound\".""" + address_prefixes: Optional[List[str]] = rest_field( + name="addressPrefixes", visibility=["read", "create", "update", "delete", "query"] + ) + """Address prefixes in the CIDR format for inbound rules.""" + subscriptions: Optional[List["_models.NspAccessRulePropertiesSubscriptionsItem"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Subscriptions for inbound rules.""" + network_security_perimeters: Optional[List["_models.NetworkSecurityPerimeter"]] = rest_field( + name="networkSecurityPerimeters", visibility=["read"] + ) + """NetworkSecurityPerimeters for inbound rules.""" + fully_qualified_domain_names: Optional[List[str]] = rest_field( + name="fullyQualifiedDomainNames", visibility=["read"] + ) + """FQDN for outbound rules.""" + email_addresses: Optional[List[str]] = rest_field(name="emailAddresses", visibility=["read"]) + """Email addresses for outbound rules.""" + phone_numbers: Optional[List[str]] = rest_field(name="phoneNumbers", visibility=["read"]) + """Phone numbers for outbound rules.""" + + @overload + def __init__( + self, + *, + direction: Optional[Union[str, "_models.NspAccessRuleDirection"]] = None, + address_prefixes: Optional[List[str]] = None, + subscriptions: Optional[List["_models.NspAccessRulePropertiesSubscriptionsItem"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NspAccessRulePropertiesSubscriptionsItem(_Model): + """Subscription for inbound rule. + + :ivar id: Fully qualified identifier of subscription. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Fully qualified identifier of subscription.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Omnichannel(Channel, discriminator="Omnichannel"): + """Omnichannel channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar channel_name: The channel name. Required. Default value is "Omnichannel". + :vartype channel_name: str + """ + + channel_name: Literal["Omnichannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"Omnichannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="Omnichannel", **kwargs) + + +class OperationDisplayInfo(_Model): + """The operation supported by Bot Service Management. + + :ivar description: The description of the operation. + :vartype description: str + :ivar operation: The action that users can perform, based on their permission level. + :vartype operation: str + :ivar provider: Service provider: Microsoft Bot Service. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of the operation.""" + operation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The action that users can perform, based on their permission level.""" + provider: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Service provider: Microsoft Bot Service.""" + resource: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource on which the operation is performed.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + operation: Optional[str] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationEntity(_Model): + """The operations supported by Bot Service Management. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The operation supported by Bot Service Management. + :vartype display: ~azure.mgmt.botservice.models.OperationDisplayInfo + :ivar origin: The origin of the operation. + :vartype origin: str + :ivar properties: Additional properties. + :vartype properties: any + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation name: {provider}/{resource}/{operation}.""" + display: Optional["_models.OperationDisplayInfo"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The operation supported by Bot Service Management.""" + origin: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The origin of the operation.""" + properties: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Additional properties.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["_models.OperationDisplayInfo"] = None, + origin: Optional[str] = None, + properties: Optional[Any] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationResultsDescription(_Model): + """The properties indicating the operation result of an operation on a service. + + :ivar id: The ID of the operation returned. + :vartype id: str + :ivar name: The name of the operation result. + :vartype name: str + :ivar status: The status of the operation being performed. Known values are: "Canceled", + "Succeeded", "Failed", "Requested", and "Running". + :vartype status: str or ~azure.mgmt.botservice.models.OperationResultStatus + :ivar start_time: The time that the operation was started. + :vartype start_time: ~datetime.datetime + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The ID of the operation returned.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation result.""" + status: Optional[Union[str, "_models.OperationResultStatus"]] = rest_field(visibility=["read"]) + """The status of the operation being performed. Known values are: \"Canceled\", \"Succeeded\", + \"Failed\", \"Requested\", and \"Running\".""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """The time that the operation was started.""" + + +class OutlookChannel(Channel, discriminator="OutlookChannel"): + """Outlook channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar channel_name: The channel name. Required. Default value is "OutlookChannel". + :vartype channel_name: str + """ + + channel_name: Literal["OutlookChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"OutlookChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="OutlookChannel", **kwargs) + + +class PrivateEndpoint(_Model): + """The Private Endpoint resource. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The ARM identifier for Private Endpoint.""" + + +class PrivateEndpointConnection(ProxyResource): + """The Private Endpoint Connection resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.botservice.models.SystemData + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.botservice.models.PrivateEndpointConnectionProperties + """ + + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + + __flattened_items = ["private_endpoint", "private_link_service_connection_state", "provisioning_state", "group_ids"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PrivateEndpointConnectionProperties(_Model): + """Properties of the PrivateEndpointConnectProperties. + + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.botservice.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. Required. + :vartype private_link_service_connection_state: + ~azure.mgmt.botservice.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Known values are: "Succeeded", "Creating", "Deleting", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.botservice.models.PrivateEndpointConnectionProvisioningState + :ivar group_ids: Group ids. + :vartype group_ids: list[str] + """ + + private_endpoint: Optional["_models.PrivateEndpoint"] = rest_field( + name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource of private end point.""" + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState" = rest_field( + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """A collection of information about the state of the connection between service consumer and + provider. Required.""" + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the private endpoint connection resource. Known values are: + \"Succeeded\", \"Creating\", \"Deleting\", and \"Failed\".""" + group_ids: Optional[List[str]] = rest_field( + name="groupIds", visibility=["read", "create", "update", "delete", "query"] + ) + """Group ids.""" + + @overload + def __init__( + self, + *, + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + group_ids: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResourceBase(_Model): + """Common fields that are returned in the response for all BotService Private Link Resources. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + + +class PrivateLinkResource(PrivateLinkResourceBase): + """A private link resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.botservice.models.PrivateLinkResourceProperties + """ + + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + + __flattened_items = ["group_id", "required_members", "required_zone_names"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateLinkResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PrivateLinkResourceListResult(_Model): + """A list of private link resources. + + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.botservice.models.PrivateLinkResource] + """ + + value: Optional[List["_models.PrivateLinkResource"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Array of private link resources.""" + + @overload + def __init__( + self, + *, + value: Optional[List["_models.PrivateLinkResource"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResourceProperties(_Model): + """Properties of a private link resource. + + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] + """ + + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """The private link resource group id.""" + required_members: Optional[List[str]] = rest_field(name="requiredMembers", visibility=["read"]) + """The private link resource required member names.""" + required_zone_names: Optional[List[str]] = rest_field( + name="requiredZoneNames", visibility=["read", "create", "update", "delete", "query"] + ) + """The private link resource Private link DNS zone name.""" + + @overload + def __init__( + self, + *, + required_zone_names: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkServiceConnectionState(_Model): + """A collection of information about the state of the connection between service consumer and + provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", and "Rejected". + :vartype status: str or ~azure.mgmt.botservice.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + service. Known values are: \"Pending\", \"Approved\", and \"Rejected\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The reason for approval/rejection of the connection.""" + actions_required: Optional[str] = rest_field( + name="actionsRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A message indicating if changes on the service provider require any updates on the consumer.""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Profile(_Model): + """Information about profile. + + :ivar name: Name of the profile. + :vartype name: str + :ivar access_rules_version: Current access rules version. + :vartype access_rules_version: int + :ivar access_rules: List of Access Rules. + :vartype access_rules: list[~azure.mgmt.botservice.models.NspAccessRule] + :ivar diagnostic_settings_version: Current diagnostic settings version. + :vartype diagnostic_settings_version: int + :ivar enabled_log_categories: List of log categories. + :vartype enabled_log_categories: list[str] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the profile.""" + access_rules_version: Optional[int] = rest_field( + name="accessRulesVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Current access rules version.""" + access_rules: Optional[List["_models.NspAccessRule"]] = rest_field( + name="accessRules", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Access Rules.""" + diagnostic_settings_version: Optional[int] = rest_field( + name="diagnosticSettingsVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Current diagnostic settings version.""" + enabled_log_categories: Optional[List[str]] = rest_field(name="enabledLogCategories", visibility=["read"]) + """List of log categories.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + access_rules_version: Optional[int] = None, + access_rules: Optional[List["_models.NspAccessRule"]] = None, + diagnostic_settings_version: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProvisioningIssue(_Model): + """Describes Provisioning issue for given Network Security Perimeter configuration. + + :ivar name: Name of the issue. + :vartype name: str + :ivar properties: Properties of Provisioning Issue. + :vartype properties: ~azure.mgmt.botservice.models.ProvisioningIssueProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the issue.""" + properties: Optional["_models.ProvisioningIssueProperties"] = rest_field(visibility=["read"]) + """Properties of Provisioning Issue.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProvisioningIssueProperties(_Model): + """Properties of Provisioning Issue. + + :ivar issue_type: Type of Issue. + :vartype issue_type: str + :ivar severity: Provisioning state of Network Security Perimeter configuration propagation. + Known values are: "Warning" and "Error". + :vartype severity: str or ~azure.mgmt.botservice.models.Severity + :ivar description: Description of the issue. + :vartype description: str + :ivar suggested_resource_ids: ARM IDs of resources that can be associated to the same perimeter + to remediate the issue. + :vartype suggested_resource_ids: list[str] + :ivar suggested_access_rules: Access rules that can be added to the same profile to remediate + the issue. + :vartype suggested_access_rules: list[~azure.mgmt.botservice.models.NspAccessRule] + """ + + issue_type: Optional[str] = rest_field(name="issueType", visibility=["read", "create", "update", "delete", "query"]) + """Type of Issue.""" + severity: Optional[Union[str, "_models.Severity"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Provisioning state of Network Security Perimeter configuration propagation. Known values are: + \"Warning\" and \"Error\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Description of the issue.""" + suggested_resource_ids: Optional[List[str]] = rest_field(name="suggestedResourceIds", visibility=["read"]) + """ARM IDs of resources that can be associated to the same perimeter to remediate the issue.""" + suggested_access_rules: Optional[List["_models.NspAccessRule"]] = rest_field( + name="suggestedAccessRules", visibility=["read", "create", "update", "delete", "query"] + ) + """Access rules that can be added to the same profile to remediate the issue.""" + + @overload + def __init__( + self, + *, + issue_type: Optional[str] = None, + severity: Optional[Union[str, "_models.Severity"]] = None, + description: Optional[str] = None, + suggested_access_rules: Optional[List["_models.NspAccessRule"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class QnAMakerEndpointKeysRequestBody(_Model): + """The request body for a request to Bot Service Management to list QnA Maker endpoint keys. + + :ivar hostname: the host name of the QnA Maker endpoint. + :vartype hostname: str + :ivar authkey: Subscription key which provides access to this API. + :vartype authkey: str + """ + + hostname: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """the host name of the QnA Maker endpoint.""" + authkey: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Subscription key which provides access to this API.""" + + @overload + def __init__( + self, + *, + hostname: Optional[str] = None, + authkey: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class QnAMakerEndpointKeysResponse(_Model): + """Schema for EndpointKeys generate/refresh operations. + + :ivar primary_endpoint_key: Primary Access Key. + :vartype primary_endpoint_key: str + :ivar secondary_endpoint_key: Secondary Access Key. + :vartype secondary_endpoint_key: str + :ivar installed_version: Current version of runtime. + :vartype installed_version: str + :ivar last_stable_version: Latest version of runtime. + :vartype last_stable_version: str + """ + + primary_endpoint_key: Optional[str] = rest_field( + name="primaryEndpointKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Primary Access Key.""" + secondary_endpoint_key: Optional[str] = rest_field( + name="secondaryEndpointKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Secondary Access Key.""" + installed_version: Optional[str] = rest_field( + name="installedVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Current version of runtime.""" + last_stable_version: Optional[str] = rest_field( + name="lastStableVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Latest version of runtime.""" + + @overload + def __init__( + self, + *, + primary_endpoint_key: Optional[str] = None, + secondary_endpoint_key: Optional[str] = None, + installed_version: Optional[str] = None, + last_stable_version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceAssociation(_Model): + """Information about resource association. + + :ivar name: Name of the resource association. + :vartype name: str + :ivar access_mode: Access Mode of the resource association. Known values are: "Enforced", + "Learning", and "Audit". + :vartype access_mode: str or ~azure.mgmt.botservice.models.AccessMode + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the resource association.""" + access_mode: Optional[Union[str, "_models.AccessMode"]] = rest_field( + name="accessMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Access Mode of the resource association. Known values are: \"Enforced\", \"Learning\", and + \"Audit\".""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + access_mode: Optional[Union[str, "_models.AccessMode"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SearchAssistant(Channel, discriminator="SearchAssistant"): + """SearchAssistant definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar channel_name: The channel name. Required. Default value is "SearchAssistant". + :vartype channel_name: str + """ + + channel_name: Literal["SearchAssistant"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"SearchAssistant\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="SearchAssistant", **kwargs) + + +class ServiceProvider(_Model): + """Service Provider Definition. + + :ivar properties: The Properties of a Service Provider Object. + :vartype properties: ~azure.mgmt.botservice.models.ServiceProviderProperties + """ + + properties: Optional["_models.ServiceProviderProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The Properties of a Service Provider Object.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ServiceProviderProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceProviderParameter(_Model): + """Extra Parameters specific to each Service Provider. + + :ivar name: Name of the Service Provider. + :vartype name: str + :ivar type: Type of the Service Provider. + :vartype type: str + :ivar display_name: Display Name of the Service Provider. + :vartype display_name: str + :ivar description: Description of the Service Provider. + :vartype description: str + :ivar help_url: Help Url for the Service Provider. + :vartype help_url: str + :ivar default: Default Name for the Service Provider. + :vartype default: str + :ivar metadata: Meta data for the Service Provider. + :vartype metadata: ~azure.mgmt.botservice.models.ServiceProviderParameterMetadata + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the Service Provider.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Type of the Service Provider.""" + display_name: Optional[str] = rest_field(name="displayName", visibility=["read"]) + """Display Name of the Service Provider.""" + description: Optional[str] = rest_field(visibility=["read"]) + """Description of the Service Provider.""" + help_url: Optional[str] = rest_field(name="helpUrl", visibility=["read"]) + """Help Url for the Service Provider.""" + default: Optional[str] = rest_field(visibility=["read"]) + """Default Name for the Service Provider.""" + metadata: Optional["_models.ServiceProviderParameterMetadata"] = rest_field(visibility=["read"]) + """Meta data for the Service Provider.""" + + +class ServiceProviderParameterMetadata(_Model): + """Meta data for the Service Provider. + + :ivar constraints: the constraints of the bot meta data. + :vartype constraints: ~azure.mgmt.botservice.models.ServiceProviderParameterMetadataConstraints + """ + + constraints: Optional["_models.ServiceProviderParameterMetadataConstraints"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """the constraints of the bot meta data.""" + + @overload + def __init__( + self, + *, + constraints: Optional["_models.ServiceProviderParameterMetadataConstraints"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceProviderParameterMetadataConstraints(_Model): # pylint: disable=name-too-long + """the constraints of the bot meta data. + + :ivar required: Whether required the constraints of the bot meta data. + :vartype required: bool + """ + + required: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether required the constraints of the bot meta data.""" + + @overload + def __init__( + self, + *, + required: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceProviderProperties(_Model): + """The Object used to describe a Service Provider supported by Bot Service. + + :ivar id: Id for Service Provider. + :vartype id: str + :ivar display_name: Display Name of the Service Provider. + :vartype display_name: str + :ivar service_provider_name: Name of the Service Provider. + :vartype service_provider_name: str + :ivar dev_portal_url: URL of Dev Portal. + :vartype dev_portal_url: str + :ivar icon_url: The URL of icon. + :vartype icon_url: str + :ivar parameters: The list of parameters for the Service Provider. + :vartype parameters: list[~azure.mgmt.botservice.models.ServiceProviderParameter] + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Id for Service Provider.""" + display_name: Optional[str] = rest_field(name="displayName", visibility=["read"]) + """Display Name of the Service Provider.""" + service_provider_name: Optional[str] = rest_field(name="serviceProviderName", visibility=["read"]) + """Name of the Service Provider.""" + dev_portal_url: Optional[str] = rest_field(name="devPortalUrl", visibility=["read"]) + """URL of Dev Portal.""" + icon_url: Optional[str] = rest_field(name="iconUrl", visibility=["read", "create", "update", "delete", "query"]) + """The URL of icon.""" + parameters: Optional[List["_models.ServiceProviderParameter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of parameters for the Service Provider.""" + + @overload + def __init__( + self, + *, + icon_url: Optional[str] = None, + parameters: Optional[List["_models.ServiceProviderParameter"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceProviderResponseList(_Model): + """The list of bot service providers response. + + :ivar next_link: The link used to get the next page of bot service providers. + :vartype next_link: str + :ivar value: Gets the list of bot service providers and their properties. + :vartype value: list[~azure.mgmt.botservice.models.ServiceProvider] + """ + + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """The link used to get the next page of bot service providers.""" + value: Optional[List["_models.ServiceProvider"]] = rest_field(visibility=["read"]) + """Gets the list of bot service providers and their properties.""" + + @overload + def __init__( + self, + *, + next_link: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SiteInfo(_Model): + """Site information for WebChat or DirectLine Channels to identify which site to regenerate keys + for. + + :ivar site_name: The site name. Required. + :vartype site_name: str + :ivar key: Determines which key is to be regenerated. Required. Known values are: "key1" and + "key2". + :vartype key: str or ~azure.mgmt.botservice.models.Key + """ + + site_name: str = rest_field(name="siteName", visibility=["read", "create"]) + """The site name. Required.""" + key: Union[str, "_models.Key"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Determines which key is to be regenerated. Required. Known values are: \"key1\" and \"key2\".""" + + @overload + def __init__( + self, + *, + site_name: str, + key: Union[str, "_models.Key"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Sku(_Model): + """The SKU of the cognitive services account. + + :ivar name: The sku name. Required. Known values are: "F0" and "S1". + :vartype name: str or ~azure.mgmt.botservice.models.SkuName + :ivar tier: Gets the sku tier. This is based on the SKU name. Known values are: "Free" and + "Standard". + :vartype tier: str or ~azure.mgmt.botservice.models.SkuTier + """ + + name: Union[str, "_models.SkuName"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The sku name. Required. Known values are: \"F0\" and \"S1\".""" + tier: Optional[Union[str, "_models.SkuTier"]] = rest_field(visibility=["read"]) + """Gets the sku tier. This is based on the SKU name. Known values are: \"Free\" and \"Standard\".""" + + @overload + def __init__( + self, + *, + name: Union[str, "_models.SkuName"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SkypeChannel(Channel, discriminator="SkypeChannel"): + """Skype channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to Skype channel resource. + :vartype properties: ~azure.mgmt.botservice.models.SkypeChannelProperties + :ivar channel_name: The channel name. Required. Default value is "SkypeChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.SkypeChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to Skype channel resource.""" + channel_name: Literal["SkypeChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"SkypeChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.SkypeChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="SkypeChannel", **kwargs) + + +class SkypeChannelProperties(_Model): + """The parameters to provide for the Microsoft Teams channel. + + :ivar enable_messaging: Enable messaging for Skype channel. + :vartype enable_messaging: bool + :ivar enable_media_cards: Enable media cards for Skype channel. + :vartype enable_media_cards: bool + :ivar enable_video: Enable video for Skype channel. + :vartype enable_video: bool + :ivar enable_calling: Enable calling for Skype channel. + :vartype enable_calling: bool + :ivar enable_screen_sharing: Enable screen sharing for Skype channel. + :vartype enable_screen_sharing: bool + :ivar enable_groups: Enable groups for Skype channel. + :vartype enable_groups: bool + :ivar groups_mode: Group mode for Skype channel. + :vartype groups_mode: str + :ivar calling_web_hook: Calling web hook for Skype channel. + :vartype calling_web_hook: str + :ivar incoming_call_route: Incoming call route for Skype channel. + :vartype incoming_call_route: str + :ivar is_enabled: Whether this channel is enabled for the bot. Required. + :vartype is_enabled: bool + """ + + enable_messaging: Optional[bool] = rest_field( + name="enableMessaging", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable messaging for Skype channel.""" + enable_media_cards: Optional[bool] = rest_field( + name="enableMediaCards", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable media cards for Skype channel.""" + enable_video: Optional[bool] = rest_field( + name="enableVideo", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable video for Skype channel.""" + enable_calling: Optional[bool] = rest_field( + name="enableCalling", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable calling for Skype channel.""" + enable_screen_sharing: Optional[bool] = rest_field( + name="enableScreenSharing", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable screen sharing for Skype channel.""" + enable_groups: Optional[bool] = rest_field( + name="enableGroups", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable groups for Skype channel.""" + groups_mode: Optional[str] = rest_field( + name="groupsMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Group mode for Skype channel.""" + calling_web_hook: Optional[str] = rest_field( + name="callingWebHook", visibility=["read", "create", "update", "delete", "query"] + ) + """Calling web hook for Skype channel.""" + incoming_call_route: Optional[str] = rest_field( + name="incomingCallRoute", visibility=["read", "create", "update", "delete", "query"] + ) + """Incoming call route for Skype channel.""" + is_enabled: bool = rest_field(name="isEnabled", visibility=["read", "create", "update", "delete", "query"]) + """Whether this channel is enabled for the bot. Required.""" + + @overload + def __init__( + self, + *, + is_enabled: bool, + enable_messaging: Optional[bool] = None, + enable_media_cards: Optional[bool] = None, + enable_video: Optional[bool] = None, + enable_calling: Optional[bool] = None, + enable_screen_sharing: Optional[bool] = None, + enable_groups: Optional[bool] = None, + groups_mode: Optional[str] = None, + calling_web_hook: Optional[str] = None, + incoming_call_route: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SlackChannel(Channel, discriminator="SlackChannel"): + """Slack channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to Slack channel resource. + :vartype properties: ~azure.mgmt.botservice.models.SlackChannelProperties + :ivar channel_name: The channel name. Required. Default value is "SlackChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.SlackChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to Slack channel resource.""" + channel_name: Literal["SlackChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"SlackChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.SlackChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="SlackChannel", **kwargs) + + +class SlackChannelProperties(_Model): + """The parameters to provide for the Slack channel. + + :ivar client_id: The Slack client id. + :vartype client_id: str + :ivar client_secret: The Slack client secret. Value only returned through POST to the action + Channel List API, otherwise empty. + :vartype client_secret: str + :ivar verification_token: The Slack verification token. Value only returned through POST to the + action Channel List API, otherwise empty. + :vartype verification_token: str + :ivar scopes: The Slack permission scopes. + :vartype scopes: str + :ivar landing_page_url: The Slack landing page Url. + :vartype landing_page_url: str + :ivar redirect_action: The Slack redirect action. + :vartype redirect_action: str + :ivar last_submission_id: The Sms auth token. + :vartype last_submission_id: str + :ivar register_before_o_auth_flow: Whether to register the settings before OAuth validation is + performed. Recommended to True. + :vartype register_before_o_auth_flow: bool + :ivar is_validated: Whether this channel is validated for the bot. + :vartype is_validated: bool + :ivar signing_secret: The Slack signing secret. + :vartype signing_secret: str + :ivar is_enabled: Whether this channel is enabled for the bot. Required. + :vartype is_enabled: bool + """ + + client_id: Optional[str] = rest_field(name="clientId", visibility=["read", "create", "update", "delete", "query"]) + """The Slack client id.""" + client_secret: Optional[str] = rest_field( + name="clientSecret", visibility=["read", "create", "update", "delete", "query"] + ) + """The Slack client secret. Value only returned through POST to the action Channel List API, + otherwise empty.""" + verification_token: Optional[str] = rest_field( + name="verificationToken", visibility=["read", "create", "update", "delete", "query"] + ) + """The Slack verification token. Value only returned through POST to the action Channel List API, + otherwise empty.""" + scopes: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Slack permission scopes.""" + landing_page_url: Optional[str] = rest_field( + name="landingPageUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """The Slack landing page Url.""" + redirect_action: Optional[str] = rest_field(name="redirectAction", visibility=["read"]) + """The Slack redirect action.""" + last_submission_id: Optional[str] = rest_field(name="lastSubmissionId", visibility=["read"]) + """The Sms auth token.""" + register_before_o_auth_flow: Optional[bool] = rest_field( + name="registerBeforeOAuthFlow", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether to register the settings before OAuth validation is performed. Recommended to True.""" + is_validated: Optional[bool] = rest_field(name="IsValidated", visibility=["read"]) + """Whether this channel is validated for the bot.""" + signing_secret: Optional[str] = rest_field( + name="signingSecret", visibility=["read", "create", "update", "delete", "query"] + ) + """The Slack signing secret.""" + is_enabled: bool = rest_field(name="isEnabled", visibility=["read", "create", "update", "delete", "query"]) + """Whether this channel is enabled for the bot. Required.""" + + @overload + def __init__( + self, + *, + is_enabled: bool, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + verification_token: Optional[str] = None, + scopes: Optional[str] = None, + landing_page_url: Optional[str] = None, + register_before_o_auth_flow: Optional[bool] = None, + signing_secret: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SmsChannel(Channel, discriminator="SmsChannel"): + """Sms channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to Sms channel resource. + :vartype properties: ~azure.mgmt.botservice.models.SmsChannelProperties + :ivar channel_name: The channel name. Required. Default value is "SmsChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.SmsChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to Sms channel resource.""" + channel_name: Literal["SmsChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"SmsChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.SmsChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="SmsChannel", **kwargs) + + +class SmsChannelProperties(_Model): + """The parameters to provide for the Sms channel. + + :ivar phone: The Sms phone. Required. + :vartype phone: str + :ivar account_sid: The Sms account SID. Value only returned through POST to the action Channel + List API, otherwise empty. Required. + :vartype account_sid: str + :ivar auth_token: The Sms auth token. Value only returned through POST to the action Channel + List API, otherwise empty. + :vartype auth_token: str + :ivar is_validated: Whether this channel is validated for the bot. + :vartype is_validated: bool + :ivar is_enabled: Whether this channel is enabled for the bot. Required. + :vartype is_enabled: bool + """ + + phone: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Sms phone. Required.""" + account_sid: str = rest_field(name="accountSID", visibility=["read", "create", "update", "delete", "query"]) + """The Sms account SID. Value only returned through POST to the action Channel List API, otherwise + empty. Required.""" + auth_token: Optional[str] = rest_field(name="authToken", visibility=["read", "create", "update", "delete", "query"]) + """The Sms auth token. Value only returned through POST to the action Channel List API, otherwise + empty.""" + is_validated: Optional[bool] = rest_field( + name="isValidated", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this channel is validated for the bot.""" + is_enabled: bool = rest_field(name="isEnabled", visibility=["read", "create", "update", "delete", "query"]) + """Whether this channel is enabled for the bot. Required.""" + + @overload + def __init__( + self, + *, + phone: str, + account_sid: str, + is_enabled: bool, + auth_token: Optional[str] = None, + is_validated: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.botservice.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.botservice.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TelegramChannel(Channel, discriminator="TelegramChannel"): + """Telegram channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to Telegram channel resource. + :vartype properties: ~azure.mgmt.botservice.models.TelegramChannelProperties + :ivar channel_name: The channel name. Required. Default value is "TelegramChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.TelegramChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to Telegram channel resource.""" + channel_name: Literal["TelegramChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"TelegramChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.TelegramChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="TelegramChannel", **kwargs) + + +class TelegramChannelProperties(_Model): + """The parameters to provide for the Telegram channel. + + :ivar access_token: The Telegram access token. Value only returned through POST to the action + Channel List API, otherwise empty. + :vartype access_token: str + :ivar is_validated: Whether this channel is validated for the bot. + :vartype is_validated: bool + :ivar is_enabled: Whether this channel is enabled for the bot. Required. + :vartype is_enabled: bool + """ + + access_token: Optional[str] = rest_field( + name="accessToken", visibility=["read", "create", "update", "delete", "query"] + ) + """The Telegram access token. Value only returned through POST to the action Channel List API, + otherwise empty.""" + is_validated: Optional[bool] = rest_field( + name="isValidated", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether this channel is validated for the bot.""" + is_enabled: bool = rest_field(name="isEnabled", visibility=["read", "create", "update", "delete", "query"]) + """Whether this channel is enabled for the bot. Required.""" + + @overload + def __init__( + self, + *, + is_enabled: bool, + access_token: Optional[str] = None, + is_validated: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TelephonyChannel(Channel, discriminator="TelephonyChannel"): + """Telephony channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to Telephony channel resource. + :vartype properties: ~azure.mgmt.botservice.models.TelephonyChannelProperties + :ivar channel_name: The channel name. Required. Default value is "TelephonyChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.TelephonyChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to Telephony channel resource.""" + channel_name: Literal["TelephonyChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"TelephonyChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.TelephonyChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="TelephonyChannel", **kwargs) + + +class TelephonyChannelProperties(_Model): + """The parameters to provide for the Direct Line channel. + + :ivar phone_numbers: The list of Telephony phone numbers. + :vartype phone_numbers: list[~azure.mgmt.botservice.models.TelephonyPhoneNumbers] + :ivar api_configurations: The list of Telephony api configuration. + :vartype api_configurations: + list[~azure.mgmt.botservice.models.TelephonyChannelResourceApiConfiguration] + :ivar cognitive_service_subscription_key: The extensionKey1. + :vartype cognitive_service_subscription_key: str + :ivar cognitive_service_region: The extensionKey2. + :vartype cognitive_service_region: str + :ivar default_locale: The default locale of the channel. + :vartype default_locale: str + :ivar premium_sku: The premium SKU applied to the channel. + :vartype premium_sku: str + :ivar is_enabled: Whether the channel is enabled. + :vartype is_enabled: bool + """ + + phone_numbers: Optional[List["_models.TelephonyPhoneNumbers"]] = rest_field( + name="phoneNumbers", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of Telephony phone numbers.""" + api_configurations: Optional[List["_models.TelephonyChannelResourceApiConfiguration"]] = rest_field( + name="apiConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of Telephony api configuration.""" + cognitive_service_subscription_key: Optional[str] = rest_field( + name="cognitiveServiceSubscriptionKey", visibility=["read", "create", "update", "delete", "query"] + ) + """The extensionKey1.""" + cognitive_service_region: Optional[str] = rest_field( + name="cognitiveServiceRegion", visibility=["read", "create", "update", "delete", "query"] + ) + """The extensionKey2.""" + default_locale: Optional[str] = rest_field( + name="defaultLocale", visibility=["read", "create", "update", "delete", "query"] + ) + """The default locale of the channel.""" + premium_sku: Optional[str] = rest_field( + name="premiumSKU", visibility=["read", "create", "update", "delete", "query"] + ) + """The premium SKU applied to the channel.""" + is_enabled: Optional[bool] = rest_field( + name="isEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether the channel is enabled.""" + + @overload + def __init__( + self, + *, + phone_numbers: Optional[List["_models.TelephonyPhoneNumbers"]] = None, + api_configurations: Optional[List["_models.TelephonyChannelResourceApiConfiguration"]] = None, + cognitive_service_subscription_key: Optional[str] = None, + cognitive_service_region: Optional[str] = None, + default_locale: Optional[str] = None, + premium_sku: Optional[str] = None, + is_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TelephonyChannelResourceApiConfiguration(_Model): + """A resource Api configuration for the Telephony channel. + + :ivar id: The id of config. + :vartype id: str + :ivar provider_name: The provider name. + :vartype provider_name: str + :ivar cognitive_service_subscription_key: The cognitive service subscription key. + :vartype cognitive_service_subscription_key: str + :ivar cognitive_service_region: The cognitive service region. + :vartype cognitive_service_region: str + :ivar cognitive_service_resource_id: The cognitive service resourceId. + :vartype cognitive_service_resource_id: str + :ivar default_locale: The default locale. + :vartype default_locale: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The id of config.""" + provider_name: Optional[str] = rest_field( + name="providerName", visibility=["read", "create", "update", "delete", "query"] + ) + """The provider name.""" + cognitive_service_subscription_key: Optional[str] = rest_field( + name="cognitiveServiceSubscriptionKey", visibility=["read", "create", "update", "delete", "query"] + ) + """The cognitive service subscription key.""" + cognitive_service_region: Optional[str] = rest_field( + name="cognitiveServiceRegion", visibility=["read", "create", "update", "delete", "query"] + ) + """The cognitive service region.""" + cognitive_service_resource_id: Optional[str] = rest_field( + name="cognitiveServiceResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The cognitive service resourceId.""" + default_locale: Optional[str] = rest_field( + name="defaultLocale", visibility=["read", "create", "update", "delete", "query"] + ) + """The default locale.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + provider_name: Optional[str] = None, + cognitive_service_subscription_key: Optional[str] = None, + cognitive_service_region: Optional[str] = None, + cognitive_service_resource_id: Optional[str] = None, + default_locale: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TelephonyPhoneNumbers(_Model): + """A telephone number for the Telephony channel. + + :ivar id: The element id. + :vartype id: str + :ivar phone_number: The phone number. + :vartype phone_number: str + :ivar acs_endpoint: The endpoint of ACS. + :vartype acs_endpoint: str + :ivar acs_secret: The secret of ACS. + :vartype acs_secret: str + :ivar acs_resource_id: The resource id of ACS. + :vartype acs_resource_id: str + :ivar cognitive_service_subscription_key: The subscription key of cognitive service. + :vartype cognitive_service_subscription_key: str + :ivar cognitive_service_region: The service region of cognitive service. + :vartype cognitive_service_region: str + :ivar cognitive_service_resource_id: The resource id of cognitive service. + :vartype cognitive_service_resource_id: str + :ivar default_locale: The default locale of the phone number. + :vartype default_locale: str + :ivar offer_type: Optional Property that will determine the offering type of the phone. + :vartype offer_type: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The element id.""" + phone_number: Optional[str] = rest_field( + name="phoneNumber", visibility=["read", "create", "update", "delete", "query"] + ) + """The phone number.""" + acs_endpoint: Optional[str] = rest_field( + name="acsEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """The endpoint of ACS.""" + acs_secret: Optional[str] = rest_field(name="acsSecret", visibility=["read", "create", "update", "delete", "query"]) + """The secret of ACS.""" + acs_resource_id: Optional[str] = rest_field( + name="acsResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource id of ACS.""" + cognitive_service_subscription_key: Optional[str] = rest_field( + name="cognitiveServiceSubscriptionKey", visibility=["read", "create", "update", "delete", "query"] + ) + """The subscription key of cognitive service.""" + cognitive_service_region: Optional[str] = rest_field( + name="cognitiveServiceRegion", visibility=["read", "create", "update", "delete", "query"] + ) + """The service region of cognitive service.""" + cognitive_service_resource_id: Optional[str] = rest_field( + name="cognitiveServiceResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource id of cognitive service.""" + default_locale: Optional[str] = rest_field( + name="defaultLocale", visibility=["read", "create", "update", "delete", "query"] + ) + """The default locale of the phone number.""" + offer_type: Optional[str] = rest_field(name="offerType", visibility=["read", "create", "update", "delete", "query"]) + """Optional Property that will determine the offering type of the phone.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + phone_number: Optional[str] = None, + acs_endpoint: Optional[str] = None, + acs_secret: Optional[str] = None, + acs_resource_id: Optional[str] = None, + cognitive_service_subscription_key: Optional[str] = None, + cognitive_service_region: Optional[str] = None, + cognitive_service_resource_id: Optional[str] = None, + default_locale: Optional[str] = None, + offer_type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebChatChannel(Channel, discriminator="WebChatChannel"): + """Web Chat channel definition. + + :ivar etag: Entity Tag of the resource. + :vartype etag: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar properties: The set of properties specific to Web Chat channel resource. + :vartype properties: ~azure.mgmt.botservice.models.WebChatChannelProperties + :ivar channel_name: The channel name. Required. Default value is "WebChatChannel". + :vartype channel_name: str + """ + + properties: Optional["_models.WebChatChannelProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of properties specific to Web Chat channel resource.""" + channel_name: Literal["WebChatChannel"] = rest_discriminator(name="channelName", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The channel name. Required. Default value is \"WebChatChannel\".""" + + @overload + def __init__( + self, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.WebChatChannelProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, channel_name="WebChatChannel", **kwargs) + + +class WebChatChannelProperties(_Model): + """The parameters to provide for the Web Chat channel. + + :ivar web_chat_embed_code: Web chat control embed code. + :vartype web_chat_embed_code: str + :ivar sites: The list of Web Chat sites. + :vartype sites: list[~azure.mgmt.botservice.models.WebChatSite] + """ + + web_chat_embed_code: Optional[str] = rest_field(name="webChatEmbedCode", visibility=["read"]) + """Web chat control embed code.""" + sites: Optional[List["_models.WebChatSite"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of Web Chat sites.""" + + @overload + def __init__( + self, + *, + sites: Optional[List["_models.WebChatSite"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebChatSite(Site): + """A site for the Webchat channel. + + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :ivar site_id: Site Id. + :vartype site_id: str + :ivar site_name: Site name. Required. + :vartype site_name: str + :ivar key: Primary key. Value only returned through POST to the action Channel List API, + otherwise empty. + :vartype key: str + :ivar key2: Secondary key. Value only returned through POST to the action Channel List API, + otherwise empty. + :vartype key2: str + :ivar is_enabled: Whether this site is enabled for DirectLine channel. Required. + :vartype is_enabled: bool + :ivar is_token_enabled: Whether this site is token enabled for channel. + :vartype is_token_enabled: bool + :ivar is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for + channel. + :vartype is_endpoint_parameters_enabled: bool + :ivar is_detailed_logging_enabled: Whether this site is disabled detailed logging for. + :vartype is_detailed_logging_enabled: bool + :ivar is_block_user_upload_enabled: Whether this site is enabled for block user upload. + :vartype is_block_user_upload_enabled: bool + :ivar is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. + :vartype is_no_storage_enabled: bool + :ivar e_tag: Entity Tag. + :vartype e_tag: str + :ivar app_id: DirectLine application id. + :vartype app_id: str + :ivar is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. + :vartype is_v1_enabled: bool + :ivar is_v3_enabled: Whether this site is enabled for Bot Framework V3 protocol. + :vartype is_v3_enabled: bool + :ivar is_secure_site_enabled: Whether this site is enabled for authentication with Bot + Framework. + :vartype is_secure_site_enabled: bool + :ivar trusted_origins: List of Trusted Origin URLs for this site. This field is applicable only + if isSecureSiteEnabled is True. + :vartype trusted_origins: list[str] + :ivar is_web_chat_speech_enabled: Whether this site is enabled for Webchat Speech. + :vartype is_web_chat_speech_enabled: bool + :ivar is_webchat_preview_enabled: Whether this site is enabled for preview versions of Webchat. + :vartype is_webchat_preview_enabled: bool + """ + + @overload + def __init__( + self, + *, + site_name: str, + is_enabled: bool, + tenant_id: Optional[str] = None, + is_endpoint_parameters_enabled: Optional[bool] = None, + is_detailed_logging_enabled: Optional[bool] = None, + is_block_user_upload_enabled: Optional[bool] = None, + is_no_storage_enabled: Optional[bool] = None, + e_tag: Optional[str] = None, + app_id: Optional[str] = None, + is_v1_enabled: Optional[bool] = None, + is_v3_enabled: Optional[bool] = None, + is_secure_site_enabled: Optional[bool] = None, + trusted_origins: Optional[List[str]] = None, + is_web_chat_speech_enabled: Optional[bool] = None, + is_webchat_preview_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models_py3.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models_py3.py deleted file mode 100644 index cf2b03a9e72e..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_models_py3.py +++ /dev/null @@ -1,4613 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from .. import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class Channel(_serialization.Model): - """Channel definition. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AcsChatChannel, AlexaChannel, DirectLineChannel, DirectLineSpeechChannel, EmailChannel, - FacebookChannel, KikChannel, LineChannel, M365Extensions, MsTeamsChannel, Omnichannel, - OutlookChannel, SearchAssistant, SkypeChannel, SlackChannel, SmsChannel, TelegramChannel, - TelephonyChannel, WebChatChannel - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - } - - _subtype_map = { - "channel_name": { - "AcsChatChannel": "AcsChatChannel", - "AlexaChannel": "AlexaChannel", - "DirectLineChannel": "DirectLineChannel", - "DirectLineSpeechChannel": "DirectLineSpeechChannel", - "EmailChannel": "EmailChannel", - "FacebookChannel": "FacebookChannel", - "KikChannel": "KikChannel", - "LineChannel": "LineChannel", - "M365Extensions": "M365Extensions", - "MsTeamsChannel": "MsTeamsChannel", - "Omnichannel": "Omnichannel", - "OutlookChannel": "OutlookChannel", - "SearchAssistant": "SearchAssistant", - "SkypeChannel": "SkypeChannel", - "SlackChannel": "SlackChannel", - "SmsChannel": "SmsChannel", - "TelegramChannel": "TelegramChannel", - "TelephonyChannel": "TelephonyChannel", - "WebChatChannel": "WebChatChannel", - } - } - - def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.channel_name: Optional[str] = None - self.etag = etag - self.provisioning_state = None - self.location = location - - -class AcsChatChannel(Channel): - """AcsChat channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "AcsChatChannel" - - -class AlexaChannel(Channel): - """Alexa channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to Alexa channel resource. - :vartype properties: ~azure.mgmt.botservice.models.AlexaChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "AlexaChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.AlexaChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to Alexa channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.AlexaChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "AlexaChannel" - self.properties = properties - - -class AlexaChannelProperties(_serialization.Model): - """The parameters to provide for the Alexa channel. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar alexa_skill_id: The Alexa skill Id. Required. - :vartype alexa_skill_id: str - :ivar url_fragment: Url fragment used in part of the Uri configured in Alexa. - :vartype url_fragment: str - :ivar service_endpoint_uri: Full Uri used to configured the skill in Alexa. - :vartype service_endpoint_uri: str - :ivar is_enabled: Whether this channel is enabled for the bot. Required. - :vartype is_enabled: bool - """ - - _validation = { - "alexa_skill_id": {"required": True}, - "url_fragment": {"readonly": True}, - "service_endpoint_uri": {"readonly": True}, - "is_enabled": {"required": True}, - } - - _attribute_map = { - "alexa_skill_id": {"key": "alexaSkillId", "type": "str"}, - "url_fragment": {"key": "urlFragment", "type": "str"}, - "service_endpoint_uri": {"key": "serviceEndpointUri", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - } - - def __init__(self, *, alexa_skill_id: str, is_enabled: bool, **kwargs): - """ - :keyword alexa_skill_id: The Alexa skill Id. Required. - :paramtype alexa_skill_id: str - :keyword is_enabled: Whether this channel is enabled for the bot. Required. - :paramtype is_enabled: bool - """ - super().__init__(**kwargs) - self.alexa_skill_id = alexa_skill_id - self.url_fragment = None - self.service_endpoint_uri = None - self.is_enabled = is_enabled - - -class Resource(_serialization.Model): - """Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Specifies the resource ID. - :vartype id: str - :ivar name: Specifies the name of the resource. - :vartype name: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar type: Specifies the type of the resource. - :vartype type: str - :ivar tags: Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: Gets or sets the SKU of the resource. - :vartype sku: ~azure.mgmt.botservice.models.Sku - :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". - :vartype kind: str or ~azure.mgmt.botservice.models.Kind - :ivar etag: Entity Tag. - :vartype etag: str - :ivar zones: Entity zones. - :vartype zones: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "zones": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "Sku"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "zones": {"key": "zones", "type": "[str]"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - kind: Optional[Union[str, "_models.Kind"]] = None, - etag: Optional[str] = None, - **kwargs - ): - """ - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword tags: Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: Gets or sets the SKU of the resource. - :paramtype sku: ~azure.mgmt.botservice.models.Sku - :keyword kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". - :paramtype kind: str or ~azure.mgmt.botservice.models.Kind - :keyword etag: Entity Tag. - :paramtype etag: str - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.location = location - self.type = None - self.tags = tags - self.sku = sku - self.kind = kind - self.etag = etag - self.zones = None - - -class Bot(Resource): - """Bot resource definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Specifies the resource ID. - :vartype id: str - :ivar name: Specifies the name of the resource. - :vartype name: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar type: Specifies the type of the resource. - :vartype type: str - :ivar tags: Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: Gets or sets the SKU of the resource. - :vartype sku: ~azure.mgmt.botservice.models.Sku - :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". - :vartype kind: str or ~azure.mgmt.botservice.models.Kind - :ivar etag: Entity Tag. - :vartype etag: str - :ivar zones: Entity zones. - :vartype zones: list[str] - :ivar properties: The set of properties specific to bot resource. - :vartype properties: ~azure.mgmt.botservice.models.BotProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "zones": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "Sku"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "zones": {"key": "zones", "type": "[str]"}, - "properties": {"key": "properties", "type": "BotProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - kind: Optional[Union[str, "_models.Kind"]] = None, - etag: Optional[str] = None, - properties: Optional["_models.BotProperties"] = None, - **kwargs - ): - """ - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword tags: Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: Gets or sets the SKU of the resource. - :paramtype sku: ~azure.mgmt.botservice.models.Sku - :keyword kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". - :paramtype kind: str or ~azure.mgmt.botservice.models.Kind - :keyword etag: Entity Tag. - :paramtype etag: str - :keyword properties: The set of properties specific to bot resource. - :paramtype properties: ~azure.mgmt.botservice.models.BotProperties - """ - super().__init__(location=location, tags=tags, sku=sku, kind=kind, etag=etag, **kwargs) - self.properties = properties - - -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 - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar type: Specifies the type of the resource. - :vartype type: str - :ivar tags: Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: Gets or sets the SKU of the resource. - :vartype sku: ~azure.mgmt.botservice.models.Sku - :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". - :vartype kind: str or ~azure.mgmt.botservice.models.Kind - :ivar etag: Entity Tag. - :vartype etag: str - :ivar zones: Entity zones. - :vartype zones: list[str] - :ivar properties: The set of properties specific to bot channel resource. - :vartype properties: ~azure.mgmt.botservice.models.Channel - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "zones": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "Sku"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "zones": {"key": "zones", "type": "[str]"}, - "properties": {"key": "properties", "type": "Channel"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - kind: Optional[Union[str, "_models.Kind"]] = None, - etag: Optional[str] = None, - properties: Optional["_models.Channel"] = None, - **kwargs - ): - """ - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword tags: Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: Gets or sets the SKU of the resource. - :paramtype sku: ~azure.mgmt.botservice.models.Sku - :keyword kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". - :paramtype kind: str or ~azure.mgmt.botservice.models.Kind - :keyword etag: Entity Tag. - :paramtype etag: str - :keyword properties: The set of properties specific to bot channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.Channel - """ - super().__init__(location=location, tags=tags, sku=sku, kind=kind, etag=etag, **kwargs) - self.properties = properties - - -class BotProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """The parameters to provide for the Bot. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar display_name: The Name of the bot. Required. - :vartype display_name: str - :ivar description: The description of the bot. - :vartype description: str - :ivar icon_url: The Icon Url of the bot. - :vartype icon_url: str - :ivar endpoint: The bot's endpoint. Required. - :vartype endpoint: str - :ivar endpoint_version: The bot's endpoint version. - :vartype endpoint_version: str - :ivar all_settings: Contains resource all settings defined as key/value pairs. - :vartype all_settings: dict[str, str] - :ivar parameters: Contains resource parameters defined as key/value pairs. - :vartype parameters: dict[str, str] - :ivar manifest_url: The bot's manifest url. - :vartype manifest_url: str - :ivar msa_app_type: Microsoft App Type for the bot. Known values are: "UserAssignedMSI", - "SingleTenant", and "MultiTenant". - :vartype msa_app_type: str or ~azure.mgmt.botservice.models.MsaAppType - :ivar msa_app_id: Microsoft App Id for the bot. Required. - :vartype msa_app_id: str - :ivar msa_app_tenant_id: Microsoft App Tenant Id for the bot. - :vartype msa_app_tenant_id: str - :ivar msa_app_msi_resource_id: Microsoft App Managed Identity Resource Id for the bot. - :vartype msa_app_msi_resource_id: str - :ivar configured_channels: Collection of channels for which the bot is configured. - :vartype configured_channels: list[str] - :ivar enabled_channels: Collection of channels for which the bot is enabled. - :vartype enabled_channels: list[str] - :ivar developer_app_insight_key: The Application Insights key. - :vartype developer_app_insight_key: str - :ivar developer_app_insights_api_key: The Application Insights Api Key. - :vartype developer_app_insights_api_key: str - :ivar developer_app_insights_application_id: The Application Insights App Id. - :vartype developer_app_insights_application_id: str - :ivar luis_app_ids: Collection of LUIS App Ids. - :vartype luis_app_ids: list[str] - :ivar luis_key: The LUIS Key. - :vartype luis_key: str - :ivar is_cmek_enabled: Whether Cmek is enabled. - :vartype is_cmek_enabled: bool - :ivar cmek_key_vault_url: The CMK Url. - :vartype cmek_key_vault_url: str - :ivar cmek_encryption_status: The CMK encryption status. - :vartype cmek_encryption_status: str - :ivar tenant_id: The Tenant Id for the bot. - :vartype tenant_id: str - :ivar public_network_access: Whether the bot is in an isolated network. Known values are: - "Enabled" and "Disabled". - :vartype public_network_access: str or ~azure.mgmt.botservice.models.PublicNetworkAccess - :ivar is_streaming_supported: Whether the bot is streaming supported. - :vartype is_streaming_supported: bool - :ivar is_developer_app_insights_api_key_set: Whether the bot is developerAppInsightsApiKey set. - :vartype is_developer_app_insights_api_key_set: bool - :ivar migration_token: Token used to migrate non Azure bot to azure subscription. - :vartype migration_token: str - :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :vartype disable_local_auth: bool - :ivar schema_transformation_version: The channel schema transformation version for the bot. - :vartype schema_transformation_version: str - :ivar storage_resource_id: The storage resourceId for the bot. - :vartype storage_resource_id: str - :ivar private_endpoint_connections: List of Private Endpoint Connections configured for the - bot. - :vartype private_endpoint_connections: - list[~azure.mgmt.botservice.models.PrivateEndpointConnection] - :ivar open_with_hint: The hint to browser (e.g. protocol handler) on how to open the bot for - authoring. - :vartype open_with_hint: str - :ivar app_password_hint: The hint (e.g. keyVault secret resourceId) on how to fetch the app - secret. - :vartype app_password_hint: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar publishing_credentials: Publishing credentials of the resource. - :vartype publishing_credentials: str - """ - - _validation = { - "display_name": {"required": True}, - "endpoint": {"required": True}, - "endpoint_version": {"readonly": True}, - "msa_app_id": {"required": True}, - "configured_channels": {"readonly": True}, - "enabled_channels": {"readonly": True}, - "cmek_encryption_status": {"readonly": True}, - "is_developer_app_insights_api_key_set": {"readonly": True}, - "migration_token": {"readonly": True}, - "private_endpoint_connections": {"readonly": True}, - "provisioning_state": {"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"}, - "all_settings": {"key": "allSettings", "type": "{str}"}, - "parameters": {"key": "parameters", "type": "{str}"}, - "manifest_url": {"key": "manifestUrl", "type": "str"}, - "msa_app_type": {"key": "msaAppType", "type": "str"}, - "msa_app_id": {"key": "msaAppId", "type": "str"}, - "msa_app_tenant_id": {"key": "msaAppTenantId", "type": "str"}, - "msa_app_msi_resource_id": {"key": "msaAppMSIResourceId", "type": "str"}, - "configured_channels": {"key": "configuredChannels", "type": "[str]"}, - "enabled_channels": {"key": "enabledChannels", "type": "[str]"}, - "developer_app_insight_key": {"key": "developerAppInsightKey", "type": "str"}, - "developer_app_insights_api_key": {"key": "developerAppInsightsApiKey", "type": "str"}, - "developer_app_insights_application_id": {"key": "developerAppInsightsApplicationId", "type": "str"}, - "luis_app_ids": {"key": "luisAppIds", "type": "[str]"}, - "luis_key": {"key": "luisKey", "type": "str"}, - "is_cmek_enabled": {"key": "isCmekEnabled", "type": "bool"}, - "cmek_key_vault_url": {"key": "cmekKeyVaultUrl", "type": "str"}, - "cmek_encryption_status": {"key": "cmekEncryptionStatus", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, - "is_streaming_supported": {"key": "isStreamingSupported", "type": "bool"}, - "is_developer_app_insights_api_key_set": {"key": "isDeveloperAppInsightsApiKeySet", "type": "bool"}, - "migration_token": {"key": "migrationToken", "type": "str"}, - "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, - "schema_transformation_version": {"key": "schemaTransformationVersion", "type": "str"}, - "storage_resource_id": {"key": "storageResourceId", "type": "str"}, - "private_endpoint_connections": {"key": "privateEndpointConnections", "type": "[PrivateEndpointConnection]"}, - "open_with_hint": {"key": "openWithHint", "type": "str"}, - "app_password_hint": {"key": "appPasswordHint", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "publishing_credentials": {"key": "publishingCredentials", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - display_name: str, - endpoint: str, - msa_app_id: str, - description: Optional[str] = None, - icon_url: str = "", - all_settings: Optional[Dict[str, str]] = None, - parameters: Optional[Dict[str, str]] = None, - manifest_url: Optional[str] = None, - msa_app_type: Optional[Union[str, "_models.MsaAppType"]] = None, - msa_app_tenant_id: Optional[str] = None, - msa_app_msi_resource_id: Optional[str] = None, - developer_app_insight_key: Optional[str] = None, - developer_app_insights_api_key: Optional[str] = None, - developer_app_insights_application_id: Optional[str] = None, - luis_app_ids: Optional[List[str]] = None, - luis_key: Optional[str] = None, - is_cmek_enabled: bool = False, - cmek_key_vault_url: Optional[str] = None, - tenant_id: Optional[str] = None, - public_network_access: Union[str, "_models.PublicNetworkAccess"] = "Enabled", - is_streaming_supported: bool = False, - disable_local_auth: Optional[bool] = None, - schema_transformation_version: Optional[str] = None, - storage_resource_id: Optional[str] = None, - open_with_hint: Optional[str] = None, - app_password_hint: Optional[str] = None, - publishing_credentials: Optional[str] = None, - **kwargs - ): - """ - :keyword display_name: The Name of the bot. Required. - :paramtype display_name: str - :keyword description: The description of the bot. - :paramtype description: str - :keyword icon_url: The Icon Url of the bot. - :paramtype icon_url: str - :keyword endpoint: The bot's endpoint. Required. - :paramtype endpoint: str - :keyword all_settings: Contains resource all settings defined as key/value pairs. - :paramtype all_settings: dict[str, str] - :keyword parameters: Contains resource parameters defined as key/value pairs. - :paramtype parameters: dict[str, str] - :keyword manifest_url: The bot's manifest url. - :paramtype manifest_url: str - :keyword msa_app_type: Microsoft App Type for the bot. Known values are: "UserAssignedMSI", - "SingleTenant", and "MultiTenant". - :paramtype msa_app_type: str or ~azure.mgmt.botservice.models.MsaAppType - :keyword msa_app_id: Microsoft App Id for the bot. Required. - :paramtype msa_app_id: str - :keyword msa_app_tenant_id: Microsoft App Tenant Id for the bot. - :paramtype msa_app_tenant_id: str - :keyword msa_app_msi_resource_id: Microsoft App Managed Identity Resource Id for the bot. - :paramtype msa_app_msi_resource_id: str - :keyword developer_app_insight_key: The Application Insights key. - :paramtype developer_app_insight_key: str - :keyword developer_app_insights_api_key: The Application Insights Api Key. - :paramtype developer_app_insights_api_key: str - :keyword developer_app_insights_application_id: The Application Insights App Id. - :paramtype developer_app_insights_application_id: str - :keyword luis_app_ids: Collection of LUIS App Ids. - :paramtype luis_app_ids: list[str] - :keyword luis_key: The LUIS Key. - :paramtype luis_key: str - :keyword is_cmek_enabled: Whether Cmek is enabled. - :paramtype is_cmek_enabled: bool - :keyword cmek_key_vault_url: The CMK Url. - :paramtype cmek_key_vault_url: str - :keyword tenant_id: The Tenant Id for the bot. - :paramtype tenant_id: str - :keyword public_network_access: Whether the bot is in an isolated network. Known values are: - "Enabled" and "Disabled". - :paramtype public_network_access: str or ~azure.mgmt.botservice.models.PublicNetworkAccess - :keyword is_streaming_supported: Whether the bot is streaming supported. - :paramtype is_streaming_supported: bool - :keyword disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :paramtype disable_local_auth: bool - :keyword schema_transformation_version: The channel schema transformation version for the bot. - :paramtype schema_transformation_version: str - :keyword storage_resource_id: The storage resourceId for the bot. - :paramtype storage_resource_id: str - :keyword open_with_hint: The hint to browser (e.g. protocol handler) on how to open the bot for - authoring. - :paramtype open_with_hint: str - :keyword app_password_hint: The hint (e.g. keyVault secret resourceId) on how to fetch the app - secret. - :paramtype app_password_hint: str - :keyword publishing_credentials: Publishing credentials of the resource. - :paramtype publishing_credentials: str - """ - super().__init__(**kwargs) - self.display_name = display_name - self.description = description - self.icon_url = icon_url - self.endpoint = endpoint - self.endpoint_version = None - self.all_settings = all_settings - self.parameters = parameters - self.manifest_url = manifest_url - self.msa_app_type = msa_app_type - self.msa_app_id = msa_app_id - self.msa_app_tenant_id = msa_app_tenant_id - self.msa_app_msi_resource_id = msa_app_msi_resource_id - self.configured_channels = None - self.enabled_channels = None - self.developer_app_insight_key = developer_app_insight_key - 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 - self.is_cmek_enabled = is_cmek_enabled - self.cmek_key_vault_url = cmek_key_vault_url - self.cmek_encryption_status = None - self.tenant_id = tenant_id - self.public_network_access = public_network_access - self.is_streaming_supported = is_streaming_supported - self.is_developer_app_insights_api_key_set = None - self.migration_token = None - self.disable_local_auth = disable_local_auth - self.schema_transformation_version = schema_transformation_version - self.storage_resource_id = storage_resource_id - self.private_endpoint_connections = None - self.open_with_hint = open_with_hint - self.app_password_hint = app_password_hint - self.provisioning_state = None - self.publishing_credentials = publishing_credentials - - -class BotResponseList(_serialization.Model): - """The list of bot service operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar next_link: The link used to get the next page of bot service resources. - :vartype next_link: str - :ivar value: Gets the list of bot service results and their properties. - :vartype value: list[~azure.mgmt.botservice.models.Bot] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Bot]"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs): - """ - :keyword next_link: The link used to get the next page of bot service resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = None - - -class ChannelResponseList(_serialization.Model): - """The list of bot service channel operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar next_link: The link used to get the next page of bot service channel resources. - :vartype next_link: str - :ivar value: Gets the list of bot service channel results and their properties. - :vartype value: list[~azure.mgmt.botservice.models.BotChannel] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[BotChannel]"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs): - """ - :keyword next_link: The link used to get the next page of bot service channel resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = None - - -class ChannelSettings(_serialization.Model): - """Channel settings definition. - - :ivar extension_key1: The extensionKey1. - :vartype extension_key1: str - :ivar extension_key2: The extensionKey2. - :vartype extension_key2: str - :ivar sites: The list of sites. - :vartype sites: list[~azure.mgmt.botservice.models.Site] - :ivar channel_id: The channel id. - :vartype channel_id: str - :ivar channel_display_name: The channel display name. - :vartype channel_display_name: str - :ivar bot_id: The bot id. - :vartype bot_id: str - :ivar bot_icon_url: The bot icon url. - :vartype bot_icon_url: str - :ivar is_enabled: Whether this channel is enabled for the bot. - :vartype is_enabled: bool - :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :vartype disable_local_auth: bool - :ivar require_terms_agreement: Whether customer needs to agree to new terms. - :vartype require_terms_agreement: bool - """ - - _attribute_map = { - "extension_key1": {"key": "extensionKey1", "type": "str"}, - "extension_key2": {"key": "extensionKey2", "type": "str"}, - "sites": {"key": "sites", "type": "[Site]"}, - "channel_id": {"key": "channelId", "type": "str"}, - "channel_display_name": {"key": "channelDisplayName", "type": "str"}, - "bot_id": {"key": "botId", "type": "str"}, - "bot_icon_url": {"key": "botIconUrl", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, - "require_terms_agreement": {"key": "requireTermsAgreement", "type": "bool"}, - } - - def __init__( - self, - *, - extension_key1: str = "", - extension_key2: str = "", - sites: Optional[List["_models.Site"]] = None, - channel_id: Optional[str] = None, - channel_display_name: Optional[str] = None, - bot_id: Optional[str] = None, - bot_icon_url: Optional[str] = None, - is_enabled: Optional[bool] = None, - disable_local_auth: Optional[bool] = None, - require_terms_agreement: Optional[bool] = None, - **kwargs - ): - """ - :keyword extension_key1: The extensionKey1. - :paramtype extension_key1: str - :keyword extension_key2: The extensionKey2. - :paramtype extension_key2: str - :keyword sites: The list of sites. - :paramtype sites: list[~azure.mgmt.botservice.models.Site] - :keyword channel_id: The channel id. - :paramtype channel_id: str - :keyword channel_display_name: The channel display name. - :paramtype channel_display_name: str - :keyword bot_id: The bot id. - :paramtype bot_id: str - :keyword bot_icon_url: The bot icon url. - :paramtype bot_icon_url: str - :keyword is_enabled: Whether this channel is enabled for the bot. - :paramtype is_enabled: bool - :keyword disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :paramtype disable_local_auth: bool - :keyword require_terms_agreement: Whether customer needs to agree to new terms. - :paramtype require_terms_agreement: bool - """ - super().__init__(**kwargs) - self.extension_key1 = extension_key1 - self.extension_key2 = extension_key2 - self.sites = sites - self.channel_id = channel_id - self.channel_display_name = channel_display_name - self.bot_id = bot_id - self.bot_icon_url = bot_icon_url - self.is_enabled = is_enabled - self.disable_local_auth = disable_local_auth - self.require_terms_agreement = require_terms_agreement - - -class CheckNameAvailabilityRequestBody(_serialization.Model): - """The request body for a request to Bot Service Management to check availability of a bot name. - - :ivar name: the name of the bot for which availability needs to be checked. - :vartype name: str - :ivar type: the type of the bot for which availability needs to be checked. - :vartype type: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): - """ - :keyword name: the name of the bot for which availability needs to be checked. - :paramtype name: str - :keyword type: the type of the bot for which availability needs to be checked. - :paramtype type: str - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - -class CheckNameAvailabilityResponseBody(_serialization.Model): - """The response body returned for a request to Bot Service Management to check availability of a bot name. - - :ivar valid: indicates if the bot name is valid. - :vartype valid: bool - :ivar message: additional message from the bot management api showing why a bot name is not - available. - :vartype message: str - :ivar abs_code: response code from ABS. - :vartype abs_code: str - """ - - _attribute_map = { - "valid": {"key": "valid", "type": "bool"}, - "message": {"key": "message", "type": "str"}, - "abs_code": {"key": "absCode", "type": "str"}, - } - - def __init__( - self, *, valid: Optional[bool] = None, message: Optional[str] = None, abs_code: Optional[str] = None, **kwargs - ): - """ - :keyword valid: indicates if the bot name is valid. - :paramtype valid: bool - :keyword message: additional message from the bot management api showing why a bot name is not - available. - :paramtype message: str - :keyword abs_code: response code from ABS. - :paramtype abs_code: str - """ - super().__init__(**kwargs) - self.valid = valid - self.message = message - self.abs_code = abs_code - - -class ConnectionItemName(_serialization.Model): - """The display name of a connection Item Setting registered with the Bot. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Connection Item name that has been added in the API. - :vartype name: str - """ - - _validation = { - "name": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.name = None - - -class ConnectionSetting(Resource): - """Bot channel resource definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Specifies the resource ID. - :vartype id: str - :ivar name: Specifies the name of the resource. - :vartype name: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar type: Specifies the type of the resource. - :vartype type: str - :ivar tags: Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: Gets or sets the SKU of the resource. - :vartype sku: ~azure.mgmt.botservice.models.Sku - :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". - :vartype kind: str or ~azure.mgmt.botservice.models.Kind - :ivar etag: Entity Tag. - :vartype etag: str - :ivar zones: Entity zones. - :vartype zones: list[str] - :ivar properties: The set of properties specific to bot channel resource. - :vartype properties: ~azure.mgmt.botservice.models.ConnectionSettingProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "zones": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "Sku"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "zones": {"key": "zones", "type": "[str]"}, - "properties": {"key": "properties", "type": "ConnectionSettingProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - kind: Optional[Union[str, "_models.Kind"]] = None, - etag: Optional[str] = None, - properties: Optional["_models.ConnectionSettingProperties"] = None, - **kwargs - ): - """ - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword tags: Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: Gets or sets the SKU of the resource. - :paramtype sku: ~azure.mgmt.botservice.models.Sku - :keyword kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". - :paramtype kind: str or ~azure.mgmt.botservice.models.Kind - :keyword etag: Entity Tag. - :paramtype etag: str - :keyword properties: The set of properties specific to bot channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.ConnectionSettingProperties - """ - super().__init__(location=location, tags=tags, sku=sku, kind=kind, etag=etag, **kwargs) - self.properties = properties - - -class ConnectionSettingParameter(_serialization.Model): - """Extra Parameter in a Connection Setting Properties to indicate service provider specific properties. - - :ivar key: Key for the Connection Setting Parameter. - :vartype key: str - :ivar value: Value associated with the Connection Setting Parameter. - :vartype value: str - """ - - _attribute_map = { - "key": {"key": "key", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, key: Optional[str] = None, value: Optional[str] = None, **kwargs): - """ - :keyword key: Key for the Connection Setting Parameter. - :paramtype key: str - :keyword value: Value associated with the Connection Setting Parameter. - :paramtype value: str - """ - super().__init__(**kwargs) - self.key = key - self.value = value - - -class ConnectionSettingProperties(_serialization.Model): - """Properties for a Connection Setting Item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar client_id: Client Id associated with the Connection Setting. - :vartype client_id: str - :ivar setting_id: Setting Id set by the service for the Connection Setting. - :vartype setting_id: str - :ivar client_secret: Client Secret associated with the Connection Setting. - :vartype client_secret: str - :ivar scopes: Scopes associated with the Connection Setting. - :vartype scopes: str - :ivar service_provider_id: Service Provider Id associated with the Connection Setting. - :vartype service_provider_id: str - :ivar service_provider_display_name: Service Provider Display Name associated with the - Connection Setting. - :vartype service_provider_display_name: str - :ivar parameters: Service Provider Parameters associated with the Connection Setting. - :vartype parameters: list[~azure.mgmt.botservice.models.ConnectionSettingParameter] - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - """ - - _validation = { - "setting_id": {"readonly": True}, - } - - _attribute_map = { - "client_id": {"key": "clientId", "type": "str"}, - "setting_id": {"key": "settingId", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, - "scopes": {"key": "scopes", "type": "str"}, - "service_provider_id": {"key": "serviceProviderId", "type": "str"}, - "service_provider_display_name": {"key": "serviceProviderDisplayName", "type": "str"}, - "parameters": {"key": "parameters", "type": "[ConnectionSettingParameter]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - scopes: str = "", - service_provider_id: Optional[str] = None, - service_provider_display_name: Optional[str] = None, - parameters: Optional[List["_models.ConnectionSettingParameter"]] = None, - provisioning_state: Optional[str] = None, - **kwargs - ): - """ - :keyword client_id: Client Id associated with the Connection Setting. - :paramtype client_id: str - :keyword client_secret: Client Secret associated with the Connection Setting. - :paramtype client_secret: str - :keyword scopes: Scopes associated with the Connection Setting. - :paramtype scopes: str - :keyword service_provider_id: Service Provider Id associated with the Connection Setting. - :paramtype service_provider_id: str - :keyword service_provider_display_name: Service Provider Display Name associated with the - Connection Setting. - :paramtype service_provider_display_name: str - :keyword parameters: Service Provider Parameters associated with the Connection Setting. - :paramtype parameters: list[~azure.mgmt.botservice.models.ConnectionSettingParameter] - :keyword provisioning_state: Provisioning state of the resource. - :paramtype provisioning_state: str - """ - super().__init__(**kwargs) - self.client_id = client_id - self.setting_id = None - self.client_secret = client_secret - self.scopes = scopes - self.service_provider_id = service_provider_id - self.service_provider_display_name = service_provider_display_name - self.parameters = parameters - self.provisioning_state = provisioning_state - - -class ConnectionSettingResponseList(_serialization.Model): - """The list of bot service connection settings response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar next_link: The link used to get the next page of bot service connection setting - resources. - :vartype next_link: str - :ivar value: Gets the list of bot service connection settings and their properties. - :vartype value: list[~azure.mgmt.botservice.models.ConnectionSetting] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ConnectionSetting]"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs): - """ - :keyword next_link: The link used to get the next page of bot service connection setting - resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = None - - -class CreateEmailSignInUrlResponse(_serialization.Model): - """The ARM create email sign in url operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Specifies the resource ID. - :vartype id: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to sign in url. - :vartype properties: ~azure.mgmt.botservice.models.CreateEmailSignInUrlResponseProperties - """ - - _validation = { - "id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "CreateEmailSignInUrlResponseProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - properties: Optional["_models.CreateEmailSignInUrlResponseProperties"] = None, - **kwargs - ): - """ - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to sign in url. - :paramtype properties: ~azure.mgmt.botservice.models.CreateEmailSignInUrlResponseProperties - """ - super().__init__(**kwargs) - self.id = None - self.location = location - self.properties = properties - - -class CreateEmailSignInUrlResponseProperties(_serialization.Model): - """The set of properties specific to sign in url. - - :ivar url: Sign in url. - :vartype url: str - """ - - _attribute_map = { - "url": {"key": "url", "type": "str"}, - } - - def __init__(self, *, url: Optional[str] = None, **kwargs): - """ - :keyword url: Sign in url. - :paramtype url: str - """ - super().__init__(**kwargs) - self.url = url - - -class DirectLineChannel(Channel): - """Direct Line channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to Direct Line channel resource. - :vartype properties: ~azure.mgmt.botservice.models.DirectLineChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "DirectLineChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.DirectLineChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to Direct Line channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.DirectLineChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "DirectLineChannel" - self.properties = properties - - -class DirectLineChannelProperties(_serialization.Model): - """The parameters to provide for the Direct Line channel. - - :ivar sites: The list of Direct Line sites. - :vartype sites: list[~azure.mgmt.botservice.models.DirectLineSite] - :ivar extension_key1: The extensionKey1. - :vartype extension_key1: str - :ivar extension_key2: The extensionKey2. - :vartype extension_key2: str - :ivar direct_line_embed_code: Direct Line embed code of the resource. - :vartype direct_line_embed_code: str - """ - - _attribute_map = { - "sites": {"key": "sites", "type": "[DirectLineSite]"}, - "extension_key1": {"key": "extensionKey1", "type": "str"}, - "extension_key2": {"key": "extensionKey2", "type": "str"}, - "direct_line_embed_code": {"key": "DirectLineEmbedCode", "type": "str"}, - } - - def __init__( - self, - *, - sites: Optional[List["_models.DirectLineSite"]] = None, - extension_key1: str = "", - extension_key2: str = "", - direct_line_embed_code: Optional[str] = None, - **kwargs - ): - """ - :keyword sites: The list of Direct Line sites. - :paramtype sites: list[~azure.mgmt.botservice.models.DirectLineSite] - :keyword extension_key1: The extensionKey1. - :paramtype extension_key1: str - :keyword extension_key2: The extensionKey2. - :paramtype extension_key2: str - :keyword direct_line_embed_code: Direct Line embed code of the resource. - :paramtype direct_line_embed_code: str - """ - super().__init__(**kwargs) - self.sites = sites - self.extension_key1 = extension_key1 - self.extension_key2 = extension_key2 - self.direct_line_embed_code = direct_line_embed_code - - -class Site(_serialization.Model): # pylint: disable=too-many-instance-attributes - """A site for the channel. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar tenant_id: Tenant Id. - :vartype tenant_id: str - :ivar site_id: Site Id. - :vartype site_id: str - :ivar site_name: Site name. Required. - :vartype site_name: str - :ivar key: Primary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key: str - :ivar key2: Secondary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key2: str - :ivar is_enabled: Whether this site is enabled for DirectLine channel. Required. - :vartype is_enabled: bool - :ivar is_token_enabled: Whether this site is token enabled for channel. - :vartype is_token_enabled: bool - :ivar is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for - channel. - :vartype is_endpoint_parameters_enabled: bool - :ivar is_detailed_logging_enabled: Whether this site is disabled detailed logging for. - :vartype is_detailed_logging_enabled: bool - :ivar is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :vartype is_block_user_upload_enabled: bool - :ivar is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. - :vartype is_no_storage_enabled: bool - :ivar e_tag: Entity Tag. - :vartype e_tag: str - :ivar app_id: DirectLine application id. - :vartype app_id: str - :ivar is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. - :vartype is_v1_enabled: bool - :ivar is_v3_enabled: Whether this site is enabled for Bot Framework V3 protocol. - :vartype is_v3_enabled: bool - :ivar is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :vartype is_secure_site_enabled: bool - :ivar trusted_origins: List of Trusted Origin URLs for this site. This field is applicable only - if isSecureSiteEnabled is True. - :vartype trusted_origins: list[str] - :ivar is_web_chat_speech_enabled: Whether this site is enabled for Webchat Speech. - :vartype is_web_chat_speech_enabled: bool - :ivar is_webchat_preview_enabled: Whether this site is enabled for preview versions of Webchat. - :vartype is_webchat_preview_enabled: bool - """ - - _validation = { - "site_id": {"readonly": True}, - "site_name": {"required": True}, - "key": {"readonly": True}, - "key2": {"readonly": True}, - "is_enabled": {"required": True}, - "is_token_enabled": {"readonly": True}, - } - - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "site_id": {"key": "siteId", "type": "str"}, - "site_name": {"key": "siteName", "type": "str"}, - "key": {"key": "key", "type": "str"}, - "key2": {"key": "key2", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "is_token_enabled": {"key": "isTokenEnabled", "type": "bool"}, - "is_endpoint_parameters_enabled": {"key": "isEndpointParametersEnabled", "type": "bool"}, - "is_detailed_logging_enabled": {"key": "isDetailedLoggingEnabled", "type": "bool"}, - "is_block_user_upload_enabled": {"key": "isBlockUserUploadEnabled", "type": "bool"}, - "is_no_storage_enabled": {"key": "isNoStorageEnabled", "type": "bool"}, - "e_tag": {"key": "eTag", "type": "str"}, - "app_id": {"key": "appId", "type": "str"}, - "is_v1_enabled": {"key": "isV1Enabled", "type": "bool"}, - "is_v3_enabled": {"key": "isV3Enabled", "type": "bool"}, - "is_secure_site_enabled": {"key": "isSecureSiteEnabled", "type": "bool"}, - "trusted_origins": {"key": "trustedOrigins", "type": "[str]"}, - "is_web_chat_speech_enabled": {"key": "isWebChatSpeechEnabled", "type": "bool"}, - "is_webchat_preview_enabled": {"key": "isWebchatPreviewEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - site_name: str, - is_enabled: bool, - tenant_id: Optional[str] = None, - is_endpoint_parameters_enabled: Optional[bool] = None, - is_detailed_logging_enabled: Optional[bool] = None, - is_block_user_upload_enabled: Optional[bool] = None, - is_no_storage_enabled: Optional[bool] = None, - e_tag: Optional[str] = None, - app_id: Optional[str] = None, - is_v1_enabled: Optional[bool] = None, - is_v3_enabled: Optional[bool] = None, - is_secure_site_enabled: Optional[bool] = None, - trusted_origins: Optional[List[str]] = None, - is_web_chat_speech_enabled: bool = False, - is_webchat_preview_enabled: bool = False, - **kwargs - ): - """ - :keyword tenant_id: Tenant Id. - :paramtype tenant_id: str - :keyword site_name: Site name. Required. - :paramtype site_name: str - :keyword is_enabled: Whether this site is enabled for DirectLine channel. Required. - :paramtype is_enabled: bool - :keyword is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for - channel. - :paramtype is_endpoint_parameters_enabled: bool - :keyword is_detailed_logging_enabled: Whether this site is disabled detailed logging for. - :paramtype is_detailed_logging_enabled: bool - :keyword is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :paramtype is_block_user_upload_enabled: bool - :keyword is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. - :paramtype is_no_storage_enabled: bool - :keyword e_tag: Entity Tag. - :paramtype e_tag: str - :keyword app_id: DirectLine application id. - :paramtype app_id: str - :keyword is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. - :paramtype is_v1_enabled: bool - :keyword is_v3_enabled: Whether this site is enabled for Bot Framework V3 protocol. - :paramtype is_v3_enabled: bool - :keyword is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :paramtype is_secure_site_enabled: bool - :keyword trusted_origins: List of Trusted Origin URLs for this site. This field is applicable - only if isSecureSiteEnabled is True. - :paramtype trusted_origins: list[str] - :keyword is_web_chat_speech_enabled: Whether this site is enabled for Webchat Speech. - :paramtype is_web_chat_speech_enabled: bool - :keyword is_webchat_preview_enabled: Whether this site is enabled for preview versions of - Webchat. - :paramtype is_webchat_preview_enabled: bool - """ - super().__init__(**kwargs) - self.tenant_id = tenant_id - self.site_id = None - self.site_name = site_name - self.key = None - self.key2 = None - self.is_enabled = is_enabled - self.is_token_enabled = None - self.is_endpoint_parameters_enabled = is_endpoint_parameters_enabled - self.is_detailed_logging_enabled = is_detailed_logging_enabled - self.is_block_user_upload_enabled = is_block_user_upload_enabled - self.is_no_storage_enabled = is_no_storage_enabled - self.e_tag = e_tag - self.app_id = app_id - self.is_v1_enabled = is_v1_enabled - self.is_v3_enabled = is_v3_enabled - self.is_secure_site_enabled = is_secure_site_enabled - self.trusted_origins = trusted_origins - self.is_web_chat_speech_enabled = is_web_chat_speech_enabled - self.is_webchat_preview_enabled = is_webchat_preview_enabled - - -class DirectLineSite(Site): # pylint: disable=too-many-instance-attributes - """A site for the Direct Line channel. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar tenant_id: Tenant Id. - :vartype tenant_id: str - :ivar site_id: Site Id. - :vartype site_id: str - :ivar site_name: Site name. Required. - :vartype site_name: str - :ivar key: Primary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key: str - :ivar key2: Secondary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key2: str - :ivar is_enabled: Whether this site is enabled for DirectLine channel. Required. - :vartype is_enabled: bool - :ivar is_token_enabled: Whether this site is token enabled for channel. - :vartype is_token_enabled: bool - :ivar is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for - channel. - :vartype is_endpoint_parameters_enabled: bool - :ivar is_detailed_logging_enabled: Whether this site is disabled detailed logging for. - :vartype is_detailed_logging_enabled: bool - :ivar is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :vartype is_block_user_upload_enabled: bool - :ivar is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. - :vartype is_no_storage_enabled: bool - :ivar e_tag: Entity Tag. - :vartype e_tag: str - :ivar app_id: DirectLine application id. - :vartype app_id: str - :ivar is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. - :vartype is_v1_enabled: bool - :ivar is_v3_enabled: Whether this site is enabled for Bot Framework V3 protocol. - :vartype is_v3_enabled: bool - :ivar is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :vartype is_secure_site_enabled: bool - :ivar trusted_origins: List of Trusted Origin URLs for this site. This field is applicable only - if isSecureSiteEnabled is True. - :vartype trusted_origins: list[str] - :ivar is_web_chat_speech_enabled: Whether this site is enabled for Webchat Speech. - :vartype is_web_chat_speech_enabled: bool - :ivar is_webchat_preview_enabled: Whether this site is enabled for preview versions of Webchat. - :vartype is_webchat_preview_enabled: bool - """ - - _validation = { - "site_id": {"readonly": True}, - "site_name": {"required": True}, - "key": {"readonly": True}, - "key2": {"readonly": True}, - "is_enabled": {"required": True}, - "is_token_enabled": {"readonly": True}, - } - - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "site_id": {"key": "siteId", "type": "str"}, - "site_name": {"key": "siteName", "type": "str"}, - "key": {"key": "key", "type": "str"}, - "key2": {"key": "key2", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "is_token_enabled": {"key": "isTokenEnabled", "type": "bool"}, - "is_endpoint_parameters_enabled": {"key": "isEndpointParametersEnabled", "type": "bool"}, - "is_detailed_logging_enabled": {"key": "isDetailedLoggingEnabled", "type": "bool"}, - "is_block_user_upload_enabled": {"key": "isBlockUserUploadEnabled", "type": "bool"}, - "is_no_storage_enabled": {"key": "isNoStorageEnabled", "type": "bool"}, - "e_tag": {"key": "eTag", "type": "str"}, - "app_id": {"key": "appId", "type": "str"}, - "is_v1_enabled": {"key": "isV1Enabled", "type": "bool"}, - "is_v3_enabled": {"key": "isV3Enabled", "type": "bool"}, - "is_secure_site_enabled": {"key": "isSecureSiteEnabled", "type": "bool"}, - "trusted_origins": {"key": "trustedOrigins", "type": "[str]"}, - "is_web_chat_speech_enabled": {"key": "isWebChatSpeechEnabled", "type": "bool"}, - "is_webchat_preview_enabled": {"key": "isWebchatPreviewEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - site_name: str, - is_enabled: bool, - tenant_id: Optional[str] = None, - is_endpoint_parameters_enabled: Optional[bool] = None, - is_detailed_logging_enabled: Optional[bool] = None, - is_block_user_upload_enabled: Optional[bool] = None, - is_no_storage_enabled: Optional[bool] = None, - e_tag: Optional[str] = None, - app_id: Optional[str] = None, - is_v1_enabled: Optional[bool] = None, - is_v3_enabled: Optional[bool] = None, - is_secure_site_enabled: Optional[bool] = None, - trusted_origins: Optional[List[str]] = None, - is_web_chat_speech_enabled: bool = False, - is_webchat_preview_enabled: bool = False, - **kwargs - ): - """ - :keyword tenant_id: Tenant Id. - :paramtype tenant_id: str - :keyword site_name: Site name. Required. - :paramtype site_name: str - :keyword is_enabled: Whether this site is enabled for DirectLine channel. Required. - :paramtype is_enabled: bool - :keyword is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for - channel. - :paramtype is_endpoint_parameters_enabled: bool - :keyword is_detailed_logging_enabled: Whether this site is disabled detailed logging for. - :paramtype is_detailed_logging_enabled: bool - :keyword is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :paramtype is_block_user_upload_enabled: bool - :keyword is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. - :paramtype is_no_storage_enabled: bool - :keyword e_tag: Entity Tag. - :paramtype e_tag: str - :keyword app_id: DirectLine application id. - :paramtype app_id: str - :keyword is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. - :paramtype is_v1_enabled: bool - :keyword is_v3_enabled: Whether this site is enabled for Bot Framework V3 protocol. - :paramtype is_v3_enabled: bool - :keyword is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :paramtype is_secure_site_enabled: bool - :keyword trusted_origins: List of Trusted Origin URLs for this site. This field is applicable - only if isSecureSiteEnabled is True. - :paramtype trusted_origins: list[str] - :keyword is_web_chat_speech_enabled: Whether this site is enabled for Webchat Speech. - :paramtype is_web_chat_speech_enabled: bool - :keyword is_webchat_preview_enabled: Whether this site is enabled for preview versions of - Webchat. - :paramtype is_webchat_preview_enabled: bool - """ - super().__init__( - tenant_id=tenant_id, - site_name=site_name, - is_enabled=is_enabled, - is_endpoint_parameters_enabled=is_endpoint_parameters_enabled, - is_detailed_logging_enabled=is_detailed_logging_enabled, - is_block_user_upload_enabled=is_block_user_upload_enabled, - is_no_storage_enabled=is_no_storage_enabled, - e_tag=e_tag, - app_id=app_id, - is_v1_enabled=is_v1_enabled, - is_v3_enabled=is_v3_enabled, - is_secure_site_enabled=is_secure_site_enabled, - trusted_origins=trusted_origins, - is_web_chat_speech_enabled=is_web_chat_speech_enabled, - is_webchat_preview_enabled=is_webchat_preview_enabled, - **kwargs - ) - - -class DirectLineSpeechChannel(Channel): - """DirectLine Speech channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to DirectLine Speech channel resource. - :vartype properties: ~azure.mgmt.botservice.models.DirectLineSpeechChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "DirectLineSpeechChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.DirectLineSpeechChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to DirectLine Speech channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.DirectLineSpeechChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "DirectLineSpeechChannel" - self.properties = properties - - -class DirectLineSpeechChannelProperties(_serialization.Model): - """The parameters to provide for the DirectLine Speech channel. - - :ivar cognitive_service_resource_id: The cognitive service id with this channel registration. - :vartype cognitive_service_resource_id: str - :ivar cognitive_service_region: The cognitive service region with this channel registration. - :vartype cognitive_service_region: str - :ivar cognitive_service_subscription_key: The cognitive service subscription key to use with - this channel registration. - :vartype cognitive_service_subscription_key: str - :ivar is_enabled: Whether this channel is enabled or not. - :vartype is_enabled: bool - :ivar custom_voice_deployment_id: Custom speech model id (optional). - :vartype custom_voice_deployment_id: str - :ivar custom_speech_model_id: Custom voice deployment id (optional). - :vartype custom_speech_model_id: str - :ivar is_default_bot_for_cog_svc_account: Make this a default bot for chosen cognitive service - account. - :vartype is_default_bot_for_cog_svc_account: bool - """ - - _attribute_map = { - "cognitive_service_resource_id": {"key": "cognitiveServiceResourceId", "type": "str"}, - "cognitive_service_region": {"key": "cognitiveServiceRegion", "type": "str"}, - "cognitive_service_subscription_key": {"key": "cognitiveServiceSubscriptionKey", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "custom_voice_deployment_id": {"key": "customVoiceDeploymentId", "type": "str"}, - "custom_speech_model_id": {"key": "customSpeechModelId", "type": "str"}, - "is_default_bot_for_cog_svc_account": {"key": "isDefaultBotForCogSvcAccount", "type": "bool"}, - } - - def __init__( - self, - *, - cognitive_service_resource_id: Optional[str] = None, - cognitive_service_region: Optional[str] = None, - cognitive_service_subscription_key: Optional[str] = None, - is_enabled: Optional[bool] = None, - custom_voice_deployment_id: Optional[str] = None, - custom_speech_model_id: Optional[str] = None, - is_default_bot_for_cog_svc_account: Optional[bool] = None, - **kwargs - ): - """ - :keyword cognitive_service_resource_id: The cognitive service id with this channel - registration. - :paramtype cognitive_service_resource_id: str - :keyword cognitive_service_region: The cognitive service region with this channel registration. - :paramtype cognitive_service_region: str - :keyword cognitive_service_subscription_key: The cognitive service subscription key to use with - this channel registration. - :paramtype cognitive_service_subscription_key: str - :keyword is_enabled: Whether this channel is enabled or not. - :paramtype is_enabled: bool - :keyword custom_voice_deployment_id: Custom speech model id (optional). - :paramtype custom_voice_deployment_id: str - :keyword custom_speech_model_id: Custom voice deployment id (optional). - :paramtype custom_speech_model_id: str - :keyword is_default_bot_for_cog_svc_account: Make this a default bot for chosen cognitive - service account. - :paramtype is_default_bot_for_cog_svc_account: bool - """ - super().__init__(**kwargs) - self.cognitive_service_resource_id = cognitive_service_resource_id - self.cognitive_service_region = cognitive_service_region - self.cognitive_service_subscription_key = cognitive_service_subscription_key - self.is_enabled = is_enabled - self.custom_voice_deployment_id = custom_voice_deployment_id - self.custom_speech_model_id = custom_speech_model_id - self.is_default_bot_for_cog_svc_account = is_default_bot_for_cog_svc_account - - -class EmailChannel(Channel): - """Email channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to email channel resource. - :vartype properties: ~azure.mgmt.botservice.models.EmailChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "EmailChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.EmailChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to email channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.EmailChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "EmailChannel" - self.properties = properties - - -class EmailChannelProperties(_serialization.Model): - """The parameters to provide for the Email channel. - - All required parameters must be populated in order to send to Azure. - - :ivar email_address: The email address. Required. - :vartype email_address: str - :ivar auth_method: Email channel auth method. 0 Password (Default); 1 Graph. Known values are: - 0 and 1. - :vartype auth_method: float or ~azure.mgmt.botservice.models.EmailChannelAuthMethod - :ivar password: The password for the email address. Value only returned through POST to the - action Channel List API, otherwise empty. - :vartype password: str - :ivar magic_code: The magic code for setting up the modern authentication. - :vartype magic_code: str - :ivar is_enabled: Whether this channel is enabled for the bot. Required. - :vartype is_enabled: bool - """ - - _validation = { - "email_address": {"required": True}, - "is_enabled": {"required": True}, - } - - _attribute_map = { - "email_address": {"key": "emailAddress", "type": "str"}, - "auth_method": {"key": "authMethod", "type": "float"}, - "password": {"key": "password", "type": "str"}, - "magic_code": {"key": "magicCode", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - email_address: str, - is_enabled: bool, - auth_method: Optional[Union[float, "_models.EmailChannelAuthMethod"]] = None, - password: Optional[str] = None, - magic_code: Optional[str] = None, - **kwargs - ): - """ - :keyword email_address: The email address. Required. - :paramtype email_address: str - :keyword auth_method: Email channel auth method. 0 Password (Default); 1 Graph. Known values - are: 0 and 1. - :paramtype auth_method: float or ~azure.mgmt.botservice.models.EmailChannelAuthMethod - :keyword password: The password for the email address. Value only returned through POST to the - action Channel List API, otherwise empty. - :paramtype password: str - :keyword magic_code: The magic code for setting up the modern authentication. - :paramtype magic_code: str - :keyword is_enabled: Whether this channel is enabled for the bot. Required. - :paramtype is_enabled: bool - """ - super().__init__(**kwargs) - self.email_address = email_address - self.auth_method = auth_method - self.password = password - self.magic_code = magic_code - self.is_enabled = is_enabled - - -class Error(_serialization.Model): - """Bot Service error object. - - :ivar error: The error body. - :vartype error: ~azure.mgmt.botservice.models.ErrorBody - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorBody"}, - } - - def __init__(self, *, error: Optional["_models.ErrorBody"] = None, **kwargs): - """ - :keyword error: The error body. - :paramtype error: ~azure.mgmt.botservice.models.ErrorBody - """ - super().__init__(**kwargs) - self.error = error - - -class ErrorBody(_serialization.Model): - """Bot Service error body. - - All required parameters must be populated in order to send to Azure. - - :ivar code: error code. Required. - :vartype code: str - :ivar message: error message. Required. - :vartype 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: str, message: str, **kwargs): - """ - :keyword code: error code. Required. - :paramtype code: str - :keyword message: error message. Required. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class FacebookChannel(Channel): - """Facebook channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to bot facebook channel. - :vartype properties: ~azure.mgmt.botservice.models.FacebookChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "FacebookChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.FacebookChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to bot facebook channel. - :paramtype properties: ~azure.mgmt.botservice.models.FacebookChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "FacebookChannel" - self.properties = properties - - -class FacebookChannelProperties(_serialization.Model): - """The parameters to provide for the Facebook channel. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar verify_token: Verify token. Value only returned through POST to the action Channel List - API, otherwise empty. - :vartype verify_token: str - :ivar pages: The list of Facebook pages. - :vartype pages: list[~azure.mgmt.botservice.models.FacebookPage] - :ivar app_id: Facebook application id. Required. - :vartype app_id: str - :ivar app_secret: Facebook application secret. Value only returned through POST to the action - Channel List API, otherwise empty. - :vartype app_secret: str - :ivar callback_url: Callback Url. - :vartype callback_url: str - :ivar is_enabled: Whether this channel is enabled for the bot. Required. - :vartype is_enabled: bool - """ - - _validation = { - "verify_token": {"readonly": True}, - "app_id": {"required": True}, - "callback_url": {"readonly": True}, - "is_enabled": {"required": True}, - } - - _attribute_map = { - "verify_token": {"key": "verifyToken", "type": "str"}, - "pages": {"key": "pages", "type": "[FacebookPage]"}, - "app_id": {"key": "appId", "type": "str"}, - "app_secret": {"key": "appSecret", "type": "str"}, - "callback_url": {"key": "callbackUrl", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - app_id: str, - is_enabled: bool, - pages: Optional[List["_models.FacebookPage"]] = None, - app_secret: Optional[str] = None, - **kwargs - ): - """ - :keyword pages: The list of Facebook pages. - :paramtype pages: list[~azure.mgmt.botservice.models.FacebookPage] - :keyword app_id: Facebook application id. Required. - :paramtype app_id: str - :keyword app_secret: Facebook application secret. Value only returned through POST to the - action Channel List API, otherwise empty. - :paramtype app_secret: str - :keyword is_enabled: Whether this channel is enabled for the bot. Required. - :paramtype is_enabled: bool - """ - super().__init__(**kwargs) - self.verify_token = None - self.pages = pages - self.app_id = app_id - self.app_secret = app_secret - self.callback_url = None - self.is_enabled = is_enabled - - -class FacebookPage(_serialization.Model): - """A Facebook page for Facebook channel registration. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Page id. Required. - :vartype id: str - :ivar access_token: Facebook application access token. Value only returned through POST to the - action Channel List API, otherwise empty. - :vartype access_token: str - """ - - _validation = { - "id": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "access_token": {"key": "accessToken", "type": "str"}, - } - - def __init__(self, *, id: str, access_token: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin - """ - :keyword id: Page id. Required. - :paramtype id: str - :keyword access_token: Facebook application access token. Value only returned through POST to - the action Channel List API, otherwise empty. - :paramtype access_token: str - """ - super().__init__(**kwargs) - self.id = id - self.access_token = access_token - - -class HostSettingsResponse(_serialization.Model): - """The response body returned for a request to Bot Service Management to check per subscription hostSettings. - - :ivar o_auth_url: For in-conversation bot user authentication. - :vartype o_auth_url: str - :ivar to_bot_from_channel_open_id_metadata_url: For verifying incoming tokens from the - channels. - :vartype to_bot_from_channel_open_id_metadata_url: str - :ivar to_bot_from_channel_token_issuer: For verifying incoming tokens from the channels. - :vartype to_bot_from_channel_token_issuer: str - :ivar to_bot_from_emulator_open_id_metadata_url: For verifying incoming tokens from bot - emulator. - :vartype to_bot_from_emulator_open_id_metadata_url: str - :ivar to_channel_from_bot_login_url: For getting access token to channels from bot host. - :vartype to_channel_from_bot_login_url: str - :ivar to_channel_from_bot_o_auth_scope: For getting access token to channels from bot host. - :vartype to_channel_from_bot_o_auth_scope: str - :ivar validate_authority: Per cloud OAuth setting on whether authority is validated. - :vartype validate_authority: bool - :ivar bot_open_id_metadata: Same as toBotFromChannelOpenIdMetadataUrl, used by SDK < v4.12. - :vartype bot_open_id_metadata: str - """ - - _attribute_map = { - "o_auth_url": {"key": "OAuthUrl", "type": "str"}, - "to_bot_from_channel_open_id_metadata_url": {"key": "ToBotFromChannelOpenIdMetadataUrl", "type": "str"}, - "to_bot_from_channel_token_issuer": {"key": "ToBotFromChannelTokenIssuer", "type": "str"}, - "to_bot_from_emulator_open_id_metadata_url": {"key": "ToBotFromEmulatorOpenIdMetadataUrl", "type": "str"}, - "to_channel_from_bot_login_url": {"key": "ToChannelFromBotLoginUrl", "type": "str"}, - "to_channel_from_bot_o_auth_scope": {"key": "ToChannelFromBotOAuthScope", "type": "str"}, - "validate_authority": {"key": "ValidateAuthority", "type": "bool"}, - "bot_open_id_metadata": {"key": "BotOpenIdMetadata", "type": "str"}, - } - - def __init__( - self, - *, - o_auth_url: Optional[str] = None, - to_bot_from_channel_open_id_metadata_url: Optional[str] = None, - to_bot_from_channel_token_issuer: Optional[str] = None, - to_bot_from_emulator_open_id_metadata_url: Optional[str] = None, - to_channel_from_bot_login_url: Optional[str] = None, - to_channel_from_bot_o_auth_scope: Optional[str] = None, - validate_authority: Optional[bool] = None, - bot_open_id_metadata: Optional[str] = None, - **kwargs - ): - """ - :keyword o_auth_url: For in-conversation bot user authentication. - :paramtype o_auth_url: str - :keyword to_bot_from_channel_open_id_metadata_url: For verifying incoming tokens from the - channels. - :paramtype to_bot_from_channel_open_id_metadata_url: str - :keyword to_bot_from_channel_token_issuer: For verifying incoming tokens from the channels. - :paramtype to_bot_from_channel_token_issuer: str - :keyword to_bot_from_emulator_open_id_metadata_url: For verifying incoming tokens from bot - emulator. - :paramtype to_bot_from_emulator_open_id_metadata_url: str - :keyword to_channel_from_bot_login_url: For getting access token to channels from bot host. - :paramtype to_channel_from_bot_login_url: str - :keyword to_channel_from_bot_o_auth_scope: For getting access token to channels from bot host. - :paramtype to_channel_from_bot_o_auth_scope: str - :keyword validate_authority: Per cloud OAuth setting on whether authority is validated. - :paramtype validate_authority: bool - :keyword bot_open_id_metadata: Same as toBotFromChannelOpenIdMetadataUrl, used by SDK < v4.12. - :paramtype bot_open_id_metadata: str - """ - super().__init__(**kwargs) - self.o_auth_url = o_auth_url - self.to_bot_from_channel_open_id_metadata_url = to_bot_from_channel_open_id_metadata_url - self.to_bot_from_channel_token_issuer = to_bot_from_channel_token_issuer - self.to_bot_from_emulator_open_id_metadata_url = to_bot_from_emulator_open_id_metadata_url - self.to_channel_from_bot_login_url = to_channel_from_bot_login_url - self.to_channel_from_bot_o_auth_scope = to_channel_from_bot_o_auth_scope - self.validate_authority = validate_authority - self.bot_open_id_metadata = bot_open_id_metadata - - -class KikChannel(Channel): - """Kik channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to Kik channel resource. - :vartype properties: ~azure.mgmt.botservice.models.KikChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "KikChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.KikChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to Kik channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.KikChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "KikChannel" - self.properties = properties - - -class KikChannelProperties(_serialization.Model): - """The parameters to provide for the Kik channel. - - All required parameters must be populated in order to send to Azure. - - :ivar user_name: The Kik user name. Required. - :vartype user_name: str - :ivar api_key: Kik API key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype api_key: str - :ivar is_validated: Whether this channel is validated for the bot. - :vartype is_validated: bool - :ivar is_enabled: Whether this channel is enabled for the bot. Required. - :vartype is_enabled: bool - """ - - _validation = { - "user_name": {"required": True}, - "is_enabled": {"required": True}, - } - - _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, - "api_key": {"key": "apiKey", "type": "str"}, - "is_validated": {"key": "isValidated", "type": "bool"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - user_name: str, - is_enabled: bool, - api_key: Optional[str] = None, - is_validated: Optional[bool] = None, - **kwargs - ): - """ - :keyword user_name: The Kik user name. Required. - :paramtype user_name: str - :keyword api_key: Kik API key. Value only returned through POST to the action Channel List API, - otherwise empty. - :paramtype api_key: str - :keyword is_validated: Whether this channel is validated for the bot. - :paramtype is_validated: bool - :keyword is_enabled: Whether this channel is enabled for the bot. Required. - :paramtype is_enabled: bool - """ - super().__init__(**kwargs) - self.user_name = user_name - self.api_key = api_key - self.is_validated = is_validated - self.is_enabled = is_enabled - - -class LineChannel(Channel): - """Line channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to line channel resource. - :vartype properties: ~azure.mgmt.botservice.models.LineChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "LineChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.LineChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to line channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.LineChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "LineChannel" - self.properties = properties - - -class LineChannelProperties(_serialization.Model): - """The parameters to provide for the Line channel. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar line_registrations: The list of line channel registrations. Required. - :vartype line_registrations: list[~azure.mgmt.botservice.models.LineRegistration] - :ivar callback_url: Callback Url to enter in line registration. - :vartype callback_url: str - :ivar is_validated: Whether this channel is validated for the bot. - :vartype is_validated: bool - """ - - _validation = { - "line_registrations": {"required": True}, - "callback_url": {"readonly": True}, - "is_validated": {"readonly": True}, - } - - _attribute_map = { - "line_registrations": {"key": "lineRegistrations", "type": "[LineRegistration]"}, - "callback_url": {"key": "callbackUrl", "type": "str"}, - "is_validated": {"key": "isValidated", "type": "bool"}, - } - - def __init__(self, *, line_registrations: List["_models.LineRegistration"], **kwargs): - """ - :keyword line_registrations: The list of line channel registrations. Required. - :paramtype line_registrations: list[~azure.mgmt.botservice.models.LineRegistration] - """ - super().__init__(**kwargs) - self.line_registrations = line_registrations - self.callback_url = None - self.is_validated = None - - -class LineRegistration(_serialization.Model): - """The properties corresponding to a line channel registration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar generated_id: Id generated for the line channel registration. - :vartype generated_id: str - :ivar channel_secret: Secret for the line channel registration. - :vartype channel_secret: str - :ivar channel_access_token: Access token for the line channel registration. - :vartype channel_access_token: str - """ - - _validation = { - "generated_id": {"readonly": True}, - } - - _attribute_map = { - "generated_id": {"key": "generatedId", "type": "str"}, - "channel_secret": {"key": "channelSecret", "type": "str"}, - "channel_access_token": {"key": "channelAccessToken", "type": "str"}, - } - - def __init__(self, *, channel_secret: Optional[str] = None, channel_access_token: Optional[str] = None, **kwargs): - """ - :keyword channel_secret: Secret for the line channel registration. - :paramtype channel_secret: str - :keyword channel_access_token: Access token for the line channel registration. - :paramtype channel_access_token: str - """ - super().__init__(**kwargs) - self.generated_id = None - self.channel_secret = channel_secret - self.channel_access_token = channel_access_token - - -class ListChannelWithKeysResponse(BotChannel): # pylint: disable=too-many-instance-attributes - """The ARM channel of list channel with keys operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Specifies the resource ID. - :vartype id: str - :ivar name: Specifies the name of the resource. - :vartype name: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar type: Specifies the type of the resource. - :vartype type: str - :ivar tags: Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: Gets or sets the SKU of the resource. - :vartype sku: ~azure.mgmt.botservice.models.Sku - :ivar kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". - :vartype kind: str or ~azure.mgmt.botservice.models.Kind - :ivar etag: Entity Tag. - :vartype etag: str - :ivar zones: Entity zones. - :vartype zones: list[str] - :ivar properties: The set of properties specific to bot channel resource. - :vartype properties: ~azure.mgmt.botservice.models.Channel - :ivar resource: The set of properties specific to bot channel resource. - :vartype resource: ~azure.mgmt.botservice.models.Channel - :ivar setting: Channel settings. - :vartype setting: ~azure.mgmt.botservice.models.ChannelSettings - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar entity_tag: Entity tag of the resource. - :vartype entity_tag: str - :ivar changed_time: Changed time of the resource. - :vartype changed_time: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "zones": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "Sku"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "zones": {"key": "zones", "type": "[str]"}, - "properties": {"key": "properties", "type": "Channel"}, - "resource": {"key": "resource", "type": "Channel"}, - "setting": {"key": "setting", "type": "ChannelSettings"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "entity_tag": {"key": "entityTag", "type": "str"}, - "changed_time": {"key": "changedTime", "type": "str"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - kind: Optional[Union[str, "_models.Kind"]] = None, - etag: Optional[str] = None, - properties: Optional["_models.Channel"] = None, - resource: Optional["_models.Channel"] = None, - setting: Optional["_models.ChannelSettings"] = None, - provisioning_state: Optional[str] = None, - entity_tag: Optional[str] = None, - changed_time: Optional[str] = None, - **kwargs - ): - """ - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword tags: Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: Gets or sets the SKU of the resource. - :paramtype sku: ~azure.mgmt.botservice.models.Sku - :keyword kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". - :paramtype kind: str or ~azure.mgmt.botservice.models.Kind - :keyword etag: Entity Tag. - :paramtype etag: str - :keyword properties: The set of properties specific to bot channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.Channel - :keyword resource: The set of properties specific to bot channel resource. - :paramtype resource: ~azure.mgmt.botservice.models.Channel - :keyword setting: Channel settings. - :paramtype setting: ~azure.mgmt.botservice.models.ChannelSettings - :keyword provisioning_state: Provisioning state of the resource. - :paramtype provisioning_state: str - :keyword entity_tag: Entity tag of the resource. - :paramtype entity_tag: str - :keyword changed_time: Changed time of the resource. - :paramtype changed_time: str - """ - super().__init__(location=location, tags=tags, sku=sku, kind=kind, etag=etag, properties=properties, **kwargs) - self.resource = resource - self.setting = setting - self.provisioning_state = provisioning_state - self.entity_tag = entity_tag - self.changed_time = changed_time - - -class M365Extensions(Channel): - """M365 Extensions definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "M365Extensions" - - -class MsTeamsChannel(Channel): - """Microsoft Teams channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to Microsoft Teams channel resource. - :vartype properties: ~azure.mgmt.botservice.models.MsTeamsChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "MsTeamsChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.MsTeamsChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to Microsoft Teams channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.MsTeamsChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "MsTeamsChannel" - self.properties = properties - - -class MsTeamsChannelProperties(_serialization.Model): - """The parameters to provide for the Microsoft Teams channel. - - All required parameters must be populated in order to send to Azure. - - :ivar enable_calling: Enable calling for Microsoft Teams channel. - :vartype enable_calling: bool - :ivar calling_webhook: Webhook for Microsoft Teams channel calls. - :vartype calling_webhook: str - :ivar is_enabled: Whether this channel is enabled for the bot. Required. - :vartype is_enabled: bool - :ivar incoming_call_route: Webhook for Microsoft Teams channel calls. - :vartype incoming_call_route: str - :ivar deployment_environment: Deployment environment for Microsoft Teams channel calls. - :vartype deployment_environment: str - :ivar accepted_terms: Whether this channel accepted terms. - :vartype accepted_terms: bool - """ - - _validation = { - "is_enabled": {"required": True}, - } - - _attribute_map = { - "enable_calling": {"key": "enableCalling", "type": "bool"}, - "calling_webhook": {"key": "callingWebhook", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "incoming_call_route": {"key": "incomingCallRoute", "type": "str"}, - "deployment_environment": {"key": "deploymentEnvironment", "type": "str"}, - "accepted_terms": {"key": "acceptedTerms", "type": "bool"}, - } - - def __init__( - self, - *, - is_enabled: bool, - enable_calling: bool = False, - calling_webhook: Optional[str] = None, - incoming_call_route: Optional[str] = None, - deployment_environment: str = "FallbackDeploymentEnvironment", - accepted_terms: Optional[bool] = None, - **kwargs - ): - """ - :keyword enable_calling: Enable calling for Microsoft Teams channel. - :paramtype enable_calling: bool - :keyword calling_webhook: Webhook for Microsoft Teams channel calls. - :paramtype calling_webhook: str - :keyword is_enabled: Whether this channel is enabled for the bot. Required. - :paramtype is_enabled: bool - :keyword incoming_call_route: Webhook for Microsoft Teams channel calls. - :paramtype incoming_call_route: str - :keyword deployment_environment: Deployment environment for Microsoft Teams channel calls. - :paramtype deployment_environment: str - :keyword accepted_terms: Whether this channel accepted terms. - :paramtype accepted_terms: bool - """ - super().__init__(**kwargs) - self.enable_calling = enable_calling - self.calling_webhook = calling_webhook - self.is_enabled = is_enabled - self.incoming_call_route = incoming_call_route - self.deployment_environment = deployment_environment - self.accepted_terms = accepted_terms - - -class Omnichannel(Channel): - """Omnichannel channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "Omnichannel" - - -class OperationDisplayInfo(_serialization.Model): - """The operation supported by Bot Service Management. - - :ivar description: The description of the operation. - :vartype description: str - :ivar operation: The action that users can perform, based on their permission level. - :vartype operation: str - :ivar provider: Service provider: Microsoft Bot Service. - :vartype provider: str - :ivar resource: Resource on which the operation is performed. - :vartype resource: str - """ - - _attribute_map = { - "description": {"key": "description", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - } - - def __init__( - self, - *, - description: Optional[str] = None, - operation: Optional[str] = None, - provider: Optional[str] = None, - resource: Optional[str] = None, - **kwargs - ): - """ - :keyword description: The description of the operation. - :paramtype description: str - :keyword operation: The action that users can perform, based on their permission level. - :paramtype operation: str - :keyword provider: Service provider: Microsoft Bot Service. - :paramtype provider: str - :keyword resource: Resource on which the operation is performed. - :paramtype resource: str - """ - super().__init__(**kwargs) - self.description = description - self.operation = operation - self.provider = provider - self.resource = resource - - -class OperationEntity(_serialization.Model): - """The operations supported by Bot Service Management. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The operation supported by Bot Service Management. - :vartype display: ~azure.mgmt.botservice.models.OperationDisplayInfo - :ivar origin: The origin of the operation. - :vartype origin: str - :ivar properties: Additional properties. - :vartype properties: JSON - """ - - _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: Optional[str] = None, - display: Optional["_models.OperationDisplayInfo"] = None, - origin: Optional[str] = None, - properties: Optional[JSON] = None, - **kwargs - ): - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The operation supported by Bot Service Management. - :paramtype display: ~azure.mgmt.botservice.models.OperationDisplayInfo - :keyword origin: The origin of the operation. - :paramtype origin: str - :keyword properties: Additional properties. - :paramtype properties: JSON - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.origin = origin - self.properties = properties - - -class OperationEntityListResult(_serialization.Model): - """The list of bot service operation response. - - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - :ivar value: The list of operations. - :vartype value: list[~azure.mgmt.botservice.models.OperationEntity] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[OperationEntity]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.OperationEntity"]] = None, **kwargs - ): - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - :keyword value: The list of operations. - :paramtype value: list[~azure.mgmt.botservice.models.OperationEntity] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class OperationResultsDescription(_serialization.Model): - """The properties indicating the operation result of an operation on a service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the operation returned. - :vartype id: str - :ivar name: The name of the operation result. - :vartype name: str - :ivar status: The status of the operation being performed. Known values are: "Canceled", - "Succeeded", "Failed", "Requested", and "Running". - :vartype status: str or ~azure.mgmt.botservice.models.OperationResultStatus - :ivar start_time: The time that the operation was started. - :vartype start_time: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "status": {"readonly": True}, - "start_time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.status = None - self.start_time = None - - -class OutlookChannel(Channel): - """Outlook channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "OutlookChannel" - - -class PrivateEndpoint(_serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _validation = { - "id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.id = None - - -class PrivateLinkResourceBase(_serialization.Model): - """Common fields that are returned in the response for all BotService Private Link Resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class PrivateEndpointConnection(PrivateLinkResourceBase): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar private_endpoint: The resource of private end point. - :vartype private_endpoint: ~azure.mgmt.botservice.models.PrivateEndpoint - :ivar private_link_service_connection_state: A collection of information about the state of the - connection between service consumer and provider. - :vartype private_link_service_connection_state: - ~azure.mgmt.botservice.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Known values are: "Succeeded", "Creating", "Deleting", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.botservice.models.PrivateEndpointConnectionProvisioningState - :ivar group_ids: Group ids. - :vartype group_ids: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, - "private_link_service_connection_state": { - "key": "properties.privateLinkServiceConnectionState", - "type": "PrivateLinkServiceConnectionState", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "group_ids": {"key": "properties.groupIds", "type": "[str]"}, - } - - def __init__( - self, - *, - private_endpoint: Optional["_models.PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - group_ids: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword private_endpoint: The resource of private end point. - :paramtype private_endpoint: ~azure.mgmt.botservice.models.PrivateEndpoint - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.botservice.models.PrivateLinkServiceConnectionState - :keyword group_ids: Group ids. - :paramtype group_ids: list[str] - """ - super().__init__(**kwargs) - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None - self.group_ids = group_ids - - -class PrivateEndpointConnectionListResult(_serialization.Model): - """List of private endpoint connection associated with the specified storage account. - - :ivar value: Array of private endpoint connections. - :vartype value: list[~azure.mgmt.botservice.models.PrivateEndpointConnection] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, - } - - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): - """ - :keyword value: Array of private endpoint connections. - :paramtype value: list[~azure.mgmt.botservice.models.PrivateEndpointConnection] - """ - super().__init__(**kwargs) - self.value = value - - -class PrivateLinkResource(PrivateLinkResourceBase): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource Private link DNS zone name. - :vartype required_zone_names: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "group_id": {"readonly": True}, - "required_members": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "group_id": {"key": "properties.groupId", "type": "str"}, - "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, - "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, - } - - def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs): - """ - :keyword required_zone_names: The private link resource Private link DNS zone name. - :paramtype required_zone_names: list[str] - """ - super().__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = required_zone_names - - -class PrivateLinkResourceListResult(_serialization.Model): - """A list of private link resources. - - :ivar value: Array of private link resources. - :vartype value: list[~azure.mgmt.botservice.models.PrivateLinkResource] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateLinkResource]"}, - } - - def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): - """ - :keyword value: Array of private link resources. - :paramtype value: list[~azure.mgmt.botservice.models.PrivateLinkResource] - """ - super().__init__(**kwargs) - self.value = value - - -class PrivateLinkServiceConnectionState(_serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Known values are: "Pending", "Approved", and "Rejected". - :vartype status: str or ~azure.mgmt.botservice.models.PrivateEndpointServiceConnectionStatus - :ivar description: The reason for approval/rejection of the connection. - :vartype description: str - :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :vartype actions_required: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "actions_required": {"key": "actionsRequired", "type": "str"}, - } - - def __init__( - self, - *, - status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, - description: Optional[str] = None, - actions_required: Optional[str] = None, - **kwargs - ): - """ - :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Known values are: "Pending", "Approved", and "Rejected". - :paramtype status: str or ~azure.mgmt.botservice.models.PrivateEndpointServiceConnectionStatus - :keyword description: The reason for approval/rejection of the connection. - :paramtype description: str - :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :paramtype actions_required: str - """ - super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = actions_required - - -class QnAMakerEndpointKeysRequestBody(_serialization.Model): - """The request body for a request to Bot Service Management to list QnA Maker endpoint keys. - - :ivar hostname: the host name of the QnA Maker endpoint. - :vartype hostname: str - :ivar authkey: Subscription key which provides access to this API. - :vartype authkey: str - """ - - _attribute_map = { - "hostname": {"key": "hostname", "type": "str"}, - "authkey": {"key": "authkey", "type": "str"}, - } - - def __init__(self, *, hostname: Optional[str] = None, authkey: Optional[str] = None, **kwargs): - """ - :keyword hostname: the host name of the QnA Maker endpoint. - :paramtype hostname: str - :keyword authkey: Subscription key which provides access to this API. - :paramtype authkey: str - """ - super().__init__(**kwargs) - self.hostname = hostname - self.authkey = authkey - - -class QnAMakerEndpointKeysResponse(_serialization.Model): - """Schema for EndpointKeys generate/refresh operations. - - :ivar primary_endpoint_key: Primary Access Key. - :vartype primary_endpoint_key: str - :ivar secondary_endpoint_key: Secondary Access Key. - :vartype secondary_endpoint_key: str - :ivar installed_version: Current version of runtime. - :vartype installed_version: str - :ivar last_stable_version: Latest version of runtime. - :vartype last_stable_version: str - """ - - _attribute_map = { - "primary_endpoint_key": {"key": "primaryEndpointKey", "type": "str"}, - "secondary_endpoint_key": {"key": "secondaryEndpointKey", "type": "str"}, - "installed_version": {"key": "installedVersion", "type": "str"}, - "last_stable_version": {"key": "lastStableVersion", "type": "str"}, - } - - def __init__( - self, - *, - primary_endpoint_key: Optional[str] = None, - secondary_endpoint_key: Optional[str] = None, - installed_version: Optional[str] = None, - last_stable_version: Optional[str] = None, - **kwargs - ): - """ - :keyword primary_endpoint_key: Primary Access Key. - :paramtype primary_endpoint_key: str - :keyword secondary_endpoint_key: Secondary Access Key. - :paramtype secondary_endpoint_key: str - :keyword installed_version: Current version of runtime. - :paramtype installed_version: str - :keyword last_stable_version: Latest version of runtime. - :paramtype last_stable_version: str - """ - super().__init__(**kwargs) - self.primary_endpoint_key = primary_endpoint_key - self.secondary_endpoint_key = secondary_endpoint_key - self.installed_version = installed_version - self.last_stable_version = last_stable_version - - -class SearchAssistant(Channel): - """SearchAssistant definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, etag: Optional[str] = None, location: str = "global", **kwargs): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "SearchAssistant" - - -class ServiceProvider(_serialization.Model): - """Service Provider Definition. - - :ivar properties: The Properties of a Service Provider Object. - :vartype properties: ~azure.mgmt.botservice.models.ServiceProviderProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "ServiceProviderProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ServiceProviderProperties"] = None, **kwargs): - """ - :keyword properties: The Properties of a Service Provider Object. - :paramtype properties: ~azure.mgmt.botservice.models.ServiceProviderProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ServiceProviderParameter(_serialization.Model): - """Extra Parameters specific to each Service Provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Service Provider. - :vartype name: str - :ivar type: Type of the Service Provider. - :vartype type: str - :ivar display_name: Display Name of the Service Provider. - :vartype display_name: str - :ivar description: Description of the Service Provider. - :vartype description: str - :ivar help_url: Help Url for the Service Provider. - :vartype help_url: str - :ivar default: Default Name for the Service Provider. - :vartype default: str - :ivar metadata: Meta data for the Service Provider. - :vartype metadata: ~azure.mgmt.botservice.models.ServiceProviderParameterMetadata - """ - - _validation = { - "name": {"readonly": True}, - "type": {"readonly": True}, - "display_name": {"readonly": True}, - "description": {"readonly": True}, - "help_url": {"readonly": True}, - "default": {"readonly": True}, - "metadata": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "help_url": {"key": "helpUrl", "type": "str"}, - "default": {"key": "default", "type": "str"}, - "metadata": {"key": "metadata", "type": "ServiceProviderParameterMetadata"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.name = None - self.type = None - self.display_name = None - self.description = None - self.help_url = None - self.default = None - self.metadata = None - - -class ServiceProviderParameterMetadata(_serialization.Model): - """Meta data for the Service Provider. - - :ivar constraints: the constraints of the bot meta data. - :vartype constraints: ~azure.mgmt.botservice.models.ServiceProviderParameterMetadataConstraints - """ - - _attribute_map = { - "constraints": {"key": "constraints", "type": "ServiceProviderParameterMetadataConstraints"}, - } - - def __init__( - self, *, constraints: Optional["_models.ServiceProviderParameterMetadataConstraints"] = None, **kwargs - ): - """ - :keyword constraints: the constraints of the bot meta data. - :paramtype constraints: - ~azure.mgmt.botservice.models.ServiceProviderParameterMetadataConstraints - """ - super().__init__(**kwargs) - self.constraints = constraints - - -class ServiceProviderParameterMetadataConstraints(_serialization.Model): - """the constraints of the bot meta data. - - :ivar required: Whether required the constraints of the bot meta data. - :vartype required: bool - """ - - _attribute_map = { - "required": {"key": "required", "type": "bool"}, - } - - def __init__(self, *, required: Optional[bool] = None, **kwargs): - """ - :keyword required: Whether required the constraints of the bot meta data. - :paramtype required: bool - """ - super().__init__(**kwargs) - self.required = required - - -class ServiceProviderProperties(_serialization.Model): - """The Object used to describe a Service Provider supported by Bot Service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Id for Service Provider. - :vartype id: str - :ivar display_name: Display Name of the Service Provider. - :vartype display_name: str - :ivar service_provider_name: Name of the Service Provider. - :vartype service_provider_name: str - :ivar dev_portal_url: URL of Dev Portal. - :vartype dev_portal_url: str - :ivar icon_url: The URL of icon. - :vartype icon_url: str - :ivar parameters: The list of parameters for the Service Provider. - :vartype parameters: list[~azure.mgmt.botservice.models.ServiceProviderParameter] - """ - - _validation = { - "id": {"readonly": True}, - "display_name": {"readonly": True}, - "service_provider_name": {"readonly": True}, - "dev_portal_url": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "service_provider_name": {"key": "serviceProviderName", "type": "str"}, - "dev_portal_url": {"key": "devPortalUrl", "type": "str"}, - "icon_url": {"key": "iconUrl", "type": "str"}, - "parameters": {"key": "parameters", "type": "[ServiceProviderParameter]"}, - } - - def __init__( - self, *, icon_url: str = "", parameters: Optional[List["_models.ServiceProviderParameter"]] = None, **kwargs - ): - """ - :keyword icon_url: The URL of icon. - :paramtype icon_url: str - :keyword parameters: The list of parameters for the Service Provider. - :paramtype parameters: list[~azure.mgmt.botservice.models.ServiceProviderParameter] - """ - super().__init__(**kwargs) - self.id = None - self.display_name = None - self.service_provider_name = None - self.dev_portal_url = None - self.icon_url = icon_url - self.parameters = parameters - - -class ServiceProviderResponseList(_serialization.Model): - """The list of bot service providers response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar next_link: The link used to get the next page of bot service providers. - :vartype next_link: str - :ivar value: Gets the list of bot service providers and their properties. - :vartype value: list[~azure.mgmt.botservice.models.ServiceProvider] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ServiceProvider]"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs): - """ - :keyword next_link: The link used to get the next page of bot service providers. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = None - - -class SiteInfo(_serialization.Model): - """Site information for WebChat or DirectLine Channels to identify which site to regenerate keys for. - - All required parameters must be populated in order to send to Azure. - - :ivar site_name: The site name. Required. - :vartype site_name: str - :ivar key: Determines which key is to be regenerated. Required. Known values are: "key1" and - "key2". - :vartype key: str or ~azure.mgmt.botservice.models.Key - """ - - _validation = { - "site_name": {"required": True}, - "key": {"required": True}, - } - - _attribute_map = { - "site_name": {"key": "siteName", "type": "str"}, - "key": {"key": "key", "type": "str"}, - } - - def __init__(self, *, site_name: str, key: Union[str, "_models.Key"], **kwargs): - """ - :keyword site_name: The site name. Required. - :paramtype site_name: str - :keyword key: Determines which key is to be regenerated. Required. Known values are: "key1" and - "key2". - :paramtype key: str or ~azure.mgmt.botservice.models.Key - """ - super().__init__(**kwargs) - self.site_name = site_name - self.key = key - - -class Sku(_serialization.Model): - """The SKU of the cognitive services account. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar name: The sku name. Required. Known values are: "F0" and "S1". - :vartype name: str or ~azure.mgmt.botservice.models.SkuName - :ivar tier: Gets the sku tier. This is based on the SKU name. Known values are: "Free" and - "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: Union[str, "_models.SkuName"], **kwargs): - """ - :keyword name: The sku name. Required. Known values are: "F0" and "S1". - :paramtype name: str or ~azure.mgmt.botservice.models.SkuName - """ - super().__init__(**kwargs) - self.name = name - self.tier = None - - -class SkypeChannel(Channel): - """Skype channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to Skype channel resource. - :vartype properties: ~azure.mgmt.botservice.models.SkypeChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "SkypeChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.SkypeChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to Skype channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.SkypeChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "SkypeChannel" - self.properties = properties - - -class SkypeChannelProperties(_serialization.Model): - """The parameters to provide for the Microsoft Teams channel. - - All required parameters must be populated in order to send to Azure. - - :ivar enable_messaging: Enable messaging for Skype channel. - :vartype enable_messaging: bool - :ivar enable_media_cards: Enable media cards for Skype channel. - :vartype enable_media_cards: bool - :ivar enable_video: Enable video for Skype channel. - :vartype enable_video: bool - :ivar enable_calling: Enable calling for Skype channel. - :vartype enable_calling: bool - :ivar enable_screen_sharing: Enable screen sharing for Skype channel. - :vartype enable_screen_sharing: bool - :ivar enable_groups: Enable groups for Skype channel. - :vartype enable_groups: bool - :ivar groups_mode: Group mode for Skype channel. - :vartype groups_mode: str - :ivar calling_web_hook: Calling web hook for Skype channel. - :vartype calling_web_hook: str - :ivar incoming_call_route: Incoming call route for Skype channel. - :vartype incoming_call_route: str - :ivar is_enabled: Whether this channel is enabled for the bot. Required. - :vartype 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"}, - "incoming_call_route": {"key": "incomingCallRoute", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - is_enabled: bool, - enable_messaging: Optional[bool] = None, - enable_media_cards: Optional[bool] = None, - enable_video: Optional[bool] = None, - enable_calling: bool = False, - enable_screen_sharing: Optional[bool] = None, - enable_groups: Optional[bool] = None, - groups_mode: Optional[str] = None, - calling_web_hook: Optional[str] = None, - incoming_call_route: Optional[str] = None, - **kwargs - ): - """ - :keyword enable_messaging: Enable messaging for Skype channel. - :paramtype enable_messaging: bool - :keyword enable_media_cards: Enable media cards for Skype channel. - :paramtype enable_media_cards: bool - :keyword enable_video: Enable video for Skype channel. - :paramtype enable_video: bool - :keyword enable_calling: Enable calling for Skype channel. - :paramtype enable_calling: bool - :keyword enable_screen_sharing: Enable screen sharing for Skype channel. - :paramtype enable_screen_sharing: bool - :keyword enable_groups: Enable groups for Skype channel. - :paramtype enable_groups: bool - :keyword groups_mode: Group mode for Skype channel. - :paramtype groups_mode: str - :keyword calling_web_hook: Calling web hook for Skype channel. - :paramtype calling_web_hook: str - :keyword incoming_call_route: Incoming call route for Skype channel. - :paramtype incoming_call_route: str - :keyword is_enabled: Whether this channel is enabled for the bot. Required. - :paramtype is_enabled: bool - """ - super().__init__(**kwargs) - 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.incoming_call_route = incoming_call_route - self.is_enabled = is_enabled - - -class SlackChannel(Channel): - """Slack channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to Slack channel resource. - :vartype properties: ~azure.mgmt.botservice.models.SlackChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "SlackChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.SlackChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to Slack channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.SlackChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "SlackChannel" - self.properties = properties - - -class SlackChannelProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """The parameters to provide for the Slack channel. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar client_id: The Slack client id. - :vartype client_id: str - :ivar client_secret: The Slack client secret. Value only returned through POST to the action - Channel List API, otherwise empty. - :vartype client_secret: str - :ivar verification_token: The Slack verification token. Value only returned through POST to the - action Channel List API, otherwise empty. - :vartype verification_token: str - :ivar scopes: The Slack permission scopes. - :vartype scopes: str - :ivar landing_page_url: The Slack landing page Url. - :vartype landing_page_url: str - :ivar redirect_action: The Slack redirect action. - :vartype redirect_action: str - :ivar last_submission_id: The Sms auth token. - :vartype last_submission_id: str - :ivar register_before_o_auth_flow: Whether to register the settings before OAuth validation is - performed. Recommended to True. - :vartype register_before_o_auth_flow: bool - :ivar is_validated: Whether this channel is validated for the bot. - :vartype is_validated: bool - :ivar signing_secret: The Slack signing secret. - :vartype signing_secret: str - :ivar is_enabled: Whether this channel is enabled for the bot. Required. - :vartype is_enabled: bool - """ - - _validation = { - "redirect_action": {"readonly": True}, - "last_submission_id": {"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"}, - "scopes": {"key": "scopes", "type": "str"}, - "landing_page_url": {"key": "landingPageUrl", "type": "str"}, - "redirect_action": {"key": "redirectAction", "type": "str"}, - "last_submission_id": {"key": "lastSubmissionId", "type": "str"}, - "register_before_o_auth_flow": {"key": "registerBeforeOAuthFlow", "type": "bool"}, - "is_validated": {"key": "IsValidated", "type": "bool"}, - "signing_secret": {"key": "signingSecret", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - is_enabled: bool, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - verification_token: Optional[str] = None, - scopes: Optional[str] = None, - landing_page_url: Optional[str] = None, - register_before_o_auth_flow: Optional[bool] = None, - signing_secret: Optional[str] = None, - **kwargs - ): - """ - :keyword client_id: The Slack client id. - :paramtype client_id: str - :keyword client_secret: The Slack client secret. Value only returned through POST to the action - Channel List API, otherwise empty. - :paramtype client_secret: str - :keyword verification_token: The Slack verification token. Value only returned through POST to - the action Channel List API, otherwise empty. - :paramtype verification_token: str - :keyword scopes: The Slack permission scopes. - :paramtype scopes: str - :keyword landing_page_url: The Slack landing page Url. - :paramtype landing_page_url: str - :keyword register_before_o_auth_flow: Whether to register the settings before OAuth validation - is performed. Recommended to True. - :paramtype register_before_o_auth_flow: bool - :keyword signing_secret: The Slack signing secret. - :paramtype signing_secret: str - :keyword is_enabled: Whether this channel is enabled for the bot. Required. - :paramtype is_enabled: bool - """ - super().__init__(**kwargs) - self.client_id = client_id - self.client_secret = client_secret - self.verification_token = verification_token - self.scopes = scopes - self.landing_page_url = landing_page_url - self.redirect_action = None - self.last_submission_id = None - self.register_before_o_auth_flow = register_before_o_auth_flow - self.is_validated = None - self.signing_secret = signing_secret - self.is_enabled = is_enabled - - -class SmsChannel(Channel): - """Sms channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to Sms channel resource. - :vartype properties: ~azure.mgmt.botservice.models.SmsChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "SmsChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.SmsChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to Sms channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.SmsChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "SmsChannel" - self.properties = properties - - -class SmsChannelProperties(_serialization.Model): - """The parameters to provide for the Sms channel. - - All required parameters must be populated in order to send to Azure. - - :ivar phone: The Sms phone. Required. - :vartype phone: str - :ivar account_sid: The Sms account SID. Value only returned through POST to the action Channel - List API, otherwise empty. Required. - :vartype account_sid: str - :ivar auth_token: The Sms auth token. Value only returned through POST to the action Channel - List API, otherwise empty. - :vartype auth_token: str - :ivar is_validated: Whether this channel is validated for the bot. - :vartype is_validated: bool - :ivar is_enabled: Whether this channel is enabled for the bot. Required. - :vartype is_enabled: bool - """ - - _validation = { - "phone": {"required": True}, - "account_sid": {"required": True}, - "is_enabled": {"required": True}, - } - - _attribute_map = { - "phone": {"key": "phone", "type": "str"}, - "account_sid": {"key": "accountSID", "type": "str"}, - "auth_token": {"key": "authToken", "type": "str"}, - "is_validated": {"key": "isValidated", "type": "bool"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - phone: str, - account_sid: str, - is_enabled: bool, - auth_token: Optional[str] = None, - is_validated: Optional[bool] = None, - **kwargs - ): - """ - :keyword phone: The Sms phone. Required. - :paramtype phone: str - :keyword account_sid: The Sms account SID. Value only returned through POST to the action - Channel List API, otherwise empty. Required. - :paramtype account_sid: str - :keyword auth_token: The Sms auth token. Value only returned through POST to the action Channel - List API, otherwise empty. - :paramtype auth_token: str - :keyword is_validated: Whether this channel is validated for the bot. - :paramtype is_validated: bool - :keyword is_enabled: Whether this channel is enabled for the bot. Required. - :paramtype is_enabled: bool - """ - super().__init__(**kwargs) - self.phone = phone - self.account_sid = account_sid - self.auth_token = auth_token - self.is_validated = is_validated - self.is_enabled = is_enabled - - -class TelegramChannel(Channel): - """Telegram channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to Telegram channel resource. - :vartype properties: ~azure.mgmt.botservice.models.TelegramChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "TelegramChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.TelegramChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to Telegram channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.TelegramChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "TelegramChannel" - self.properties = properties - - -class TelegramChannelProperties(_serialization.Model): - """The parameters to provide for the Telegram channel. - - All required parameters must be populated in order to send to Azure. - - :ivar access_token: The Telegram access token. Value only returned through POST to the action - Channel List API, otherwise empty. - :vartype access_token: str - :ivar is_validated: Whether this channel is validated for the bot. - :vartype is_validated: bool - :ivar is_enabled: Whether this channel is enabled for the bot. Required. - :vartype is_enabled: bool - """ - - _validation = { - "is_enabled": {"required": True}, - } - - _attribute_map = { - "access_token": {"key": "accessToken", "type": "str"}, - "is_validated": {"key": "isValidated", "type": "bool"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - } - - def __init__( - self, *, is_enabled: bool, access_token: Optional[str] = None, is_validated: Optional[bool] = None, **kwargs - ): - """ - :keyword access_token: The Telegram access token. Value only returned through POST to the - action Channel List API, otherwise empty. - :paramtype access_token: str - :keyword is_validated: Whether this channel is validated for the bot. - :paramtype is_validated: bool - :keyword is_enabled: Whether this channel is enabled for the bot. Required. - :paramtype is_enabled: bool - """ - super().__init__(**kwargs) - self.access_token = access_token - self.is_validated = is_validated - self.is_enabled = is_enabled - - -class TelephonyChannel(Channel): - """Telephony channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to Telephony channel resource. - :vartype properties: ~azure.mgmt.botservice.models.TelephonyChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "TelephonyChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.TelephonyChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to Telephony channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.TelephonyChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "TelephonyChannel" - self.properties = properties - - -class TelephonyChannelProperties(_serialization.Model): - """The parameters to provide for the Direct Line channel. - - :ivar phone_numbers: The list of Telephony phone numbers. - :vartype phone_numbers: list[~azure.mgmt.botservice.models.TelephonyPhoneNumbers] - :ivar api_configurations: The list of Telephony api configuration. - :vartype api_configurations: - list[~azure.mgmt.botservice.models.TelephonyChannelResourceApiConfiguration] - :ivar cognitive_service_subscription_key: The extensionKey1. - :vartype cognitive_service_subscription_key: str - :ivar cognitive_service_region: The extensionKey2. - :vartype cognitive_service_region: str - :ivar default_locale: The default locale of the channel. - :vartype default_locale: str - :ivar premium_sku: The premium SKU applied to the channel. - :vartype premium_sku: str - :ivar is_enabled: Whether the channel is enabled. - :vartype is_enabled: bool - """ - - _attribute_map = { - "phone_numbers": {"key": "phoneNumbers", "type": "[TelephonyPhoneNumbers]"}, - "api_configurations": {"key": "apiConfigurations", "type": "[TelephonyChannelResourceApiConfiguration]"}, - "cognitive_service_subscription_key": {"key": "cognitiveServiceSubscriptionKey", "type": "str"}, - "cognitive_service_region": {"key": "cognitiveServiceRegion", "type": "str"}, - "default_locale": {"key": "defaultLocale", "type": "str"}, - "premium_sku": {"key": "premiumSKU", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - phone_numbers: Optional[List["_models.TelephonyPhoneNumbers"]] = None, - api_configurations: Optional[List["_models.TelephonyChannelResourceApiConfiguration"]] = None, - cognitive_service_subscription_key: Optional[str] = None, - cognitive_service_region: Optional[str] = None, - default_locale: Optional[str] = None, - premium_sku: Optional[str] = None, - is_enabled: Optional[bool] = None, - **kwargs - ): - """ - :keyword phone_numbers: The list of Telephony phone numbers. - :paramtype phone_numbers: list[~azure.mgmt.botservice.models.TelephonyPhoneNumbers] - :keyword api_configurations: The list of Telephony api configuration. - :paramtype api_configurations: - list[~azure.mgmt.botservice.models.TelephonyChannelResourceApiConfiguration] - :keyword cognitive_service_subscription_key: The extensionKey1. - :paramtype cognitive_service_subscription_key: str - :keyword cognitive_service_region: The extensionKey2. - :paramtype cognitive_service_region: str - :keyword default_locale: The default locale of the channel. - :paramtype default_locale: str - :keyword premium_sku: The premium SKU applied to the channel. - :paramtype premium_sku: str - :keyword is_enabled: Whether the channel is enabled. - :paramtype is_enabled: bool - """ - super().__init__(**kwargs) - self.phone_numbers = phone_numbers - self.api_configurations = api_configurations - self.cognitive_service_subscription_key = cognitive_service_subscription_key - self.cognitive_service_region = cognitive_service_region - self.default_locale = default_locale - self.premium_sku = premium_sku - self.is_enabled = is_enabled - - -class TelephonyChannelResourceApiConfiguration(_serialization.Model): - """A resource Api configuration for the Telephony channel. - - :ivar id: The id of config. - :vartype id: str - :ivar provider_name: The provider name. - :vartype provider_name: str - :ivar cognitive_service_subscription_key: The cognitive service subscription key. - :vartype cognitive_service_subscription_key: str - :ivar cognitive_service_region: The cognitive service region. - :vartype cognitive_service_region: str - :ivar cognitive_service_resource_id: The cognitive service resourceId. - :vartype cognitive_service_resource_id: str - :ivar default_locale: The default locale. - :vartype default_locale: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "provider_name": {"key": "providerName", "type": "str"}, - "cognitive_service_subscription_key": {"key": "cognitiveServiceSubscriptionKey", "type": "str"}, - "cognitive_service_region": {"key": "cognitiveServiceRegion", "type": "str"}, - "cognitive_service_resource_id": {"key": "cognitiveServiceResourceId", "type": "str"}, - "default_locale": {"key": "defaultLocale", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - provider_name: Optional[str] = None, - cognitive_service_subscription_key: Optional[str] = None, - cognitive_service_region: Optional[str] = None, - cognitive_service_resource_id: Optional[str] = None, - default_locale: Optional[str] = None, - **kwargs - ): - """ - :keyword id: The id of config. - :paramtype id: str - :keyword provider_name: The provider name. - :paramtype provider_name: str - :keyword cognitive_service_subscription_key: The cognitive service subscription key. - :paramtype cognitive_service_subscription_key: str - :keyword cognitive_service_region: The cognitive service region. - :paramtype cognitive_service_region: str - :keyword cognitive_service_resource_id: The cognitive service resourceId. - :paramtype cognitive_service_resource_id: str - :keyword default_locale: The default locale. - :paramtype default_locale: str - """ - super().__init__(**kwargs) - self.id = id - self.provider_name = provider_name - self.cognitive_service_subscription_key = cognitive_service_subscription_key - self.cognitive_service_region = cognitive_service_region - self.cognitive_service_resource_id = cognitive_service_resource_id - self.default_locale = default_locale - - -class TelephonyPhoneNumbers(_serialization.Model): - """A telephone number for the Telephony channel. - - :ivar id: The element id. - :vartype id: str - :ivar phone_number: The phone number. - :vartype phone_number: str - :ivar acs_endpoint: The endpoint of ACS. - :vartype acs_endpoint: str - :ivar acs_secret: The secret of ACS. - :vartype acs_secret: str - :ivar acs_resource_id: The resource id of ACS. - :vartype acs_resource_id: str - :ivar cognitive_service_subscription_key: The subscription key of cognitive service. - :vartype cognitive_service_subscription_key: str - :ivar cognitive_service_region: The service region of cognitive service. - :vartype cognitive_service_region: str - :ivar cognitive_service_resource_id: The resource id of cognitive service. - :vartype cognitive_service_resource_id: str - :ivar default_locale: The default locale of the phone number. - :vartype default_locale: str - :ivar offer_type: Optional Property that will determine the offering type of the phone. - :vartype offer_type: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "phone_number": {"key": "phoneNumber", "type": "str"}, - "acs_endpoint": {"key": "acsEndpoint", "type": "str"}, - "acs_secret": {"key": "acsSecret", "type": "str"}, - "acs_resource_id": {"key": "acsResourceId", "type": "str"}, - "cognitive_service_subscription_key": {"key": "cognitiveServiceSubscriptionKey", "type": "str"}, - "cognitive_service_region": {"key": "cognitiveServiceRegion", "type": "str"}, - "cognitive_service_resource_id": {"key": "cognitiveServiceResourceId", "type": "str"}, - "default_locale": {"key": "defaultLocale", "type": "str"}, - "offer_type": {"key": "offerType", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - phone_number: Optional[str] = None, - acs_endpoint: Optional[str] = None, - acs_secret: Optional[str] = None, - acs_resource_id: Optional[str] = None, - cognitive_service_subscription_key: Optional[str] = None, - cognitive_service_region: Optional[str] = None, - cognitive_service_resource_id: Optional[str] = None, - default_locale: Optional[str] = None, - offer_type: Optional[str] = None, - **kwargs - ): - """ - :keyword id: The element id. - :paramtype id: str - :keyword phone_number: The phone number. - :paramtype phone_number: str - :keyword acs_endpoint: The endpoint of ACS. - :paramtype acs_endpoint: str - :keyword acs_secret: The secret of ACS. - :paramtype acs_secret: str - :keyword acs_resource_id: The resource id of ACS. - :paramtype acs_resource_id: str - :keyword cognitive_service_subscription_key: The subscription key of cognitive service. - :paramtype cognitive_service_subscription_key: str - :keyword cognitive_service_region: The service region of cognitive service. - :paramtype cognitive_service_region: str - :keyword cognitive_service_resource_id: The resource id of cognitive service. - :paramtype cognitive_service_resource_id: str - :keyword default_locale: The default locale of the phone number. - :paramtype default_locale: str - :keyword offer_type: Optional Property that will determine the offering type of the phone. - :paramtype offer_type: str - """ - super().__init__(**kwargs) - self.id = id - self.phone_number = phone_number - self.acs_endpoint = acs_endpoint - self.acs_secret = acs_secret - self.acs_resource_id = acs_resource_id - self.cognitive_service_subscription_key = cognitive_service_subscription_key - self.cognitive_service_region = cognitive_service_region - self.cognitive_service_resource_id = cognitive_service_resource_id - self.default_locale = default_locale - self.offer_type = offer_type - - -class WebChatChannel(Channel): - """Web Chat channel definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar channel_name: The channel name. Required. - :vartype channel_name: str - :ivar etag: Entity Tag of the resource. - :vartype etag: str - :ivar provisioning_state: Provisioning state of the resource. - :vartype provisioning_state: str - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar properties: The set of properties specific to Web Chat channel resource. - :vartype properties: ~azure.mgmt.botservice.models.WebChatChannelProperties - """ - - _validation = { - "channel_name": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "channel_name": {"key": "channelName", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "WebChatChannelProperties"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - location: str = "global", - properties: Optional["_models.WebChatChannelProperties"] = None, - **kwargs - ): - """ - :keyword etag: Entity Tag of the resource. - :paramtype etag: str - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword properties: The set of properties specific to Web Chat channel resource. - :paramtype properties: ~azure.mgmt.botservice.models.WebChatChannelProperties - """ - super().__init__(etag=etag, location=location, **kwargs) - self.channel_name: str = "WebChatChannel" - self.properties = properties - - -class WebChatChannelProperties(_serialization.Model): - """The parameters to provide for the Web Chat channel. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar web_chat_embed_code: Web chat control embed code. - :vartype web_chat_embed_code: str - :ivar sites: The list of Web Chat sites. - :vartype 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: Optional[List["_models.WebChatSite"]] = None, **kwargs): - """ - :keyword sites: The list of Web Chat sites. - :paramtype sites: list[~azure.mgmt.botservice.models.WebChatSite] - """ - super().__init__(**kwargs) - self.web_chat_embed_code = None - self.sites = sites - - -class WebChatSite(Site): # pylint: disable=too-many-instance-attributes - """A site for the Webchat channel. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar tenant_id: Tenant Id. - :vartype tenant_id: str - :ivar site_id: Site Id. - :vartype site_id: str - :ivar site_name: Site name. Required. - :vartype site_name: str - :ivar key: Primary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key: str - :ivar key2: Secondary key. Value only returned through POST to the action Channel List API, - otherwise empty. - :vartype key2: str - :ivar is_enabled: Whether this site is enabled for DirectLine channel. Required. - :vartype is_enabled: bool - :ivar is_token_enabled: Whether this site is token enabled for channel. - :vartype is_token_enabled: bool - :ivar is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for - channel. - :vartype is_endpoint_parameters_enabled: bool - :ivar is_detailed_logging_enabled: Whether this site is disabled detailed logging for. - :vartype is_detailed_logging_enabled: bool - :ivar is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :vartype is_block_user_upload_enabled: bool - :ivar is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. - :vartype is_no_storage_enabled: bool - :ivar e_tag: Entity Tag. - :vartype e_tag: str - :ivar app_id: DirectLine application id. - :vartype app_id: str - :ivar is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. - :vartype is_v1_enabled: bool - :ivar is_v3_enabled: Whether this site is enabled for Bot Framework V3 protocol. - :vartype is_v3_enabled: bool - :ivar is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :vartype is_secure_site_enabled: bool - :ivar trusted_origins: List of Trusted Origin URLs for this site. This field is applicable only - if isSecureSiteEnabled is True. - :vartype trusted_origins: list[str] - :ivar is_web_chat_speech_enabled: Whether this site is enabled for Webchat Speech. - :vartype is_web_chat_speech_enabled: bool - :ivar is_webchat_preview_enabled: Whether this site is enabled for preview versions of Webchat. - :vartype is_webchat_preview_enabled: bool - """ - - _validation = { - "site_id": {"readonly": True}, - "site_name": {"required": True}, - "key": {"readonly": True}, - "key2": {"readonly": True}, - "is_enabled": {"required": True}, - "is_token_enabled": {"readonly": True}, - } - - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "site_id": {"key": "siteId", "type": "str"}, - "site_name": {"key": "siteName", "type": "str"}, - "key": {"key": "key", "type": "str"}, - "key2": {"key": "key2", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "is_token_enabled": {"key": "isTokenEnabled", "type": "bool"}, - "is_endpoint_parameters_enabled": {"key": "isEndpointParametersEnabled", "type": "bool"}, - "is_detailed_logging_enabled": {"key": "isDetailedLoggingEnabled", "type": "bool"}, - "is_block_user_upload_enabled": {"key": "isBlockUserUploadEnabled", "type": "bool"}, - "is_no_storage_enabled": {"key": "isNoStorageEnabled", "type": "bool"}, - "e_tag": {"key": "eTag", "type": "str"}, - "app_id": {"key": "appId", "type": "str"}, - "is_v1_enabled": {"key": "isV1Enabled", "type": "bool"}, - "is_v3_enabled": {"key": "isV3Enabled", "type": "bool"}, - "is_secure_site_enabled": {"key": "isSecureSiteEnabled", "type": "bool"}, - "trusted_origins": {"key": "trustedOrigins", "type": "[str]"}, - "is_web_chat_speech_enabled": {"key": "isWebChatSpeechEnabled", "type": "bool"}, - "is_webchat_preview_enabled": {"key": "isWebchatPreviewEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - site_name: str, - is_enabled: bool, - tenant_id: Optional[str] = None, - is_endpoint_parameters_enabled: Optional[bool] = None, - is_detailed_logging_enabled: Optional[bool] = None, - is_block_user_upload_enabled: Optional[bool] = None, - is_no_storage_enabled: Optional[bool] = None, - e_tag: Optional[str] = None, - app_id: Optional[str] = None, - is_v1_enabled: Optional[bool] = None, - is_v3_enabled: Optional[bool] = None, - is_secure_site_enabled: Optional[bool] = None, - trusted_origins: Optional[List[str]] = None, - is_web_chat_speech_enabled: bool = False, - is_webchat_preview_enabled: bool = False, - **kwargs - ): - """ - :keyword tenant_id: Tenant Id. - :paramtype tenant_id: str - :keyword site_name: Site name. Required. - :paramtype site_name: str - :keyword is_enabled: Whether this site is enabled for DirectLine channel. Required. - :paramtype is_enabled: bool - :keyword is_endpoint_parameters_enabled: Whether this site is EndpointParameters enabled for - channel. - :paramtype is_endpoint_parameters_enabled: bool - :keyword is_detailed_logging_enabled: Whether this site is disabled detailed logging for. - :paramtype is_detailed_logging_enabled: bool - :keyword is_block_user_upload_enabled: Whether this site is enabled for block user upload. - :paramtype is_block_user_upload_enabled: bool - :keyword is_no_storage_enabled: Whether this no-storage site is disabled detailed logging for. - :paramtype is_no_storage_enabled: bool - :keyword e_tag: Entity Tag. - :paramtype e_tag: str - :keyword app_id: DirectLine application id. - :paramtype app_id: str - :keyword is_v1_enabled: Whether this site is enabled for Bot Framework V1 protocol. - :paramtype is_v1_enabled: bool - :keyword is_v3_enabled: Whether this site is enabled for Bot Framework V3 protocol. - :paramtype is_v3_enabled: bool - :keyword is_secure_site_enabled: Whether this site is enabled for authentication with Bot - Framework. - :paramtype is_secure_site_enabled: bool - :keyword trusted_origins: List of Trusted Origin URLs for this site. This field is applicable - only if isSecureSiteEnabled is True. - :paramtype trusted_origins: list[str] - :keyword is_web_chat_speech_enabled: Whether this site is enabled for Webchat Speech. - :paramtype is_web_chat_speech_enabled: bool - :keyword is_webchat_preview_enabled: Whether this site is enabled for preview versions of - Webchat. - :paramtype is_webchat_preview_enabled: bool - """ - super().__init__( - tenant_id=tenant_id, - site_name=site_name, - is_enabled=is_enabled, - is_endpoint_parameters_enabled=is_endpoint_parameters_enabled, - is_detailed_logging_enabled=is_detailed_logging_enabled, - is_block_user_upload_enabled=is_block_user_upload_enabled, - is_no_storage_enabled=is_no_storage_enabled, - e_tag=e_tag, - app_id=app_id, - is_v1_enabled=is_v1_enabled, - is_v3_enabled=is_v3_enabled, - is_secure_site_enabled=is_secure_site_enabled, - trusted_origins=trusted_origins, - is_web_chat_speech_enabled=is_web_chat_speech_enabled, - is_webchat_preview_enabled=is_webchat_preview_enabled, - **kwargs - ) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_patch.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_patch.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/models/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/__init__.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/__init__.py index 67f6c5b0276c..8a0bcb442acb 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/__init__.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/__init__.py @@ -2,38 +2,44 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._bots_operations import BotsOperations -from ._channels_operations import ChannelsOperations -from ._direct_line_operations import DirectLineOperations -from ._email_operations import EmailOperations -from ._operations import Operations -from ._bot_connection_operations import BotConnectionOperations -from ._qn_amaker_endpoint_keys_operations import QnAMakerEndpointKeysOperations -from ._host_settings_operations import HostSettingsOperations -from ._operation_results_operations import OperationResultsOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import BotsOperations # type: ignore +from ._operations import BotChannelsOperations # type: ignore +from ._operations import ConnectionSettingsOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._operations import BotsOperationGroupOperations # type: ignore +from ._operations import BotConnectionOperationGroupOperations # type: ignore +from ._operations import QnAMakerEndpointKeysOperationGroupOperations # type: ignore +from ._operations import HostSettingsOperationGroupOperations # type: ignore +from ._operations import OperationResultsOperationGroupOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "BotsOperations", - "ChannelsOperations", - "DirectLineOperations", - "EmailOperations", "Operations", - "BotConnectionOperations", - "QnAMakerEndpointKeysOperations", - "HostSettingsOperations", - "OperationResultsOperations", + "BotsOperations", + "BotChannelsOperations", + "ConnectionSettingsOperations", "PrivateEndpointConnectionsOperations", - "PrivateLinkResourcesOperations", + "NetworkSecurityPerimeterConfigurationsOperations", + "BotsOperationGroupOperations", + "BotConnectionOperationGroupOperations", + "QnAMakerEndpointKeysOperationGroupOperations", + "HostSettingsOperationGroupOperations", + "OperationResultsOperationGroupOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bot_connection_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bot_connection_operations.py deleted file mode 100644 index 520490b68b06..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bot_connection_operations.py +++ /dev/null @@ -1,1042 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_service_providers_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_with_secrets_request( - resource_group_name: str, resource_name: str, connection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "connectionName": _SERIALIZER.url( - "connection_name", - connection_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$", - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, resource_name: str, connection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "connectionName": _SERIALIZER.url( - "connection_name", - connection_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$", - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, connection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "connectionName": _SERIALIZER.url( - "connection_name", - connection_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$", - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, resource_name: str, connection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "connectionName": _SERIALIZER.url( - "connection_name", - connection_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$", - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_name: str, connection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "connectionName": _SERIALIZER.url( - "connection_name", - connection_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$", - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_bot_service_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BotConnectionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.AzureBotService`'s - :attr:`bot_connection` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_service_providers(self, **kwargs: Any) -> _models.ServiceProviderResponseList: - """Lists the available Service Providers for creating Connection Settings. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ServiceProviderResponseList or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ServiceProviderResponseList - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ServiceProviderResponseList] = kwargs.pop("cls", None) - - request = build_list_service_providers_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_service_providers.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServiceProviderResponseList", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_service_providers.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders" - } - - @distributed_trace - def list_with_secrets( - self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any - ) -> _models.ConnectionSetting: - """Get a Connection Setting registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) - - request = build_list_with_secrets_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_with_secrets.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConnectionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_with_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets" - } - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - connection_name: str, - parameters: _models.ConnectionSetting, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionSetting: - """Register a new Auth Connection for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :param parameters: The parameters to provide for creating the Connection Setting. Required. - :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - connection_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionSetting: - """Register a new Auth Connection for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :param parameters: The parameters to provide for creating the Connection Setting. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - resource_name: str, - connection_name: str, - parameters: Union[_models.ConnectionSetting, IO], - **kwargs: Any - ) -> _models.ConnectionSetting: - """Register a new Auth Connection for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :param parameters: The parameters to provide for creating the Connection Setting. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ConnectionSetting") - - request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ConnectionSetting", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ConnectionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - connection_name: str, - parameters: _models.ConnectionSetting, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionSetting: - """Updates a Connection Setting registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :param parameters: The parameters to provide for updating the Connection Setting. Required. - :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - connection_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionSetting: - """Updates a Connection Setting registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :param parameters: The parameters to provide for updating the Connection Setting. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - connection_name: str, - parameters: Union[_models.ConnectionSetting, IO], - **kwargs: Any - ) -> _models.ConnectionSetting: - """Updates a Connection Setting registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :param parameters: The parameters to provide for updating the Connection Setting. Is either a - model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ConnectionSetting") - - request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("ConnectionSetting", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ConnectionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any - ) -> _models.ConnectionSetting: - """Get a Connection Setting registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionSetting or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ConnectionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConnectionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any - ) -> None: - """Deletes a Connection Setting registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param connection_name: The name of the Bot Service Connection Setting resource. Required. - :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" - } - - @distributed_trace - def list_by_bot_service( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.ConnectionSetting"]: - """Returns all the Connection Settings registered to a particular BotService resource. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConnectionSetting or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.ConnectionSetting] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ConnectionSettingResponseList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_bot_service_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_bot_service.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ConnectionSettingResponseList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_bot_service.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bots_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bots_operations.py deleted file mode 100644 index 25d641921886..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_bots_operations.py +++ /dev/null @@ -1,958 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_check_name_availability_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.BotService/checkNameAvailability") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class BotsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.AzureBotService`'s - :attr:`bots` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - parameters: _models.Bot, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Bot: - """Creates a Bot Service. Bot Service is a resource group wide resource type. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param parameters: The parameters to provide for the created bot. Required. - :type parameters: ~azure.mgmt.botservice.models.Bot - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Bot or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.Bot - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Bot: - """Creates a Bot Service. Bot Service is a resource group wide resource type. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param parameters: The parameters to provide for the created bot. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Bot or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.Bot - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, resource_group_name: str, resource_name: str, parameters: Union[_models.Bot, IO], **kwargs: Any - ) -> _models.Bot: - """Creates a Bot Service. Bot Service is a resource group wide resource type. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param parameters: The parameters to provide for the created bot. Is either a model type or a - IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.Bot or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Bot or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.Bot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Bot] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Bot") - - request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Bot", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Bot", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional[_models.Sku] = None, - kind: Optional[Union[str, _models.Kind]] = None, - etag: Optional[str] = None, - properties: Optional[_models.BotProperties] = None, - **kwargs: Any - ) -> _models.Bot: - """Updates a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param location: Specifies the location of the resource. Default value is None. - :type location: str - :param tags: Contains resource tags defined as key/value pairs. Default value is None. - :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. Default value is None. - :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". Default value is None. - :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. Default value is None. - :type etag: str - :param properties: The set of properties specific to bot resource. Default value is None. - :type properties: ~azure.mgmt.botservice.models.BotProperties - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Bot or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.Bot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) - cls: ClsType[_models.Bot] = kwargs.pop("cls", None) - - _parameters = _models.Bot(etag=etag, kind=kind, location=location, properties=properties, sku=sku, tags=tags) - _json = self._serialize.body(_parameters, "Bot") - - request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Bot", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Bot", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Deletes a Bot Service from the resource group. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Bot: - """Returns a BotService specified by the parameters. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Bot or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.Bot - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.Bot] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Bot", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" - } - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Bot"]: - """Returns all the resources of a particular type belonging to a resource group. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Bot or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.Bot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.BotResponseList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BotResponseList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices" - } - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Bot"]: - """Returns all the resources of a particular type belonging to a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Bot or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.Bot] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.BotResponseList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BotResponseList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices"} - - @overload - def get_check_name_availability( - self, - parameters: _models.CheckNameAvailabilityRequestBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CheckNameAvailabilityResponseBody: - """Check whether a bot name is available. - - :param parameters: The request body parameters to provide for the check name availability - request. Required. - :type parameters: ~azure.mgmt.botservice.models.CheckNameAvailabilityRequestBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponseBody or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def get_check_name_availability( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CheckNameAvailabilityResponseBody: - """Check whether a bot name is available. - - :param parameters: The request body parameters to provide for the check name availability - request. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponseBody or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def get_check_name_availability( - self, parameters: Union[_models.CheckNameAvailabilityRequestBody, IO], **kwargs: Any - ) -> _models.CheckNameAvailabilityResponseBody: - """Check whether a bot name is available. - - :param parameters: The request body parameters to provide for the check name availability - request. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.CheckNameAvailabilityRequestBody or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponseBody or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckNameAvailabilityResponseBody] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CheckNameAvailabilityRequestBody") - - request = build_get_check_name_availability_request( - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.get_check_name_availability.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckNameAvailabilityResponseBody", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_check_name_availability.metadata = {"url": "/providers/Microsoft.BotService/checkNameAvailability"} diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_channels_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_channels_operations.py deleted file mode 100644 index f5d99740aeb9..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_channels_operations.py +++ /dev/null @@ -1,905 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request( - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.ChannelName], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "channelName": _SERIALIZER.url("channel_name", channel_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.ChannelName], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "channelName": _SERIALIZER.url("channel_name", channel_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_name: str, channel_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "channelName": _SERIALIZER.url( - "channel_name", channel_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, resource_name: str, channel_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "channelName": _SERIALIZER.url( - "channel_name", channel_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_with_keys_request( - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.ChannelName], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "channelName": _SERIALIZER.url("channel_name", channel_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ChannelsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.AzureBotService`'s - :attr:`channels` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.ChannelName], - parameters: _models.BotChannel, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.BotChannel: - """Creates a Channel registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource. Known values are: "AlexaChannel", - "FacebookChannel", "EmailChannel", "KikChannel", "TelegramChannel", "SlackChannel", - "MsTeamsChannel", "SkypeChannel", "WebChatChannel", "DirectLineChannel", "SmsChannel", - "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", - "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :param parameters: The parameters to provide for the created bot. Required. - :type parameters: ~azure.mgmt.botservice.models.BotChannel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.ChannelName], - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.BotChannel: - """Creates a Channel registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource. Known values are: "AlexaChannel", - "FacebookChannel", "EmailChannel", "KikChannel", "TelegramChannel", "SlackChannel", - "MsTeamsChannel", "SkypeChannel", "WebChatChannel", "DirectLineChannel", "SmsChannel", - "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", - "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :param parameters: The parameters to provide for the created bot. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.ChannelName], - parameters: Union[_models.BotChannel, IO], - **kwargs: Any - ) -> _models.BotChannel: - """Creates a Channel registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource. Known values are: "AlexaChannel", - "FacebookChannel", "EmailChannel", "KikChannel", "TelegramChannel", "SlackChannel", - "MsTeamsChannel", "SkypeChannel", "WebChatChannel", "DirectLineChannel", "SmsChannel", - "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", - "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :param parameters: The parameters to provide for the created bot. Is either a model type or a - IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.BotChannel or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "BotChannel") - - request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - channel_name=channel_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BotChannel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BotChannel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.ChannelName], - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional[_models.Sku] = None, - kind: Optional[Union[str, _models.Kind]] = None, - etag: Optional[str] = None, - properties: Optional[_models.Channel] = None, - **kwargs: Any - ) -> _models.BotChannel: - """Updates a Channel registration for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource. Known values are: "AlexaChannel", - "FacebookChannel", "EmailChannel", "KikChannel", "TelegramChannel", "SlackChannel", - "MsTeamsChannel", "SkypeChannel", "WebChatChannel", "DirectLineChannel", "SmsChannel", - "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", - "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :param location: Specifies the location of the resource. Default value is None. - :type location: str - :param tags: Contains resource tags defined as key/value pairs. Default value is None. - :type tags: dict[str, str] - :param sku: Gets or sets the SKU of the resource. Default value is None. - :type sku: ~azure.mgmt.botservice.models.Sku - :param kind: Required. Gets or sets the Kind of the resource. Known values are: "sdk", - "designer", "bot", "function", and "azurebot". Default value is None. - :type kind: str or ~azure.mgmt.botservice.models.Kind - :param etag: Entity Tag. Default value is None. - :type etag: str - :param properties: The set of properties specific to bot channel resource. Default value is - None. - :type properties: ~azure.mgmt.botservice.models.Channel - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) - cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) - - _parameters = _models.BotChannel( - etag=etag, kind=kind, location=location, properties=properties, sku=sku, tags=tags - ) - _json = self._serialize.body(_parameters, "BotChannel") - - request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - channel_name=channel_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BotChannel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BotChannel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, channel_name: str, **kwargs: Any - ) -> None: - """Deletes a Channel registration from a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Bot resource. Required. - :type channel_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - channel_name=channel_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, channel_name: str, **kwargs: Any) -> _models.BotChannel: - """Returns a BotService Channel registration specified by the parameters. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Bot resource. Required. - :type channel_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - channel_name=channel_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BotChannel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" - } - - @distributed_trace - def list_with_keys( - self, resource_group_name: str, resource_name: str, channel_name: Union[str, _models.ChannelName], **kwargs: Any - ) -> _models.ListChannelWithKeysResponse: - """Lists a Channel registration for a Bot Service including secrets. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource. Known values are: "AlexaChannel", - "FacebookChannel", "EmailChannel", "KikChannel", "TelegramChannel", "SlackChannel", - "MsTeamsChannel", "SkypeChannel", "WebChatChannel", "DirectLineChannel", "SmsChannel", - "LineChannel", "DirectLineSpeechChannel", "OutlookChannel", "Omnichannel", "TelephonyChannel", - "AcsChatChannel", "SearchAssistant", and "M365Extensions". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.ChannelName - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListChannelWithKeysResponse or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.ListChannelWithKeysResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ListChannelWithKeysResponse] = kwargs.pop("cls", None) - - request = build_list_with_keys_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - channel_name=channel_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_with_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ListChannelWithKeysResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_with_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.BotChannel"]: - """Returns all the Channel registrations of a particular BotService resource. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BotChannel or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.BotChannel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.ChannelResponseList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ChannelResponseList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_direct_line_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_direct_line_operations.py deleted file mode 100644 index 6a66d455759f..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_direct_line_operations.py +++ /dev/null @@ -1,267 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_regenerate_keys_request( - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.RegenerateKeysChannelName], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "channelName": _SERIALIZER.url("channel_name", channel_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DirectLineOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.AzureBotService`'s - :attr:`direct_line` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def regenerate_keys( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.RegenerateKeysChannelName], - parameters: _models.SiteInfo, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.BotChannel: - """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService - resource. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource for which keys are to be regenerated. - Known values are: "WebChatChannel" and "DirectLineChannel". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.RegenerateKeysChannelName - :param parameters: The parameters to provide for the created bot. Required. - :type parameters: ~azure.mgmt.botservice.models.SiteInfo - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_keys( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.RegenerateKeysChannelName], - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.BotChannel: - """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService - resource. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource for which keys are to be regenerated. - Known values are: "WebChatChannel" and "DirectLineChannel". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.RegenerateKeysChannelName - :param parameters: The parameters to provide for the created bot. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_keys( - self, - resource_group_name: str, - resource_name: str, - channel_name: Union[str, _models.RegenerateKeysChannelName], - parameters: Union[_models.SiteInfo, IO], - **kwargs: Any - ) -> _models.BotChannel: - """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService - resource. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param channel_name: The name of the Channel resource for which keys are to be regenerated. - Known values are: "WebChatChannel" and "DirectLineChannel". Required. - :type channel_name: str or ~azure.mgmt.botservice.models.RegenerateKeysChannelName - :param parameters: The parameters to provide for the created bot. Is either a model type or a - IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.SiteInfo or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BotChannel or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.BotChannel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SiteInfo") - - request = build_regenerate_keys_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - channel_name=channel_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.regenerate_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BotChannel", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - regenerate_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_email_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_email_operations.py deleted file mode 100644 index 21f0d359b9bf..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_email_operations.py +++ /dev/null @@ -1,165 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_sign_in_url_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/createEmailSignInUrl", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class EmailOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.AzureBotService`'s - :attr:`email` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def create_sign_in_url( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.CreateEmailSignInUrlResponse: - """Creates an email channel sign in url for a Bot Service. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CreateEmailSignInUrlResponse or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.CreateEmailSignInUrlResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.CreateEmailSignInUrlResponse] = kwargs.pop("cls", None) - - request = build_create_sign_in_url_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.create_sign_in_url.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CreateEmailSignInUrlResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_sign_in_url.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/createEmailSignInUrl" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_host_settings_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_host_settings_operations.py deleted file mode 100644 index 8f78f0a89b1b..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_host_settings_operations.py +++ /dev/null @@ -1,138 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class HostSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.AzureBotService`'s - :attr:`host_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, **kwargs: Any) -> _models.HostSettingsResponse: - """Get per subscription settings needed to host bot in compute resource such as Azure App Service. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HostSettingsResponse or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.HostSettingsResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.HostSettingsResponse] = kwargs.pop("cls", None) - - request = build_get_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("HostSettingsResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings"} diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operation_results_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operation_results_operations.py deleted file mode 100644 index 7e03eed310f7..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operation_results_operations.py +++ /dev/null @@ -1,207 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(operation_result_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "operationResultId": _SERIALIZER.url("operation_result_id", operation_result_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class OperationResultsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.AzureBotService`'s - :attr:`operation_results` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _get_initial(self, operation_result_id: str, **kwargs: Any) -> Optional[_models.OperationResultsDescription]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[Optional[_models.OperationResultsDescription]] = kwargs.pop("cls", None) - - request = build_get_request( - operation_result_id=operation_result_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._get_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("OperationResultsDescription", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _get_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}" - } - - @distributed_trace - def begin_get(self, operation_result_id: str, **kwargs: Any) -> LROPoller[_models.OperationResultsDescription]: - """Get the operation result for a long running operation. - - :param operation_result_id: The ID of the operation result to get. Required. - :type operation_result_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either OperationResultsDescription or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.botservice.models.OperationResultsDescription] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.OperationResultsDescription] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._get_initial( - operation_result_id=operation_result_id, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OperationResultsDescription", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operations.py index 9461f8808433..eebcc39afe75 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_operations.py @@ -1,55 +1,1042 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import BotServiceClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.BotService/operations") + _url = "/providers/Microsoft.BotService/operations" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bots_get_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bots_create_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bots_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bots_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bots_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bots_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bots_create_sign_in_url_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/createEmailSignInUrl" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bots_list_by_bot_resource_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bot_channels_get_request( + resource_group_name: str, resource_name: str, channel_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "channelName": _SERIALIZER.url("channel_name", channel_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bot_channels_create_request( + resource_group_name: str, resource_name: str, channel_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "channelName": _SERIALIZER.url("channel_name", channel_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bot_channels_update_request( + resource_group_name: str, resource_name: str, channel_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "channelName": _SERIALIZER.url("channel_name", channel_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bot_channels_delete_request( + resource_group_name: str, resource_name: str, channel_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "channelName": _SERIALIZER.url("channel_name", channel_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bot_channels_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bot_channels_list_with_keys_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, channel_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "channelName": _SERIALIZER.url("channel_name", channel_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bot_channels_regenerate_keys_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, channel_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "channelName": _SERIALIZER.url("channel_name", channel_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_settings_get_request( + resource_group_name: str, resource_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_settings_create_request( + resource_group_name: str, resource_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_settings_update_request( + resource_group_name: str, resource_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_settings_delete_request( + resource_group_name: str, resource_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_settings_list_by_bot_service_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connection_settings_list_with_secrets_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_create_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_list_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_security_perimeter_configurations_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + subscription_id: str, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "networkSecurityPerimeterConfigurationName": _SERIALIZER.url( + "network_security_perimeter_configuration_name", network_security_perimeter_configuration_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_security_perimeter_configurations_list_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/networkSecurityPerimeterConfigurations" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_security_perimeter_configurations_reconcile_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + subscription_id: str, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}/reconcile" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "networkSecurityPerimeterConfigurationName": _SERIALIZER.url( + "network_security_perimeter_configuration_name", network_security_perimeter_configuration_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bots_operation_group_get_check_name_availability_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.BotService/checkNameAvailability" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_bot_connection_operation_group_list_service_providers_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_qn_amaker_endpoint_keys_operation_group_get_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listQnAMakerEndpointKeys" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_host_settings_operation_group_get_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_operation_results_operation_group_get_request( # pylint: disable=name-too-long + operation_result_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-09-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "operationResultId": _SERIALIZER.url("operation_result_id", operation_result_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -65,38 +1052,2953 @@ class Operations: .. warning:: **DO NOT** instantiate this class directly. - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.AzureBotService`'s - :attr:`operations` attribute. - """ + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.BotServiceClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.OperationEntity"]: + """List the operations for the provider. + + :return: An iterator like instance of OperationEntity + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.OperationEntity] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OperationEntity]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OperationEntity], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class BotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.BotServiceClient`'s + :attr:`bots` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Bot: + """Returns a BotService specified by the parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Bot] = kwargs.pop("cls", None) + + _request = build_bots_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Bot, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.Bot, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.Bot: + """Creates a Bot Service. Bot Service is a resource group wide resource type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: ~azure.mgmt.botservice.models.Bot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.Bot: + """Creates a Bot Service. Bot Service is a resource group wide resource type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.Bot: + """Creates a Bot Service. Bot Service is a resource group wide resource type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.Bot, JSON, IO[bytes]], + **kwargs: Any, + ) -> _models.Bot: + """Creates a Bot Service. Bot Service is a resource group wide resource type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Is one of the following + types: Bot, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.Bot or JSON or IO[bytes] + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Bot] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bots_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Bot, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.Bot, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.Bot: + """Updates a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: ~azure.mgmt.botservice.models.Bot + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.Bot: + """Updates a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.Bot: + """Updates a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + parameters: Union[_models.Bot, JSON, IO[bytes]], + **kwargs: Any, + ) -> _models.Bot: + """Updates a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param parameters: The parameters to provide for the created bot. Is one of the following + types: Bot, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.Bot or JSON or IO[bytes] + :return: Bot. The Bot is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.Bot + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Bot] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bots_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Bot, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Deletes a Bot Service from the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_bots_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Bot"]: + """Returns all the resources of a particular type belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Bot + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.Bot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Bot]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_bots_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Bot], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Bot"]: + """Returns all the resources of a particular type belonging to a subscription. + + :return: An iterator like instance of Bot + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.Bot] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Bot]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_bots_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Bot], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def create_sign_in_url( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.CreateEmailSignInUrlResponse: + """Creates an email channel sign in url for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: CreateEmailSignInUrlResponse. The CreateEmailSignInUrlResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.CreateEmailSignInUrlResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CreateEmailSignInUrlResponse] = kwargs.pop("cls", None) + + _request = build_bots_create_sign_in_url_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CreateEmailSignInUrlResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_bot_resource( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.PrivateLinkResourceListResult: + """Gets the private link resources that need to be created for a Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: PrivateLinkResourceListResult. The PrivateLinkResourceListResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.PrivateLinkResourceListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + _request = build_bots_list_by_bot_resource_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateLinkResourceListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class BotChannelsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.BotServiceClient`'s + :attr:`bot_channels` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, channel_name: str, **kwargs: Any) -> _models.BotChannel: + """Returns a BotService Channel registration specified by the parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) + + _request = build_bot_channels_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BotChannel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: _models.BotChannel, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.BotChannel: + """Creates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: ~azure.mgmt.botservice.models.BotChannel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.BotChannel: + """Creates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.BotChannel: + """Creates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: Union[_models.BotChannel, JSON, IO[bytes]], + **kwargs: Any, + ) -> _models.BotChannel: + """Creates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Is one of the following + types: BotChannel, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.BotChannel or JSON or IO[bytes] + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bot_channels_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BotChannel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: _models.BotChannel, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.BotChannel: + """Updates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: ~azure.mgmt.botservice.models.BotChannel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.BotChannel: + """Updates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.BotChannel: + """Updates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: Union[_models.BotChannel, JSON, IO[bytes]], + **kwargs: Any, + ) -> _models.BotChannel: + """Updates a Channel registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Is one of the following + types: BotChannel, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.BotChannel or JSON or IO[bytes] + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bot_channels_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BotChannel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, channel_name: str, **kwargs: Any + ) -> None: + """Deletes a Channel registration from a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_bot_channels_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.BotChannel"]: + """Returns all the Channel registrations of a particular BotService resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: An iterator like instance of BotChannel + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.BotChannel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BotChannel]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_bot_channels_list_by_resource_group_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.BotChannel], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_with_keys( + self, resource_group_name: str, resource_name: str, channel_name: str, **kwargs: Any + ) -> _models.ListChannelWithKeysResponse: + """Lists a Channel registration for a Bot Service including secrets. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :return: ListChannelWithKeysResponse. The ListChannelWithKeysResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.ListChannelWithKeysResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ListChannelWithKeysResponse] = kwargs.pop("cls", None) + + _request = build_bot_channels_list_with_keys_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ListChannelWithKeysResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def regenerate_keys( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: _models.SiteInfo, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.BotChannel: + """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: ~azure.mgmt.botservice.models.SiteInfo + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.BotChannel: + """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.BotChannel: + """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + resource_name: str, + channel_name: str, + parameters: Union[_models.SiteInfo, JSON, IO[bytes]], + **kwargs: Any, + ) -> _models.BotChannel: + """Regenerates secret keys and returns them for the DirectLine Channel of a particular BotService + resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param channel_name: The name of the Bot resource. Required. + :type channel_name: str + :param parameters: The parameters to provide for the created bot. Is one of the following + types: SiteInfo, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.SiteInfo or JSON or IO[bytes] + :return: BotChannel. The BotChannel is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.BotChannel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BotChannel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bot_channels_regenerate_keys_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + channel_name=channel_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.BotChannel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ConnectionSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.BotServiceClient`'s + :attr:`connection_settings` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any + ) -> _models.ConnectionSetting: + """Get a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) + + _request = build_connection_settings_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ConnectionSetting, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: _models.ConnectionSetting, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.ConnectionSetting: + """Register a new Auth Connection for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for creating the Connection Setting. Required. + :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.ConnectionSetting: + """Register a new Auth Connection for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for creating the Connection Setting. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.ConnectionSetting: + """Register a new Auth Connection for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for creating the Connection Setting. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: Union[_models.ConnectionSetting, JSON, IO[bytes]], + **kwargs: Any, + ) -> _models.ConnectionSetting: + """Register a new Auth Connection for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for creating the Connection Setting. Is one of the + following types: ConnectionSetting, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting or JSON or IO[bytes] + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connection_settings_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ConnectionSetting, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: _models.ConnectionSetting, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.ConnectionSetting: + """Updates a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for updating the Connection Setting. Required. + :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.ConnectionSetting: + """Updates a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for updating the Connection Setting. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.ConnectionSetting: + """Updates a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for updating the Connection Setting. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + connection_name: str, + parameters: Union[_models.ConnectionSetting, JSON, IO[bytes]], + **kwargs: Any, + ) -> _models.ConnectionSetting: + """Updates a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :param parameters: The parameters to provide for updating the Connection Setting. Is one of the + following types: ConnectionSetting, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.ConnectionSetting or JSON or IO[bytes] + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connection_settings_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ConnectionSetting, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any + ) -> None: + """Deletes a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_connection_settings_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_bot_service( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.ConnectionSetting"]: + """Returns all the Connection Settings registered to a particular BotService resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: An iterator like instance of ConnectionSetting + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.ConnectionSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ConnectionSetting]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_connection_settings_list_by_bot_service_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ConnectionSetting], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_with_secrets( + self, resource_group_name: str, resource_name: str, connection_name: str, **kwargs: Any + ) -> _models.ConnectionSetting: + """Get a Connection Setting registration for a Bot Service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param connection_name: The name of the Bot Service Connection Setting resource. Required. + :type connection_name: str + :return: ConnectionSetting. The ConnectionSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.ConnectionSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ConnectionSetting] = kwargs.pop("cls", None) + + _request = build_connection_settings_list_with_secrets_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ConnectionSetting, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.BotServiceClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the specified private endpoint connection associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + properties: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.PrivateEndpointConnection: + """Update the state of specified private endpoint connection associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.PrivateEndpointConnection: + """Update the state of specified private endpoint connection associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.PrivateEndpointConnection: + """Update the state of specified private endpoint connection associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + properties: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any, + ) -> _models.PrivateEndpointConnection: + """Update the state of specified private endpoint connection associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Is one of the following types: + PrivateEndpointConnection, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.botservice.models.PrivateEndpointConnection or JSON or IO[bytes] + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + """Deletes the specified private endpoint connection associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: + """List all the private endpoint connections associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.BotServiceClient`'s + :attr:`network_security_perimeter_configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any, + ) -> _models.NetworkSecurityPerimeterConfiguration: + """Gets the specified Network Security Perimeter configuration associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param network_security_perimeter_configuration_name: The resource association Name. Composed + of parameter guid and association name. Required. + :type network_security_perimeter_configuration_name: str + :return: NetworkSecurityPerimeterConfiguration. The NetworkSecurityPerimeterConfiguration is + compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - models = _models + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.OperationEntity"]: - """Lists all the available BotService operations. + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkSecurityPerimeterConfiguration"]: + """List Network Security Perimeter configurations associated with the Bot. - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationEntity or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.OperationEntity] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :return: An iterator like instance of NetworkSecurityPerimeterConfiguration + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.OperationEntityListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.NetworkSecurityPerimeterConfiguration]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -107,14 +4009,20 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationEntity"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata["url"], + _request = build_network_security_perimeter_configurations_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -126,36 +4034,765 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OperationEntityListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NetworkSecurityPerimeterConfiguration], deserialized.get("value", []) + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) + error = _failsafe_deserialize(_models.Error, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.BotService/operations"} + def _reconcile_initial( + self, + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any, + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_reconcile_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_reconcile( + self, + resource_group_name: str, + resource_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any, + ) -> LROPoller[_models.NetworkSecurityPerimeterConfiguration]: + """Reconcile the specified Network Security Perimeter configuration associated with the Bot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Bot resource. Required. + :type resource_name: str + :param network_security_perimeter_configuration_name: The resource association Name. Composed + of parameter guid and association name. Required. + :type network_security_perimeter_configuration_name: str + :return: An instance of LROPoller that returns NetworkSecurityPerimeterConfiguration. The + NetworkSecurityPerimeterConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.botservice.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reconcile_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs, + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.NetworkSecurityPerimeterConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NetworkSecurityPerimeterConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class BotsOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.BotServiceClient`'s + :attr:`bots_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def get_check_name_availability( + self, + parameters: _models.CheckNameAvailabilityRequestBody, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.CheckNameAvailabilityResponseBody: + """Check whether a bot name is available. + + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.botservice.models.CheckNameAvailabilityRequestBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResponseBody. The CheckNameAvailabilityResponseBody is compatible + with MutableMapping + :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_check_name_availability( + self, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseBody: + """Check whether a bot name is available. + + :param parameters: The request body. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResponseBody. The CheckNameAvailabilityResponseBody is compatible + with MutableMapping + :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_check_name_availability( + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseBody: + """Check whether a bot name is available. + + :param parameters: The request body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResponseBody. The CheckNameAvailabilityResponseBody is compatible + with MutableMapping + :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_check_name_availability( + self, parameters: Union[_models.CheckNameAvailabilityRequestBody, JSON, IO[bytes]], **kwargs: Any + ) -> _models.CheckNameAvailabilityResponseBody: + """Check whether a bot name is available. + + :param parameters: The request body. Is one of the following types: + CheckNameAvailabilityRequestBody, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.CheckNameAvailabilityRequestBody or JSON or + IO[bytes] + :return: CheckNameAvailabilityResponseBody. The CheckNameAvailabilityResponseBody is compatible + with MutableMapping + :rtype: ~azure.mgmt.botservice.models.CheckNameAvailabilityResponseBody + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponseBody] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_bots_operation_group_get_check_name_availability_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityResponseBody, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class BotConnectionOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.BotServiceClient`'s + :attr:`bot_connection_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_service_providers(self, **kwargs: Any) -> _models.ServiceProviderResponseList: + """Lists the available Service Providers for creating Connection Settings. + + :return: ServiceProviderResponseList. The ServiceProviderResponseList is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.ServiceProviderResponseList + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ServiceProviderResponseList] = kwargs.pop("cls", None) + + _request = build_bot_connection_operation_group_list_service_providers_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ServiceProviderResponseList, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class QnAMakerEndpointKeysOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.BotServiceClient`'s + :attr:`qn_amaker_endpoint_keys_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def get( + self, + parameters: _models.QnAMakerEndpointKeysRequestBody, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.QnAMakerEndpointKeysResponse: + """Lists the QnA Maker endpoint keys. + + :param parameters: The request body. Required. + :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: QnAMakerEndpointKeysResponse. The QnAMakerEndpointKeysResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get( + self, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.QnAMakerEndpointKeysResponse: + """Lists the QnA Maker endpoint keys. + + :param parameters: The request body. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: QnAMakerEndpointKeysResponse. The QnAMakerEndpointKeysResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get( + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.QnAMakerEndpointKeysResponse: + """Lists the QnA Maker endpoint keys. + + :param parameters: The request body. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: QnAMakerEndpointKeysResponse. The QnAMakerEndpointKeysResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get( + self, parameters: Union[_models.QnAMakerEndpointKeysRequestBody, JSON, IO[bytes]], **kwargs: Any + ) -> _models.QnAMakerEndpointKeysResponse: + """Lists the QnA Maker endpoint keys. + + :param parameters: The request body. Is one of the following types: + QnAMakerEndpointKeysRequestBody, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody or JSON or + IO[bytes] + :return: QnAMakerEndpointKeysResponse. The QnAMakerEndpointKeysResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QnAMakerEndpointKeysResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_qn_amaker_endpoint_keys_operation_group_get_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.QnAMakerEndpointKeysResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class HostSettingsOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.BotServiceClient`'s + :attr:`host_settings_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, **kwargs: Any) -> _models.HostSettingsResponse: + """Get per subscription settings needed to host bot in compute resource such as Azure App Service. + + :return: HostSettingsResponse. The HostSettingsResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.botservice.models.HostSettingsResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.HostSettingsResponse] = kwargs.pop("cls", None) + + _request = build_host_settings_operation_group_get_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.HostSettingsResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class OperationResultsOperationGroupOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.botservice.BotServiceClient`'s + :attr:`operation_results_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BotServiceClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _get_initial(self, operation_result_id: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_operation_results_operation_group_get_request( + operation_result_id=operation_result_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.Error, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_get(self, operation_result_id: str, **kwargs: Any) -> LROPoller[_models.OperationResultsDescription]: + """Get the operation result for a long running operation. + + :param operation_result_id: The ID of the operation result to get. Required. + :type operation_result_id: str + :return: An instance of LROPoller that returns OperationResultsDescription. The + OperationResultsDescription is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.botservice.models.OperationResultsDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationResultsDescription] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._get_initial( + operation_result_id=operation_result_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs, + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.OperationResultsDescription, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.OperationResultsDescription].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OperationResultsDescription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_patch.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_patch.py +++ b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_endpoint_connections_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 8e0391ee845f..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,632 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.AzureBotService`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateEndpointConnection"]: - """List all the private endpoint connections associated with the Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.botservice.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections" - } - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets the specified private endpoint connection associated with the Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - properties: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Update the state of specified private endpoint connection associated with the Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: ~azure.mgmt.botservice.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - properties: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Update the state of specified private endpoint connection associated with the Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - resource_name: str, - private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Update the state of specified private endpoint connection associated with the Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Is either a model type or a IO - type. Required. - :type properties: ~azure.mgmt.botservice.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IO, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "PrivateEndpointConnection") - - request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - """Deletes the specified private endpoint connection associated with the Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Azure resource. Required. - :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_link_resources_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_link_resources_operations.py deleted file mode 100644 index 96ea52b415be..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,165 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_bot_resource_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", - resource_group_name, - "str", - max_length=64, - min_length=2, - pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", - ), - "resourceName": _SERIALIZER.url( - "resource_name", resource_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.AzureBotService`'s - :attr:`private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_bot_resource( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.PrivateLinkResourceListResult: - """Gets the private link resources that need to be created for a Bot. - - :param resource_group_name: The name of the Bot resource group in the user subscription. - Required. - :type resource_group_name: str - :param resource_name: The name of the Bot resource. Required. - :type resource_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.PrivateLinkResourceListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - request = build_list_by_bot_resource_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_bot_resource.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_by_bot_resource.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources" - } diff --git a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_qn_amaker_endpoint_keys_operations.py b/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_qn_amaker_endpoint_keys_operations.py deleted file mode 100644 index 2b17c3aeac0a..000000000000 --- a/sdk/botservice/azure-mgmt-botservice/azure/mgmt/botservice/operations/_qn_amaker_endpoint_keys_operations.py +++ /dev/null @@ -1,203 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listQnAMakerEndpointKeys" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class QnAMakerEndpointKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.botservice.AzureBotService`'s - :attr:`qn_amaker_endpoint_keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def get( - self, - parameters: _models.QnAMakerEndpointKeysRequestBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.QnAMakerEndpointKeysResponse: - """Lists the QnA Maker endpoint keys. - - :param parameters: The request body parameters to provide for the check name availability - request. Required. - :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: QnAMakerEndpointKeysResponse or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def get( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.QnAMakerEndpointKeysResponse: - """Lists the QnA Maker endpoint keys. - - :param parameters: The request body parameters to provide for the check name availability - request. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: QnAMakerEndpointKeysResponse or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def get( - self, parameters: Union[_models.QnAMakerEndpointKeysRequestBody, IO], **kwargs: Any - ) -> _models.QnAMakerEndpointKeysResponse: - """Lists the QnA Maker endpoint keys. - - :param parameters: The request body parameters to provide for the check name availability - request. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysRequestBody or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: QnAMakerEndpointKeysResponse or the result of cls(response) - :rtype: ~azure.mgmt.botservice.models.QnAMakerEndpointKeysResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-09-15"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.QnAMakerEndpointKeysResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "QnAMakerEndpointKeysRequestBody") - - request = build_get_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("QnAMakerEndpointKeysResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listQnAMakerEndpointKeys"} diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/check_name_availability.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/check_name_availability.py index 918636e90662..cbd7647e26c6 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/check_name_availability.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/check_name_availability.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,17 +25,17 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) - response = client.bots.get_check_name_availability( + response = client.bots_operation_group.get_check_name_availability( parameters={"name": "testbotname", "type": "string"}, ) print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/CheckNameAvailability.json +# x-ms-original-file: 2023-09-15-preview/CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/create_bot.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/create_bot.py index fb5e1782c217..3e08c417bc9d 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/create_bot.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/create_bot.py @@ -1,13 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,9 +26,9 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) response = client.bots.create( @@ -63,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/CreateBot.json +# x-ms-original-file: 2023-09-15-preview/CreateBot.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/create_email_sign_in_url.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/create_email_sign_in_url.py index f794b929353e..cee2e1da66ea 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/create_email_sign_in_url.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/create_email_sign_in_url.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,18 +25,18 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.email.create_sign_in_url( + response = client.bots.create_sign_in_url( resource_group_name="OneResourceGroupName", resource_name="samplebotname", ) print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/CreateEmailSignInUrl.json +# x-ms-original-file: 2023-09-15-preview/CreateEmailSignInUrl.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_bot.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_bot.py index 9c313495eee5..08d97194119e 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_bot.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_bot.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,18 +25,17 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.bots.delete( + client.bots.delete( resource_group_name="OneResourceGroupName", resource_name="samplebotname", ) - print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/DeleteBot.json +# x-ms-original-file: 2023-09-15-preview/DeleteBot.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_channel.py index f0395331dfe3..b9cd67679364 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,19 +25,18 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.delete( + client.bot_channels.delete( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="EmailChannel", ) - print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/DeleteChannel.json +# x-ms-original-file: 2023-09-15-preview/DeleteChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_connection.py index 2a0a3c64eba8..89f4a4f4a0b0 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_connection.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,19 +25,18 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.bot_connection.delete( + client.connection_settings.delete( resource_group_name="OneResourceGroupName", resource_name="samplebotname", connection_name="sampleConnection", ) - print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/DeleteConnection.json +# x-ms-original-file: 2023-09-15-preview/DeleteConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_direct_line_speech_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_direct_line_speech_channel.py index 62f39a9ae20f..ba20157eff8f 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_direct_line_speech_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_direct_line_speech_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,19 +25,18 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.delete( + client.bot_channels.delete( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="DirectLineSpeechChannel", ) - print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/DeleteDirectLineSpeechChannel.json +# x-ms-original-file: 2023-09-15-preview/DeleteDirectLineSpeechChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_private_endpoint_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_private_endpoint_connection.py index e6f2e627380f..d41d1dd03db5 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_private_endpoint_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/delete_private_endpoint_connection.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,19 +25,18 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) - response = client.private_endpoint_connections.delete( + client.private_endpoint_connections.delete( resource_group_name="res6977", resource_name="sto2527", private_endpoint_connection_name="{privateEndpointConnectionName}", ) - print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/DeletePrivateEndpointConnection.json +# x-ms-original-file: 2023-09-15-preview/DeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/directline_regenerate_keys.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/directline_regenerate_keys.py index 9b44df57868b..9a301ba5496c 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/directline_regenerate_keys.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/directline_regenerate_keys.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.direct_line.regenerate_keys( + response = client.bot_channels.regenerate_keys( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="DirectLineChannel", @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/DirectlineRegenerateKeys.json +# x-ms-original-file: 2023-09-15-preview/DirectlineRegenerateKeys.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_alexa_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_alexa_channel.py index 33169eed09bd..1844e0e9489a 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_alexa_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_alexa_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.get( + response = client.bot_channels.get( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="AlexaChannel", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetAlexaChannel.json +# x-ms-original-file: 2023-09-15-preview/GetAlexaChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_bot.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_bot.py index cd51da9d6146..81e742744b57 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_bot.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_bot.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,9 +25,9 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) response = client.bots.get( @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetBot.json +# x-ms-original-file: 2023-09-15-preview/GetBot.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_channel.py index 6fa96a7a8fee..7c78c3c8594e 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.get( + response = client.bot_channels.get( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="EmailChannel", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetChannel.json +# x-ms-original-file: 2023-09-15-preview/GetChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_connection.py index 6477b532d6ee..993a6dd7f9bf 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_connection.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.bot_connection.list_with_secrets( + response = client.connection_settings.list_with_secrets( resource_group_name="OneResourceGroupName", resource_name="samplebotname", connection_name="sampleConnection", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetConnection.json +# x-ms-original-file: 2023-09-15-preview/GetConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_direct_line_speech_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_direct_line_speech_channel.py index d5bbff2f296a..ea79518ee880 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_direct_line_speech_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_direct_line_speech_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.get( + response = client.bot_channels.get( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="DirectLineSpeechChannel", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetDirectLineSpeechChannel.json +# x-ms-original-file: 2023-09-15-preview/GetDirectLineSpeechChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_host_settings.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_host_settings.py index c1cfabcbb4a6..0e53285f7e4c 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_host_settings.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_host_settings.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,15 +25,15 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.host_settings.get() + response = client.host_settings_operation_group.get() print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetHostSettings.json +# x-ms-original-file: 2023-09-15-preview/GetHostSettings.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_line_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_line_channel.py index 867eb469da2c..e9f1be624811 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_line_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_line_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.get( + response = client.bot_channels.get( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="LineChannel", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetLineChannel.json +# x-ms-original-file: 2023-09-15-preview/GetLineChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_network_security_perimeter_configuration.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_network_security_perimeter_configuration.py new file mode 100644 index 000000000000..eb6da00213e9 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_network_security_perimeter_configuration.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.botservice import BotServiceClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-botservice +# USAGE + python get_network_security_perimeter_configuration.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BotServiceClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.network_security_perimeter_configurations.get( + resource_group_name="rgName", + resource_name="botId", + network_security_perimeter_configuration_name="00000000-0000-0000-0000-000000000000.associationName", + ) + print(response) + + +# x-ms-original-file: 2023-09-15-preview/GetNetworkSecurityPerimeterConfiguration.json +if __name__ == "__main__": + main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_operations.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_operations.py index 5e0d2c24cbce..10d100153502 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_operations.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_operations.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,7 +25,7 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetOperations.json +# x-ms-original-file: 2023-09-15-preview/GetOperations.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_private_endpoint_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_private_endpoint_connection.py index 606dd6d004eb..d2fd02bea385 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/get_private_endpoint_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/get_private_endpoint_connection.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,9 +25,9 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/GetPrivateEndpointConnection.json +# x-ms-original-file: 2023-09-15-preview/GetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_resource_group.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_resource_group.py index ad486f5beed1..84b0605681e9 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_resource_group.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_resource_group.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,9 +25,9 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) response = client.bots.list_by_resource_group( @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListBotsByResourceGroup.json +# x-ms-original-file: 2023-09-15-preview/ListBotsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_subscription.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_subscription.py index b9a30d883948..114b344ada25 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_subscription.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_bots_by_subscription.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,9 +25,9 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) response = client.bots.list() @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListBotsBySubscription.json +# x-ms-original-file: 2023-09-15-preview/ListBotsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channel.py index 473aff1cc087..2859e3391701 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.list_with_keys( + response = client.bot_channels.list_with_keys( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="EmailChannel", @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListChannel.json +# x-ms-original-file: 2023-09-15-preview/ListChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channels_by_bot_service.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channels_by_bot_service.py index 8df6fc18a628..5a179cfe0aed 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channels_by_bot_service.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_channels_by_bot_service.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.list_by_resource_group( + response = client.bot_channels.list_by_resource_group( resource_group_name="OneResourceGroupName", resource_name="samplebotname", ) @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListChannelsByBotService.json +# x-ms-original-file: 2023-09-15-preview/ListChannelsByBotService.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_connections_by_bot_service.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_connections_by_bot_service.py index c970494b970e..05278c8d5940 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_connections_by_bot_service.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_connections_by_bot_service.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.bot_connection.list_by_bot_service( + response = client.connection_settings.list_by_bot_service( resource_group_name="OneResourceGroupName", resource_name="samplebotname", ) @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListConnectionsByBotService.json +# x-ms-original-file: 2023-09-15-preview/ListConnectionsByBotService.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_network_security_perimeter_configurations.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_network_security_perimeter_configurations.py new file mode 100644 index 000000000000..3175ad29b6ff --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_network_security_perimeter_configurations.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.botservice import BotServiceClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-botservice +# USAGE + python list_network_security_perimeter_configurations.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BotServiceClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.network_security_perimeter_configurations.list( + resource_group_name="rgName", + resource_name="botId", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2023-09-15-preview/ListNetworkSecurityPerimeterConfigurations.json +if __name__ == "__main__": + main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_endpoint_connections.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_endpoint_connections.py index c000002ec3cb..c9a40cccc807 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_endpoint_connections.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_endpoint_connections.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,9 +25,9 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.list( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListPrivateEndpointConnections.json +# x-ms-original-file: 2023-09-15-preview/ListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_link_resources.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_link_resources.py index a58440a0ed08..4f950cb6e5b0 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_link_resources.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_private_link_resources.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,18 +25,18 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) - response = client.private_link_resources.list_by_bot_resource( + response = client.bots.list_by_bot_resource( resource_group_name="res6977", resource_name="sto2527", ) print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListPrivateLinkResources.json +# x-ms-original-file: 2023-09-15-preview/ListPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_qn_amaker_endpoint_keys.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_qn_amaker_endpoint_keys.py index c0666fd5567f..27284959b2b2 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_qn_amaker_endpoint_keys.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_qn_amaker_endpoint_keys.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,17 +25,17 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.qn_amaker_endpoint_keys.get( + response = client.qn_amaker_endpoint_keys_operation_group.get( parameters={"authkey": "testAuthKey", "hostname": "https://xxx.cognitiveservices.azure.com/"}, ) print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListQnAMakerEndpointKeys.json +# x-ms-original-file: 2023-09-15-preview/ListQnAMakerEndpointKeys.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_service_providers.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_service_providers.py index ed4fd43ae2e3..dc02fbd8e33b 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/list_service_providers.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/list_service_providers.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,15 +25,15 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.bot_connection.list_service_providers() + response = client.bot_connection_operation_group.list_service_providers() print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/ListServiceProviders.json +# x-ms-original-file: 2023-09-15-preview/ListServiceProviders.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/operation_results_get.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/operation_results_get.py index 9cd2881b0598..04cc4f6395d9 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/operation_results_get.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/operation_results_get.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,17 +25,17 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.operation_results.begin_get( + response = client.operation_results_operation_group.begin_get( operation_result_id="exampleid", ).result() print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/OperationResultsGet.json +# x-ms-original-file: 2023-09-15-preview/OperationResultsGet.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_alexa_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_alexa_channel.py index 7c29b9bc1fa1..606d79c04cbb 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_alexa_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_alexa_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.create( + response = client.bot_channels.create( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="AlexaChannel", @@ -44,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutAlexaChannel.json +# x-ms-original-file: 2023-09-15-preview/PutAlexaChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_channel.py index 73b5c50281a8..0296c829bb8e 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.create( + response = client.bot_channels.create( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="EmailChannel", @@ -44,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutChannel.json +# x-ms-original-file: 2023-09-15-preview/PutChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_connection.py index 5f3a2ae88334..aa54dfb2c70e 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_connection.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.bot_connection.create( + response = client.connection_settings.create( resource_group_name="OneResourceGroupName", resource_name="samplebotname", connection_name="sampleConnection", @@ -48,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutConnection.json +# x-ms-original-file: 2023-09-15-preview/PutConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_direct_line_speech_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_direct_line_speech_channel.py index 88e937a1a068..76ca6f916d6c 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_direct_line_speech_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_direct_line_speech_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.create( + response = client.bot_channels.create( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="DirectLineSpeechChannel", @@ -48,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutDirectLineSpeechChannel.json +# x-ms-original-file: 2023-09-15-preview/PutDirectLineSpeechChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_email_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_email_channel.py index a630d739e26e..e11ff9843e91 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_email_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_email_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.create( + response = client.bot_channels.create( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="EmailChannel", @@ -44,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutEmailChannel.json +# x-ms-original-file: 2023-09-15-preview/PutEmailChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_line_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_line_channel.py index 25010e95c991..decb385f174f 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_line_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_line_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.create( + response = client.bot_channels.create( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="LineChannel", @@ -48,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutLineChannel.json +# x-ms-original-file: 2023-09-15-preview/PutLineChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_private_endpoint_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_private_endpoint_connection.py index e0ef02b8e1ac..774afee9efcf 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/put_private_endpoint_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/put_private_endpoint_connection.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,9 +25,9 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.create( @@ -40,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/PutPrivateEndpointConnection.json +# x-ms-original-file: 2023-09-15-preview/PutPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/reconcile_network_security_perimeter_configuration.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/reconcile_network_security_perimeter_configuration.py new file mode 100644 index 000000000000..9dd0be011008 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/reconcile_network_security_perimeter_configuration.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.botservice import BotServiceClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-botservice +# USAGE + python reconcile_network_security_perimeter_configuration.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = BotServiceClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.network_security_perimeter_configurations.begin_reconcile( + resource_group_name="rgName", + resource_name="botId", + network_security_perimeter_configuration_name="00000000-0000-0000-0000-000000000000.associationName", + ).result() + print(response) + + +# x-ms-original-file: 2023-09-15-preview/ReconcileNetworkSecurityPerimeterConfiguration.json +if __name__ == "__main__": + main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_alexa_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_alexa_channel.py index 6fc6fd1d7527..62f8bcbe1f54 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_alexa_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_alexa_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,19 +25,26 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.update( + response = client.bot_channels.update( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="AlexaChannel", + parameters={ + "location": "global", + "properties": { + "channelName": "AlexaChannel", + "properties": {"alexaSkillId": "XAlexaSkillIdX", "isEnabled": True}, + }, + }, ) print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/UpdateAlexaChannel.json +# x-ms-original-file: 2023-09-15-preview/UpdateAlexaChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_bot.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_bot.py index 1dbdc68a70f9..327fb1b46929 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_bot.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_bot.py @@ -1,13 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,18 +26,45 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) response = client.bots.update( resource_group_name="OneResourceGroupName", resource_name="samplebotname", + parameters={ + "etag": "etag1", + "kind": "sdk", + "location": "West US", + "properties": { + "cmekKeyVaultUrl": "https://myCmekKey", + "description": "The description of the bot", + "developerAppInsightKey": "appinsightskey", + "developerAppInsightsApiKey": "appinsightsapikey", + "developerAppInsightsApplicationId": "appinsightsappid", + "disableLocalAuth": True, + "displayName": "The Name of the bot", + "endpoint": "http://mybot.coffee", + "iconUrl": "http://myicon", + "isCmekEnabled": True, + "luisAppIds": ["luisappid1", "luisappid2"], + "luisKey": "luiskey", + "msaAppId": "msaappid", + "msaAppMSIResourceId": "/subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId", + "msaAppTenantId": "msaapptenantid", + "msaAppType": "UserAssignedMSI", + "publicNetworkAccess": "Enabled", + "schemaTransformationVersion": "1.0", + }, + "sku": {"name": "S1"}, + "tags": {"tag1": "value1", "tag2": "value2"}, + }, ) print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/UpdateBot.json +# x-ms-original-file: 2023-09-15-preview/UpdateBot.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_channel.py index bf92a3d8d339..75d032f00b92 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,19 +25,26 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.update( + response = client.bot_channels.update( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="EmailChannel", + parameters={ + "location": "global", + "properties": { + "channelName": "EmailChannel", + "properties": {"emailAddress": "a@b.com", "isEnabled": True, "password": "pwd"}, + }, + }, ) print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/UpdateChannel.json +# x-ms-original-file: 2023-09-15-preview/UpdateChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_connection.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_connection.py index 51d978197d4c..7910ff41d583 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_connection.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_connection.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.bot_connection.update( + response = client.connection_settings.update( resource_group_name="OneResourceGroupName", resource_name="samplebotname", connection_name="sampleConnection", @@ -39,6 +40,8 @@ def main(): "properties": { "clientId": "sampleclientid", "clientSecret": "samplesecret", + "id": "sampleId", + "name": "sampleName", "parameters": [{"key": "key1", "value": "value1"}, {"key": "key2", "value": "value2"}], "scopes": "samplescope", "serviceProviderDisplayName": "serviceProviderDisplayName", @@ -49,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/UpdateConnection.json +# x-ms-original-file: 2023-09-15-preview/UpdateConnection.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_direct_line_speech_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_direct_line_speech_channel.py index d87a0b0855cc..d9c494d26abd 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_direct_line_speech_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_direct_line_speech_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,19 +25,30 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.update( + response = client.bot_channels.update( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="DirectLineSpeechChannel", + parameters={ + "location": "global", + "properties": { + "channelName": "DirectLineSpeechChannel", + "properties": { + "cognitiveServiceRegion": "XcognitiveServiceRegionX", + "cognitiveServiceSubscriptionKey": "XcognitiveServiceSubscriptionKeyX", + "isEnabled": True, + }, + }, + }, ) print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/UpdateDirectLineSpeechChannel.json +# x-ms-original-file: 2023-09-15-preview/UpdateDirectLineSpeechChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_line_channel.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_line_channel.py index 78fb7b7ee973..450ae275812f 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/update_line_channel.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/update_line_channel.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,19 +25,30 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.channels.update( + response = client.bot_channels.update( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="LineChannel", + parameters={ + "location": "global", + "properties": { + "channelName": "LineChannel", + "properties": { + "lineRegistrations": [ + {"channelAccessToken": "channelAccessToken", "channelSecret": "channelSecret"} + ] + }, + }, + }, ) print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/UpdateLineChannel.json +# x-ms-original-file: 2023-09-15-preview/UpdateLineChannel.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_samples/web_chat_regenerate_keys.py b/sdk/botservice/azure-mgmt-botservice/generated_samples/web_chat_regenerate_keys.py index f032b7e01ee7..c05922dfed90 100644 --- a/sdk/botservice/azure-mgmt-botservice/generated_samples/web_chat_regenerate_keys.py +++ b/sdk/botservice/azure-mgmt-botservice/generated_samples/web_chat_regenerate_keys.py @@ -2,12 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.botservice import AzureBotService + +from azure.mgmt.botservice import BotServiceClient """ # PREREQUISITES @@ -24,12 +25,12 @@ def main(): - client = AzureBotService( + client = BotServiceClient( credential=DefaultAzureCredential(), - subscription_id="subscription-id", + subscription_id="SUBSCRIPTION_ID", ) - response = client.direct_line.regenerate_keys( + response = client.bot_channels.regenerate_keys( resource_group_name="OneResourceGroupName", resource_name="samplebotname", channel_name="WebChatChannel", @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/examples/WebChatRegenerateKeys.json +# x-ms-original-file: 2023-09-15-preview/WebChatRegenerateKeys.json if __name__ == "__main__": main() diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/conftest.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/conftest.py new file mode 100644 index 000000000000..864c3a56a95e --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + botservice_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + botservice_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + botservice_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + botservice_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=botservice_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=botservice_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=botservice_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=botservice_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_channels_operations.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_channels_operations.py new file mode 100644 index 000000000000..7d8aed4b8706 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_channels_operations.py @@ -0,0 +1,143 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceBotChannelsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bot_channels_get(self, resource_group): + response = self.client.bot_channels.get( + resource_group_name=resource_group.name, + resource_name="str", + channel_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bot_channels_create(self, resource_group): + response = self.client.bot_channels.create( + resource_group_name=resource_group.name, + resource_name="str", + channel_name="str", + parameters={ + "location": "str", + "etag": "str", + "id": "str", + "kind": "str", + "name": "str", + "properties": "channel", + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bot_channels_update(self, resource_group): + response = self.client.bot_channels.update( + resource_group_name=resource_group.name, + resource_name="str", + channel_name="str", + parameters={ + "location": "str", + "etag": "str", + "id": "str", + "kind": "str", + "name": "str", + "properties": "channel", + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bot_channels_delete(self, resource_group): + response = self.client.bot_channels.delete( + resource_group_name=resource_group.name, + resource_name="str", + channel_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bot_channels_list_by_resource_group(self, resource_group): + response = self.client.bot_channels.list_by_resource_group( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bot_channels_list_with_keys(self, resource_group): + response = self.client.bot_channels.list_with_keys( + resource_group_name=resource_group.name, + resource_name="str", + channel_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bot_channels_regenerate_keys(self, resource_group): + response = self.client.bot_channels.regenerate_keys( + resource_group_name=resource_group.name, + resource_name="str", + channel_name="str", + parameters={"key": "str", "siteName": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_channels_operations_async.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_channels_operations_async.py new file mode 100644 index 000000000000..0addb5beb483 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_channels_operations_async.py @@ -0,0 +1,144 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice.aio import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceBotChannelsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bot_channels_get(self, resource_group): + response = await self.client.bot_channels.get( + resource_group_name=resource_group.name, + resource_name="str", + channel_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bot_channels_create(self, resource_group): + response = await self.client.bot_channels.create( + resource_group_name=resource_group.name, + resource_name="str", + channel_name="str", + parameters={ + "location": "str", + "etag": "str", + "id": "str", + "kind": "str", + "name": "str", + "properties": "channel", + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bot_channels_update(self, resource_group): + response = await self.client.bot_channels.update( + resource_group_name=resource_group.name, + resource_name="str", + channel_name="str", + parameters={ + "location": "str", + "etag": "str", + "id": "str", + "kind": "str", + "name": "str", + "properties": "channel", + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bot_channels_delete(self, resource_group): + response = await self.client.bot_channels.delete( + resource_group_name=resource_group.name, + resource_name="str", + channel_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bot_channels_list_by_resource_group(self, resource_group): + response = self.client.bot_channels.list_by_resource_group( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bot_channels_list_with_keys(self, resource_group): + response = await self.client.bot_channels.list_with_keys( + resource_group_name=resource_group.name, + resource_name="str", + channel_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bot_channels_regenerate_keys(self, resource_group): + response = await self.client.bot_channels.regenerate_keys( + resource_group_name=resource_group.name, + resource_name="str", + channel_name="str", + parameters={"key": "str", "siteName": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_connection_operation_group_operations.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_connection_operation_group_operations.py new file mode 100644 index 000000000000..bf930f7c5da7 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_connection_operation_group_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceBotConnectionOperationGroupOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bot_connection_operation_group_list_service_providers(self, resource_group): + response = self.client.bot_connection_operation_group.list_service_providers() + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_connection_operation_group_operations_async.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_connection_operation_group_operations_async.py new file mode 100644 index 000000000000..54c4f63735bf --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bot_connection_operation_group_operations_async.py @@ -0,0 +1,28 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice.aio import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceBotConnectionOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bot_connection_operation_group_list_service_providers(self, resource_group): + response = await self.client.bot_connection_operation_group.list_service_providers() + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operation_group_operations.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operation_group_operations.py new file mode 100644 index 000000000000..fc910a6a7723 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operation_group_operations.py @@ -0,0 +1,29 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceBotsOperationGroupOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bots_operation_group_get_check_name_availability(self, resource_group): + response = self.client.bots_operation_group.get_check_name_availability( + parameters={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operation_group_operations_async.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operation_group_operations_async.py new file mode 100644 index 000000000000..85f1b352a514 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operation_group_operations_async.py @@ -0,0 +1,30 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice.aio import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceBotsOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bots_operation_group_get_check_name_availability(self, resource_group): + response = await self.client.bots_operation_group.get_check_name_availability( + parameters={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operations.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operations.py new file mode 100644 index 000000000000..a9b46856b1df --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operations.py @@ -0,0 +1,401 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceBotsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bots_get(self, resource_group): + response = self.client.bots.get( + resource_group_name=resource_group.name, + resource_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bots_create(self, resource_group): + response = self.client.bots.create( + resource_group_name=resource_group.name, + resource_name="str", + parameters={ + "location": "str", + "etag": "str", + "id": "str", + "kind": "str", + "name": "str", + "properties": { + "displayName": "str", + "endpoint": "str", + "msaAppId": "str", + "allSettings": {"str": "str"}, + "appPasswordHint": "str", + "cmekEncryptionStatus": "str", + "cmekKeyVaultUrl": "str", + "configuredChannels": ["str"], + "description": "str", + "developerAppInsightKey": "str", + "developerAppInsightsApiKey": "str", + "developerAppInsightsApplicationId": "str", + "disableLocalAuth": bool, + "enabledChannels": ["str"], + "endpointVersion": "str", + "iconUrl": "str", + "isCmekEnabled": bool, + "isDeveloperAppInsightsApiKeySet": bool, + "isStreamingSupported": bool, + "luisAppIds": ["str"], + "luisKey": "str", + "manifestUrl": "str", + "migrationToken": "str", + "msaAppMSIResourceId": "str", + "msaAppTenantId": "str", + "msaAppType": "str", + "networkSecurityPerimeterConfigurations": [ + { + "id": "str", + "name": "str", + "properties": { + "networkSecurityPerimeter": {"id": "str", "location": "str", "perimeterGuid": "str"}, + "profile": { + "accessRules": [ + { + "name": "str", + "properties": { + "addressPrefixes": ["str"], + "direction": "str", + "emailAddresses": ["str"], + "fullyQualifiedDomainNames": ["str"], + "networkSecurityPerimeters": [ + {"id": "str", "location": "str", "perimeterGuid": "str"} + ], + "phoneNumbers": ["str"], + "subscriptions": [{"id": "str"}], + }, + } + ], + "accessRulesVersion": 0, + "diagnosticSettingsVersion": 0, + "enabledLogCategories": ["str"], + "name": "str", + }, + "provisioningIssues": [ + { + "name": "str", + "properties": { + "description": "str", + "issueType": "str", + "severity": "str", + "suggestedAccessRules": [ + { + "name": "str", + "properties": { + "addressPrefixes": ["str"], + "direction": "str", + "emailAddresses": ["str"], + "fullyQualifiedDomainNames": ["str"], + "networkSecurityPerimeters": [ + {"id": "str", "location": "str", "perimeterGuid": "str"} + ], + "phoneNumbers": ["str"], + "subscriptions": [{"id": "str"}], + }, + } + ], + "suggestedResourceIds": ["str"], + }, + } + ], + "provisioningState": "str", + "resourceAssociation": {"accessMode": "str", "name": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "openWithHint": "str", + "parameters": {"str": "str"}, + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "publishingCredentials": "str", + "schemaTransformationVersion": "str", + "storageResourceId": "str", + "tenantId": "str", + }, + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bots_update(self, resource_group): + response = self.client.bots.update( + resource_group_name=resource_group.name, + resource_name="str", + parameters={ + "location": "str", + "etag": "str", + "id": "str", + "kind": "str", + "name": "str", + "properties": { + "displayName": "str", + "endpoint": "str", + "msaAppId": "str", + "allSettings": {"str": "str"}, + "appPasswordHint": "str", + "cmekEncryptionStatus": "str", + "cmekKeyVaultUrl": "str", + "configuredChannels": ["str"], + "description": "str", + "developerAppInsightKey": "str", + "developerAppInsightsApiKey": "str", + "developerAppInsightsApplicationId": "str", + "disableLocalAuth": bool, + "enabledChannels": ["str"], + "endpointVersion": "str", + "iconUrl": "str", + "isCmekEnabled": bool, + "isDeveloperAppInsightsApiKeySet": bool, + "isStreamingSupported": bool, + "luisAppIds": ["str"], + "luisKey": "str", + "manifestUrl": "str", + "migrationToken": "str", + "msaAppMSIResourceId": "str", + "msaAppTenantId": "str", + "msaAppType": "str", + "networkSecurityPerimeterConfigurations": [ + { + "id": "str", + "name": "str", + "properties": { + "networkSecurityPerimeter": {"id": "str", "location": "str", "perimeterGuid": "str"}, + "profile": { + "accessRules": [ + { + "name": "str", + "properties": { + "addressPrefixes": ["str"], + "direction": "str", + "emailAddresses": ["str"], + "fullyQualifiedDomainNames": ["str"], + "networkSecurityPerimeters": [ + {"id": "str", "location": "str", "perimeterGuid": "str"} + ], + "phoneNumbers": ["str"], + "subscriptions": [{"id": "str"}], + }, + } + ], + "accessRulesVersion": 0, + "diagnosticSettingsVersion": 0, + "enabledLogCategories": ["str"], + "name": "str", + }, + "provisioningIssues": [ + { + "name": "str", + "properties": { + "description": "str", + "issueType": "str", + "severity": "str", + "suggestedAccessRules": [ + { + "name": "str", + "properties": { + "addressPrefixes": ["str"], + "direction": "str", + "emailAddresses": ["str"], + "fullyQualifiedDomainNames": ["str"], + "networkSecurityPerimeters": [ + {"id": "str", "location": "str", "perimeterGuid": "str"} + ], + "phoneNumbers": ["str"], + "subscriptions": [{"id": "str"}], + }, + } + ], + "suggestedResourceIds": ["str"], + }, + } + ], + "provisioningState": "str", + "resourceAssociation": {"accessMode": "str", "name": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "openWithHint": "str", + "parameters": {"str": "str"}, + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "publishingCredentials": "str", + "schemaTransformationVersion": "str", + "storageResourceId": "str", + "tenantId": "str", + }, + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bots_delete(self, resource_group): + response = self.client.bots.delete( + resource_group_name=resource_group.name, + resource_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bots_list_by_resource_group(self, resource_group): + response = self.client.bots.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bots_list(self, resource_group): + response = self.client.bots.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bots_create_sign_in_url(self, resource_group): + response = self.client.bots.create_sign_in_url( + resource_group_name=resource_group.name, + resource_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_bots_list_by_bot_resource(self, resource_group): + response = self.client.bots.list_by_bot_resource( + resource_group_name=resource_group.name, + resource_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operations_async.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operations_async.py new file mode 100644 index 000000000000..29c218f4ff56 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_bots_operations_async.py @@ -0,0 +1,402 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice.aio import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceBotsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bots_get(self, resource_group): + response = await self.client.bots.get( + resource_group_name=resource_group.name, + resource_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bots_create(self, resource_group): + response = await self.client.bots.create( + resource_group_name=resource_group.name, + resource_name="str", + parameters={ + "location": "str", + "etag": "str", + "id": "str", + "kind": "str", + "name": "str", + "properties": { + "displayName": "str", + "endpoint": "str", + "msaAppId": "str", + "allSettings": {"str": "str"}, + "appPasswordHint": "str", + "cmekEncryptionStatus": "str", + "cmekKeyVaultUrl": "str", + "configuredChannels": ["str"], + "description": "str", + "developerAppInsightKey": "str", + "developerAppInsightsApiKey": "str", + "developerAppInsightsApplicationId": "str", + "disableLocalAuth": bool, + "enabledChannels": ["str"], + "endpointVersion": "str", + "iconUrl": "str", + "isCmekEnabled": bool, + "isDeveloperAppInsightsApiKeySet": bool, + "isStreamingSupported": bool, + "luisAppIds": ["str"], + "luisKey": "str", + "manifestUrl": "str", + "migrationToken": "str", + "msaAppMSIResourceId": "str", + "msaAppTenantId": "str", + "msaAppType": "str", + "networkSecurityPerimeterConfigurations": [ + { + "id": "str", + "name": "str", + "properties": { + "networkSecurityPerimeter": {"id": "str", "location": "str", "perimeterGuid": "str"}, + "profile": { + "accessRules": [ + { + "name": "str", + "properties": { + "addressPrefixes": ["str"], + "direction": "str", + "emailAddresses": ["str"], + "fullyQualifiedDomainNames": ["str"], + "networkSecurityPerimeters": [ + {"id": "str", "location": "str", "perimeterGuid": "str"} + ], + "phoneNumbers": ["str"], + "subscriptions": [{"id": "str"}], + }, + } + ], + "accessRulesVersion": 0, + "diagnosticSettingsVersion": 0, + "enabledLogCategories": ["str"], + "name": "str", + }, + "provisioningIssues": [ + { + "name": "str", + "properties": { + "description": "str", + "issueType": "str", + "severity": "str", + "suggestedAccessRules": [ + { + "name": "str", + "properties": { + "addressPrefixes": ["str"], + "direction": "str", + "emailAddresses": ["str"], + "fullyQualifiedDomainNames": ["str"], + "networkSecurityPerimeters": [ + {"id": "str", "location": "str", "perimeterGuid": "str"} + ], + "phoneNumbers": ["str"], + "subscriptions": [{"id": "str"}], + }, + } + ], + "suggestedResourceIds": ["str"], + }, + } + ], + "provisioningState": "str", + "resourceAssociation": {"accessMode": "str", "name": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "openWithHint": "str", + "parameters": {"str": "str"}, + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "publishingCredentials": "str", + "schemaTransformationVersion": "str", + "storageResourceId": "str", + "tenantId": "str", + }, + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bots_update(self, resource_group): + response = await self.client.bots.update( + resource_group_name=resource_group.name, + resource_name="str", + parameters={ + "location": "str", + "etag": "str", + "id": "str", + "kind": "str", + "name": "str", + "properties": { + "displayName": "str", + "endpoint": "str", + "msaAppId": "str", + "allSettings": {"str": "str"}, + "appPasswordHint": "str", + "cmekEncryptionStatus": "str", + "cmekKeyVaultUrl": "str", + "configuredChannels": ["str"], + "description": "str", + "developerAppInsightKey": "str", + "developerAppInsightsApiKey": "str", + "developerAppInsightsApplicationId": "str", + "disableLocalAuth": bool, + "enabledChannels": ["str"], + "endpointVersion": "str", + "iconUrl": "str", + "isCmekEnabled": bool, + "isDeveloperAppInsightsApiKeySet": bool, + "isStreamingSupported": bool, + "luisAppIds": ["str"], + "luisKey": "str", + "manifestUrl": "str", + "migrationToken": "str", + "msaAppMSIResourceId": "str", + "msaAppTenantId": "str", + "msaAppType": "str", + "networkSecurityPerimeterConfigurations": [ + { + "id": "str", + "name": "str", + "properties": { + "networkSecurityPerimeter": {"id": "str", "location": "str", "perimeterGuid": "str"}, + "profile": { + "accessRules": [ + { + "name": "str", + "properties": { + "addressPrefixes": ["str"], + "direction": "str", + "emailAddresses": ["str"], + "fullyQualifiedDomainNames": ["str"], + "networkSecurityPerimeters": [ + {"id": "str", "location": "str", "perimeterGuid": "str"} + ], + "phoneNumbers": ["str"], + "subscriptions": [{"id": "str"}], + }, + } + ], + "accessRulesVersion": 0, + "diagnosticSettingsVersion": 0, + "enabledLogCategories": ["str"], + "name": "str", + }, + "provisioningIssues": [ + { + "name": "str", + "properties": { + "description": "str", + "issueType": "str", + "severity": "str", + "suggestedAccessRules": [ + { + "name": "str", + "properties": { + "addressPrefixes": ["str"], + "direction": "str", + "emailAddresses": ["str"], + "fullyQualifiedDomainNames": ["str"], + "networkSecurityPerimeters": [ + {"id": "str", "location": "str", "perimeterGuid": "str"} + ], + "phoneNumbers": ["str"], + "subscriptions": [{"id": "str"}], + }, + } + ], + "suggestedResourceIds": ["str"], + }, + } + ], + "provisioningState": "str", + "resourceAssociation": {"accessMode": "str", "name": "str"}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "openWithHint": "str", + "parameters": {"str": "str"}, + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "publishingCredentials": "str", + "schemaTransformationVersion": "str", + "storageResourceId": "str", + "tenantId": "str", + }, + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bots_delete(self, resource_group): + response = await self.client.bots.delete( + resource_group_name=resource_group.name, + resource_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bots_list_by_resource_group(self, resource_group): + response = self.client.bots.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bots_list(self, resource_group): + response = self.client.bots.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bots_create_sign_in_url(self, resource_group): + response = await self.client.bots.create_sign_in_url( + resource_group_name=resource_group.name, + resource_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_bots_list_by_bot_resource(self, resource_group): + response = await self.client.bots.list_by_bot_resource( + resource_group_name=resource_group.name, + resource_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_connection_settings_operations.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_connection_settings_operations.py new file mode 100644 index 000000000000..487d5c165c63 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_connection_settings_operations.py @@ -0,0 +1,152 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceConnectionSettingsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_connection_settings_get(self, resource_group): + response = self.client.connection_settings.get( + resource_group_name=resource_group.name, + resource_name="str", + connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_connection_settings_create(self, resource_group): + response = self.client.connection_settings.create( + resource_group_name=resource_group.name, + resource_name="str", + connection_name="str", + parameters={ + "location": "str", + "etag": "str", + "id": "str", + "kind": "str", + "name": "str", + "properties": { + "clientId": "str", + "clientSecret": "str", + "id": "str", + "name": "str", + "parameters": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "scopes": "str", + "serviceProviderDisplayName": "str", + "serviceProviderId": "str", + "settingId": "str", + }, + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_connection_settings_update(self, resource_group): + response = self.client.connection_settings.update( + resource_group_name=resource_group.name, + resource_name="str", + connection_name="str", + parameters={ + "location": "str", + "etag": "str", + "id": "str", + "kind": "str", + "name": "str", + "properties": { + "clientId": "str", + "clientSecret": "str", + "id": "str", + "name": "str", + "parameters": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "scopes": "str", + "serviceProviderDisplayName": "str", + "serviceProviderId": "str", + "settingId": "str", + }, + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_connection_settings_delete(self, resource_group): + response = self.client.connection_settings.delete( + resource_group_name=resource_group.name, + resource_name="str", + connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_connection_settings_list_by_bot_service(self, resource_group): + response = self.client.connection_settings.list_by_bot_service( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_connection_settings_list_with_secrets(self, resource_group): + response = self.client.connection_settings.list_with_secrets( + resource_group_name=resource_group.name, + resource_name="str", + connection_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_connection_settings_operations_async.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_connection_settings_operations_async.py new file mode 100644 index 000000000000..fdf92e23d387 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_connection_settings_operations_async.py @@ -0,0 +1,153 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice.aio import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceConnectionSettingsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_connection_settings_get(self, resource_group): + response = await self.client.connection_settings.get( + resource_group_name=resource_group.name, + resource_name="str", + connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_connection_settings_create(self, resource_group): + response = await self.client.connection_settings.create( + resource_group_name=resource_group.name, + resource_name="str", + connection_name="str", + parameters={ + "location": "str", + "etag": "str", + "id": "str", + "kind": "str", + "name": "str", + "properties": { + "clientId": "str", + "clientSecret": "str", + "id": "str", + "name": "str", + "parameters": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "scopes": "str", + "serviceProviderDisplayName": "str", + "serviceProviderId": "str", + "settingId": "str", + }, + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_connection_settings_update(self, resource_group): + response = await self.client.connection_settings.update( + resource_group_name=resource_group.name, + resource_name="str", + connection_name="str", + parameters={ + "location": "str", + "etag": "str", + "id": "str", + "kind": "str", + "name": "str", + "properties": { + "clientId": "str", + "clientSecret": "str", + "id": "str", + "name": "str", + "parameters": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "scopes": "str", + "serviceProviderDisplayName": "str", + "serviceProviderId": "str", + "settingId": "str", + }, + "sku": {"name": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "zones": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_connection_settings_delete(self, resource_group): + response = await self.client.connection_settings.delete( + resource_group_name=resource_group.name, + resource_name="str", + connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_connection_settings_list_by_bot_service(self, resource_group): + response = self.client.connection_settings.list_by_bot_service( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_connection_settings_list_with_secrets(self, resource_group): + response = await self.client.connection_settings.list_with_secrets( + resource_group_name=resource_group.name, + resource_name="str", + connection_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_host_settings_operation_group_operations.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_host_settings_operation_group_operations.py new file mode 100644 index 000000000000..9013a8aa23d8 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_host_settings_operation_group_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceHostSettingsOperationGroupOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_host_settings_operation_group_get(self, resource_group): + response = self.client.host_settings_operation_group.get() + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_host_settings_operation_group_operations_async.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_host_settings_operation_group_operations_async.py new file mode 100644 index 000000000000..67eb56220321 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_host_settings_operation_group_operations_async.py @@ -0,0 +1,28 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice.aio import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceHostSettingsOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_host_settings_operation_group_get(self, resource_group): + response = await self.client.host_settings_operation_group.get() + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_network_security_perimeter_configurations_operations.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_network_security_perimeter_configurations_operations.py new file mode 100644 index 000000000000..eb3db3ac3073 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_network_security_perimeter_configurations_operations.py @@ -0,0 +1,54 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceNetworkSecurityPerimeterConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_network_security_perimeter_configurations_get(self, resource_group): + response = self.client.network_security_perimeter_configurations.get( + resource_group_name=resource_group.name, + resource_name="str", + network_security_perimeter_configuration_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_network_security_perimeter_configurations_list(self, resource_group): + response = self.client.network_security_perimeter_configurations.list( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_network_security_perimeter_configurations_begin_reconcile(self, resource_group): + response = self.client.network_security_perimeter_configurations.begin_reconcile( + resource_group_name=resource_group.name, + resource_name="str", + network_security_perimeter_configuration_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_network_security_perimeter_configurations_operations_async.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_network_security_perimeter_configurations_operations_async.py new file mode 100644 index 000000000000..3035a195642f --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_network_security_perimeter_configurations_operations_async.py @@ -0,0 +1,57 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice.aio import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceNetworkSecurityPerimeterConfigurationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_network_security_perimeter_configurations_get(self, resource_group): + response = await self.client.network_security_perimeter_configurations.get( + resource_group_name=resource_group.name, + resource_name="str", + network_security_perimeter_configuration_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_network_security_perimeter_configurations_list(self, resource_group): + response = self.client.network_security_perimeter_configurations.list( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_network_security_perimeter_configurations_begin_reconcile(self, resource_group): + response = await ( + await self.client.network_security_perimeter_configurations.begin_reconcile( + resource_group_name=resource_group.name, + resource_name="str", + network_security_perimeter_configuration_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operation_results_operation_group_operations.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operation_results_operation_group_operations.py new file mode 100644 index 000000000000..3c2b47ac4ca7 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operation_results_operation_group_operations.py @@ -0,0 +1,29 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceOperationResultsOperationGroupOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operation_results_operation_group_begin_get(self, resource_group): + response = self.client.operation_results_operation_group.begin_get( + operation_result_id="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operation_results_operation_group_operations_async.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operation_results_operation_group_operations_async.py new file mode 100644 index 000000000000..89415643e4b1 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operation_results_operation_group_operations_async.py @@ -0,0 +1,32 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice.aio import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceOperationResultsOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operation_results_operation_group_begin_get(self, resource_group): + response = await ( + await self.client.operation_results_operation_group.begin_get( + operation_result_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operations.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operations.py new file mode 100644 index 000000000000..75bb273af658 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operations.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operations_async.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operations_async.py new file mode 100644 index 000000000000..7a525c6182e2 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_operations_async.py @@ -0,0 +1,28 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice.aio import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_private_endpoint_connections_operations.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..622fd7126957 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_private_endpoint_connections_operations.py @@ -0,0 +1,89 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServicePrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_get(self, resource_group): + response = self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + resource_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_create(self, resource_group): + response = self.client.private_endpoint_connections.create( + resource_group_name=resource_group.name, + resource_name="str", + private_endpoint_connection_name="str", + properties={ + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_delete(self, resource_group): + response = self.client.private_endpoint_connections.delete( + resource_group_name=resource_group.name, + resource_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_list(self, resource_group): + response = self.client.private_endpoint_connections.list( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_private_endpoint_connections_operations_async.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_private_endpoint_connections_operations_async.py new file mode 100644 index 000000000000..8ebe5797929c --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_private_endpoint_connections_operations_async.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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice.aio import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServicePrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_get(self, resource_group): + response = await self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + resource_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_create(self, resource_group): + response = await self.client.private_endpoint_connections.create( + resource_group_name=resource_group.name, + resource_name="str", + private_endpoint_connection_name="str", + properties={ + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_delete(self, resource_group): + response = await self.client.private_endpoint_connections.delete( + resource_group_name=resource_group.name, + resource_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_list(self, resource_group): + response = self.client.private_endpoint_connections.list( + resource_group_name=resource_group.name, + resource_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_qn_amaker_endpoint_keys_operation_group_operations.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_qn_amaker_endpoint_keys_operation_group_operations.py new file mode 100644 index 000000000000..0757779dd681 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_qn_amaker_endpoint_keys_operation_group_operations.py @@ -0,0 +1,29 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceQnAMakerEndpointKeysOperationGroupOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_qn_amaker_endpoint_keys_operation_group_get(self, resource_group): + response = self.client.qn_amaker_endpoint_keys_operation_group.get( + parameters={"authkey": "str", "hostname": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_qn_amaker_endpoint_keys_operation_group_operations_async.py b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_qn_amaker_endpoint_keys_operation_group_operations_async.py new file mode 100644 index 000000000000..ba24cd40127c --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/generated_tests/test_bot_service_qn_amaker_endpoint_keys_operation_group_operations_async.py @@ -0,0 +1,30 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.botservice.aio import BotServiceClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestBotServiceQnAMakerEndpointKeysOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(BotServiceClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_qn_amaker_endpoint_keys_operation_group_get(self, resource_group): + response = await self.client.qn_amaker_endpoint_keys_operation_group.get( + parameters={"authkey": "str", "hostname": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/botservice/azure-mgmt-botservice/setup.py b/sdk/botservice/azure-mgmt-botservice/setup.py index 553174f56e4e..6054c02a3412 100644 --- a/sdk/botservice/azure-mgmt-botservice/setup.py +++ b/sdk/botservice/azure-mgmt-botservice/setup.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import re import os.path @@ -16,64 +16,67 @@ PACKAGE_PPRINT_NAME = "Bot Service" # a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace('-', '/') +package_folder_path = PACKAGE_NAME.replace("-", "/") # a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace('-', '.') +namespace_name = PACKAGE_NAME.replace("-", ".") # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py') - if os.path.exists(os.path.join(package_folder_path, 'version.py')) - else os.path.join(package_folder_path, '_version.py'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', - fd.read(), re.MULTILINE).group(1) +with open( + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), + "r", +) as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) if not version: - raise RuntimeError('Cannot find version information') + raise RuntimeError("Cannot find version information") -with open('README.md', encoding='utf-8') as f: +with open("README.md", encoding="utf-8") as f: readme = f.read() -with open('CHANGELOG.md', encoding='utf-8') as f: +with open("CHANGELOG.md", encoding="utf-8") as f: changelog = f.read() setup( name=PACKAGE_NAME, version=version, - description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), - long_description=readme + '\n\n' + changelog, - long_description_content_type='text/markdown', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/Azure/azure-sdk-for-python', + description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - 'Development Status :: 4 - Beta', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'License :: OSI Approved :: MIT License', + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: MIT License", ], zip_safe=False, - packages=find_packages(exclude=[ - 'tests', - # Exclude packages that will be covered by PEP420 or nspkg - 'azure', - 'azure.mgmt', - ]), + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.mgmt", + ] + ), include_package_data=True, package_data={ - 'pytyped': ['py.typed'], + "pytyped": ["py.typed"], }, install_requires=[ - "msrest>=0.7.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "typing-extensions>=4.6.0", + "azure-common>=1.1", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.7" + python_requires=">=3.9", ) diff --git a/sdk/botservice/azure-mgmt-botservice/tests/disable_test_mgmt_botservice_channels.py b/sdk/botservice/azure-mgmt-botservice/tests/disable_test_mgmt_botservice_channels.py index e1c105f0f197..52a0c4478c3c 100644 --- a/sdk/botservice/azure-mgmt-botservice/tests/disable_test_mgmt_botservice_channels.py +++ b/sdk/botservice/azure-mgmt-botservice/tests/disable_test_mgmt_botservice_channels.py @@ -2,81 +2,69 @@ from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer from azure.mgmt.botservice import AzureBotService -from azure.mgmt.botservice.models import ( - Bot, - BotProperties, - BotChannel, - Sku -) +from azure.mgmt.botservice.models import Bot, BotProperties, BotChannel, Sku + class BotServiceChannelsTestCase(AzureMgmtTestCase): def setUp(self): super(BotServiceChannelsTestCase, self).setUp() - #create a bot here + # create a bot here self.client = self.create_mgmt_client(AzureBotService) - self.resource_name = self.get_resource_name('azurebotservice') - + self.resource_name = self.get_resource_name("azurebotservice") + def createBot(self): - location = 'global' - sku_name = 'Free' - kind= 'Bot' + location = "global" + sku_name = "Free" + kind = "Bot" display_name = "this is a test bot" - description= "this is a description for a test bot" + description = "this is a description for a test bot" endpoint = "https://bing.com/messages/" msa_app_id = "" - developer_app_insight_key = '' - developer_app_insights_api_key = '' - developer_app_insights_application_id = '' + developer_app_insight_key = "" + developer_app_insights_api_key = "" + developer_app_insights_application_id = "" bot = self.client.bots.create( - resource_group_name = self.resource_group_name, - resource_name = self.resource_name, - parameters = Bot( - location= location, - sku = sku.Sku(name=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, - ) - ) + resource_group_name=self.resource_group_name, + resource_name=self.resource_name, + parameters=Bot( + location=location, + sku=sku.Sku(name=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 - ) + self.client.bots.delete(resource_group_name=self.resource_group_name, resource_name=self.resource_name) def validateCreateGetAndDeleteChannel(self, channel_name, channel_properties, run_exist_check=True, validate=None): self.createBot() - botChannel = BotChannel( - location = 'global', - properties = channel_properties - ) + 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 + 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 + 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': + # 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) @@ -85,142 +73,116 @@ def validateCreateGetAndDeleteChannel(self, channel_name, channel_properties, ru validate( resource_group_name=self.resource_group_name, resource_name=self.resource_name, - assertIsNotNone=self.assertIsNotNone + assertIsNotNone=self.assertIsNotNone, ) channel = self.client.channels.delete( - resource_group_name = self.resource_group_name, - resource_name = self.resource_name, - channel_name = channel_name + resource_group_name=self.resource_group_name, resource_name=self.resource_name, channel_name=channel_name ) if run_exist_check: 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 + resource_group_name=self.resource_group_name, + resource_name=self.resource_name, + channel_name=channel_name, ) @unittest.skip("skip") - @ResourceGroupPreparer(name_prefix='pythonsdkbot') + @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 = '', - is_enabled = True - ) - ) + from azure.mgmt.botservice.models import EmailChannel, EmailChannelProperties - self.validateCreateGetAndDeleteChannel( - channel_name = 'EmailChannel', - channel_properties = channel + channel = EmailChannel( + properties=EmailChannelProperties(email_address="swagatm2@outlook.com", password="", is_enabled=True) ) + self.validateCreateGetAndDeleteChannel(channel_name="EmailChannel", channel_properties=channel) @unittest.skip("skip") - @ResourceGroupPreparer(name_prefix='pythonsdkbot') + @ResourceGroupPreparer(name_prefix="pythonsdkbot") def test_telegram_channel(self, resource_group): - from azure.mgmt.botservice.models import TelegramChannel,TelegramChannelProperties + from azure.mgmt.botservice.models import TelegramChannel, TelegramChannelProperties + self.resource_group_name = resource_group.name channel = TelegramChannel( - properties = TelegramChannelProperties( - access_token = '', - is_enabled = True, + properties=TelegramChannelProperties( + access_token="", + is_enabled=True, ) ) - self.validateCreateGetAndDeleteChannel( - channel_name = 'TelegramChannel', - channel_properties = channel - ) + self.validateCreateGetAndDeleteChannel(channel_name="TelegramChannel", channel_properties=channel) @unittest.skip("skip") - @ResourceGroupPreparer(name_prefix='pythonsdkbot') + @ResourceGroupPreparer(name_prefix="pythonsdkbot") def test_sms_channel(self, resource_group): - from azure.mgmt.botservice.models import SmsChannel,SmsChannelProperties + from azure.mgmt.botservice.models import SmsChannel, SmsChannelProperties + self.resource_group_name = resource_group.name channel = SmsChannel( - properties = SmsChannelProperties( - phone = '+15153258725', - account_sid = '', - auth_token = '', - is_enabled = True, - is_validated = False + properties=SmsChannelProperties( + phone="+15153258725", account_sid="", auth_token="", is_enabled=True, is_validated=False ) ) - - self.validateCreateGetAndDeleteChannel( - channel_name = 'SmsChannel', - channel_properties = channel - ) + + self.validateCreateGetAndDeleteChannel(channel_name="SmsChannel", channel_properties=channel) @unittest.skip("skip") - @ResourceGroupPreparer(name_prefix='pythonsdkbot') + @ResourceGroupPreparer(name_prefix="pythonsdkbot") def test_msteams_channel(self, resource_group): - from azure.mgmt.botservice.models import MsTeamsChannel,MsTeamsChannelProperties + from azure.mgmt.botservice.models import MsTeamsChannel, MsTeamsChannelProperties + self.resource_group_name = resource_group.name channel = MsTeamsChannel( - properties = MsTeamsChannelProperties( - is_enabled = True, + properties=MsTeamsChannelProperties( + is_enabled=True, ) ) - + self.validateCreateGetAndDeleteChannel( - channel_name = 'MsTeamsChannel', - channel_properties = channel, - run_exist_check=False + channel_name="MsTeamsChannel", channel_properties=channel, run_exist_check=False ) - + @unittest.skip("skip") - @ResourceGroupPreparer(name_prefix='pythonsdkbot') + @ResourceGroupPreparer(name_prefix="pythonsdkbot") def test_skype_channel(self, resource_group): - from azure.mgmt.botservice.models import SkypeChannel,SkypeChannelProperties + 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, + properties=SkypeChannelProperties( + is_enabled=True, + enable_messaging=True, ) ) self.validateCreateGetAndDeleteChannel( - channel_name = 'SkypeChannel', - channel_properties = channel, - run_exist_check=False + channel_name="SkypeChannel", channel_properties=channel, run_exist_check=False ) - @unittest.skip("skip") - @ResourceGroupPreparer(name_prefix='pythonsdkbot') + @ResourceGroupPreparer(name_prefix="pythonsdkbot") def test_directline_channel(self, resource_group): # also test secrets api def validate_directline(resource_group_name, resource_name, assertIsNotNone): settings = self.client.channels.list_with_keys( resource_group_name=resource_group_name, resource_name=resource_name, - channel_name='DirectLineChannel', + channel_name="DirectLineChannel", ) assertIsNotNone(settings) assertIsNotNone(settings.properties.properties.sites[0].key) + from azure.mgmt.botservice.models import DirectLineChannel, DirectLineChannelProperties, DirectLineSite - from azure.mgmt.botservice.models import DirectLineChannel,DirectLineChannelProperties,DirectLineSite self.resource_group_name = resource_group.name channel = DirectLineChannel( properties=DirectLineChannelProperties( - sites=[DirectLineSite( - site_name='default', - is_enabled=True, - is_v1_enabled=False, - is_v3_enabled=True)] + sites=[DirectLineSite(site_name="default", is_enabled=True, is_v1_enabled=False, is_v3_enabled=True)] ) ) self.validateCreateGetAndDeleteChannel( - channel_name = 'DirectLineChannel', - channel_properties = channel, - validate=validate_directline - ) \ No newline at end of file + channel_name="DirectLineChannel", channel_properties=channel, validate=validate_directline + ) diff --git a/sdk/botservice/azure-mgmt-botservice/tests/disable_test_mgmt_botservice_connections.py b/sdk/botservice/azure-mgmt-botservice/tests/disable_test_mgmt_botservice_connections.py index 22a64d97857e..75dc857f1836 100644 --- a/sdk/botservice/azure-mgmt-botservice/tests/disable_test_mgmt_botservice_connections.py +++ b/sdk/botservice/azure-mgmt-botservice/tests/disable_test_mgmt_botservice_connections.py @@ -2,91 +2,91 @@ from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer from azure.mgmt.botservice import AzureBotService -from azure.mgmt.botservice.models import ( - Bot, - BotProperties, - Sku -) +from azure.mgmt.botservice.models import Bot, BotProperties, Sku + class BotServiceConnectionsTestCase(AzureMgmtTestCase): def setUp(self): super(BotServiceConnectionsTestCase, self).setUp() - #create a bot here + # create a bot here self.client = self.create_mgmt_client(AzureBotService) - self.resource_name = self.get_resource_name('azurebot') - + self.resource_name = self.get_resource_name("azurebot") + def createBot(self): - location = 'global' - sku_name = 'Free' - kind= 'Bot' + location = "global" + sku_name = "Free" + kind = "Bot" display_name = "this is a test bot" - description= "this is a description for a test bot" + description = "this is a description for a test bot" endpoint = "https://bing.com/messages/" msa_app_id = "" - developer_app_insight_key = '' - developer_app_insights_api_key = '' - developer_app_insights_application_id = '' + developer_app_insight_key = "" + developer_app_insights_api_key = "" + developer_app_insights_application_id = "" bot = self.client.bots.create( - resource_group_name = self.resource_group_name, - resource_name = self.resource_name, - parameters = Bot( - location= location, - sku = sku.Sku(name=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, - ) - ) + resource_group_name=self.resource_group_name, + resource_name=self.resource_name, + parameters=Bot( + location=location, + sku=sku.Sku(name=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(BotServiceConnectionsTestCase, self).tearDown() - @unittest.skip("skip") - @ResourceGroupPreparer(name_prefix='python_conn') + @ResourceGroupPreparer(name_prefix="python_conn") def test_bot_connection_operations(self, resource_group): self.resource_group_name = resource_group.name self.createBot() - from azure.mgmt.botservice.models import ConnectionSetting, ConnectionSettingProperties, ConnectionSettingParameter - connection_resource_name = self.get_resource_name('myconnection') + from azure.mgmt.botservice.models import ( + ConnectionSetting, + ConnectionSettingProperties, + ConnectionSettingParameter, + ) + + connection_resource_name = self.get_resource_name("myconnection") # create a connection setting_payload = ConnectionSetting( - location='global', + location="global", properties=ConnectionSettingProperties( - client_id='clientId', - client_secret='clientSecret', - scopes='read,write', - service_provider_id='', - parameters=[ConnectionSettingParameter(key='key1', value='value1')] - ) + client_id="clientId", + client_secret="clientSecret", + scopes="read,write", + service_provider_id="", + parameters=[ConnectionSettingParameter(key="key1", value="value1")], + ), ) setting = self.client.bot_connection.create( resource_group_name=resource_group.name, resource_name=self.resource_name, connection_name=connection_resource_name, - parameters=setting_payload + parameters=setting_payload, ) self.assertIsNotNone(setting) - self.assertEqual(setting.properties.client_id, 'clientId') + self.assertEqual(setting.properties.client_id, "clientId") # get a connection setting = self.client.bot_connection.get( resource_group_name=resource_group.name, resource_name=self.resource_name, - connection_name=connection_resource_name + connection_name=connection_resource_name, ) self.assertIsNotNone(setting) - #list all connections + # list all connections settings = self.client.bot_connection.list_by_bot_service( - resource_group_name = resource_group.name, - resource_name=self.resource_name + resource_group_name=resource_group.name, resource_name=self.resource_name ) self.assertIsNotNone(setting) self.assertTrue(len(list(settings)) == 1) @@ -95,16 +95,15 @@ def test_bot_connection_operations(self, resource_group): setting = self.client.bot_connection.delete( resource_group_name=resource_group.name, resource_name=self.resource_name, - connection_name=connection_resource_name + connection_name=connection_resource_name, ) with self.assertRaises(ErrorException): setting = self.client.bot_connection.get( resource_group_name=resource_group.name, resource_name=self.resource_name, - connection_name=connection_resource_name + connection_name=connection_resource_name, ) - @unittest.skip("skip") def test_bot_connection_serviceproviders(self): service_provider_responses = self.client.bot_connection.list_service_providers() diff --git a/sdk/botservice/azure-mgmt-botservice/tests/disable_test_mgmt_botservice_crud.py b/sdk/botservice/azure-mgmt-botservice/tests/disable_test_mgmt_botservice_crud.py index 1f4f9d12aea2..2701ecc3896a 100644 --- a/sdk/botservice/azure-mgmt-botservice/tests/disable_test_mgmt_botservice_crud.py +++ b/sdk/botservice/azure-mgmt-botservice/tests/disable_test_mgmt_botservice_crud.py @@ -8,24 +8,30 @@ Sku, ) + 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.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.description = "this is a description for a test bot" self.endpoint = "https://bing.com/messages/" self.msa_app_id = "" - self.developer_app_insight_key = '' - self.developer_app_insights_api_key = '' - self.developer_app_insights_application_id = '' + self.developer_app_insight_key = "" + self.developer_app_insights_api_key = "" + self.developer_app_insights_application_id = "" 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.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) @@ -35,55 +41,54 @@ def validate_bot_properties(self, bot): 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) + 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 + ) @unittest.skip("skip") - @ResourceGroupPreparer(name_prefix='python_test_bot') + @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(name=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, - ) - ) + resource_group_name=self.resource_group_name, + resource_name=self.resource_name, + parameters=Bot( + location=self.location, + sku=sku.Sku(name=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, + resource_group_name=self.resource_group_name, + resource_name=self.resource_name, ) self.validate_bot_properties(bot) - bot.properties.description = 'this is another description' + 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 + 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, + resource_group_name=self.resource_group_name, + resource_name=self.resource_name, ) - #ensure that the bot was not found with a get + # 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 - ) + bot = self.client.bots.get(resource_group_name=self.resource_group_name, resource_name=self.resource_name) diff --git a/sdk/botservice/azure-mgmt-botservice/tests/test_mgmt_botservice_model.py b/sdk/botservice/azure-mgmt-botservice/tests/test_mgmt_botservice_model.py index c64eba8e0e65..10e8e61c82de 100644 --- a/sdk/botservice/azure-mgmt-botservice/tests/test_mgmt_botservice_model.py +++ b/sdk/botservice/azure-mgmt-botservice/tests/test_mgmt_botservice_model.py @@ -20,5 +20,5 @@ def test_model_site(self): site_name="xxx", is_enabled=True, is_webchat_preview_enabled=True, - is_secure_site_enabled=True + is_secure_site_enabled=True, ) diff --git a/sdk/botservice/azure-mgmt-botservice/tsp-location.yaml b/sdk/botservice/azure-mgmt-botservice/tsp-location.yaml new file mode 100644 index 000000000000..a6937a17c515 --- /dev/null +++ b/sdk/botservice/azure-mgmt-botservice/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/botservice/BotService.Management +commit: 7be0444544b6bdd1aad8f9103f7620602aec7a1c +repo: Azure/azure-rest-api-specs +additionalDirectories: