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