6
6
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
# --------------------------------------------------------------------------
8
8
9
- from typing import TYPE_CHECKING
9
+ from copy import deepcopy
10
+ from typing import Any , Optional , TYPE_CHECKING
10
11
12
+ from azure .core .rest import HttpRequest , HttpResponse
11
13
from azure .mgmt .core import ARMPipelineClient
12
14
from msrest import Deserializer , Serializer
13
15
16
+ from . import models
17
+ from ._configuration import AzureBotServiceConfiguration
18
+ from .operations import BotConnectionOperations , BotsOperations , ChannelsOperations , DirectLineOperations , HostSettingsOperations , OperationResultsOperations , Operations , PrivateEndpointConnectionsOperations , PrivateLinkResourcesOperations
19
+
14
20
if TYPE_CHECKING :
15
21
# pylint: disable=unused-import,ungrouped-imports
16
- from typing import Any , Optional
17
-
18
22
from azure .core .credentials import TokenCredential
19
- from azure .core .pipeline .transport import HttpRequest , HttpResponse
20
-
21
- from ._configuration import AzureBotServiceConfiguration
22
- from .operations import BotsOperations
23
- from .operations import ChannelsOperations
24
- from .operations import DirectLineOperations
25
- from .operations import Operations
26
- from .operations import BotConnectionOperations
27
- from .operations import HostSettingsOperations
28
- from . import models
29
-
30
23
31
- class AzureBotService ( object ) :
24
+ class AzureBotService :
32
25
"""Azure Bot Service is a platform for creating smart conversational agents.
33
26
34
27
:ivar bots: BotsOperations operations
@@ -43,61 +36,74 @@ class AzureBotService(object):
43
36
:vartype bot_connection: azure.mgmt.botservice.operations.BotConnectionOperations
44
37
:ivar host_settings: HostSettingsOperations operations
45
38
:vartype host_settings: azure.mgmt.botservice.operations.HostSettingsOperations
39
+ :ivar operation_results: OperationResultsOperations operations
40
+ :vartype operation_results: azure.mgmt.botservice.operations.OperationResultsOperations
41
+ :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
42
+ :vartype private_endpoint_connections:
43
+ azure.mgmt.botservice.operations.PrivateEndpointConnectionsOperations
44
+ :ivar private_link_resources: PrivateLinkResourcesOperations operations
45
+ :vartype private_link_resources:
46
+ azure.mgmt.botservice.operations.PrivateLinkResourcesOperations
46
47
:param credential: Credential needed for the client to connect to Azure.
47
48
:type credential: ~azure.core.credentials.TokenCredential
48
49
:param subscription_id: Azure Subscription ID.
49
50
:type subscription_id: str
50
- :param str base_url: Service URL
51
+ :param base_url: Service URL. Default value is 'https://management.azure.com'.
52
+ :type base_url: str
53
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
54
+ Retry-After header is present.
51
55
"""
52
56
53
57
def __init__ (
54
58
self ,
55
- credential , # type: "TokenCredential"
56
- subscription_id , # type: str
57
- base_url = None , # type: Optional[str]
58
- ** kwargs # type: Any
59
- ):
60
- # type: (...) -> None
61
- if not base_url :
62
- base_url = 'https://management.azure.com'
63
- self ._config = AzureBotServiceConfiguration (credential , subscription_id , ** kwargs )
59
+ credential : "TokenCredential" ,
60
+ subscription_id : str ,
61
+ base_url : str = "https://management.azure.com" ,
62
+ ** kwargs : Any
63
+ ) -> None :
64
+ self ._config = AzureBotServiceConfiguration (credential = credential , subscription_id = subscription_id , ** kwargs )
64
65
self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
65
66
66
67
client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
67
68
self ._serialize = Serializer (client_models )
68
- self ._serialize .client_side_validation = False
69
69
self ._deserialize = Deserializer (client_models )
70
-
71
- self .bots = BotsOperations (
72
- self ._client , self ._config , self ._serialize , self ._deserialize )
73
- self .channels = ChannelsOperations (
74
- self ._client , self ._config , self ._serialize , self ._deserialize )
75
- self .direct_line = DirectLineOperations (
76
- self ._client , self ._config , self ._serialize , self ._deserialize )
77
- self .operations = Operations (
78
- self ._client , self ._config , self ._serialize , self ._deserialize )
79
- self .bot_connection = BotConnectionOperations (
80
- self ._client , self ._config , self ._serialize , self ._deserialize )
81
- self .host_settings = HostSettingsOperations (
82
- self ._client , self ._config , self ._serialize , self ._deserialize )
83
-
84
- def _send_request (self , http_request , ** kwargs ):
85
- # type: (HttpRequest, Any) -> HttpResponse
70
+ self ._serialize .client_side_validation = False
71
+ self .bots = BotsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
72
+ self .channels = ChannelsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
73
+ self .direct_line = DirectLineOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
74
+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
75
+ self .bot_connection = BotConnectionOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
76
+ self .host_settings = HostSettingsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
77
+ self .operation_results = OperationResultsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
78
+ self .private_endpoint_connections = PrivateEndpointConnectionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
79
+ self .private_link_resources = PrivateLinkResourcesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
80
+
81
+
82
+ def _send_request (
83
+ self ,
84
+ request , # type: HttpRequest
85
+ ** kwargs : Any
86
+ ) -> HttpResponse :
86
87
"""Runs the network request through the client's chained policies.
87
88
88
- :param http_request: The network request you want to make. Required.
89
- :type http_request: ~azure.core.pipeline.transport.HttpRequest
90
- :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
89
+ >>> from azure.core.rest import HttpRequest
90
+ >>> request = HttpRequest("GET", "https://www.example.org/")
91
+ <HttpRequest [GET], url: 'https://www.example.org/'>
92
+ >>> response = client._send_request(request)
93
+ <HttpResponse: 200 OK>
94
+
95
+ For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
96
+
97
+ :param request: The network request you want to make. Required.
98
+ :type request: ~azure.core.rest.HttpRequest
99
+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
91
100
:return: The response of your network call. Does not do error handling on your response.
92
- :rtype: ~azure.core.pipeline.transport .HttpResponse
101
+ :rtype: ~azure.core.rest .HttpResponse
93
102
"""
94
- path_format_arguments = {
95
- 'subscriptionId' : self ._serialize .url ("self._config.subscription_id" , self ._config .subscription_id , 'str' ),
96
- }
97
- http_request .url = self ._client .format_url (http_request .url , ** path_format_arguments )
98
- stream = kwargs .pop ("stream" , True )
99
- pipeline_response = self ._client ._pipeline .run (http_request , stream = stream , ** kwargs )
100
- return pipeline_response .http_response
103
+
104
+ request_copy = deepcopy (request )
105
+ request_copy .url = self ._client .format_url (request_copy .url )
106
+ return self ._client .send_request (request_copy , ** kwargs )
101
107
102
108
def close (self ):
103
109
# type: () -> None
0 commit comments