9
9
from copy import deepcopy
10
10
from typing import Any , TYPE_CHECKING
11
11
12
+ from azure .core .pipeline import policies
12
13
from azure .core .rest import HttpRequest , HttpResponse
13
14
from azure .mgmt .core import ARMPipelineClient
15
+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
14
16
15
17
from . import models as _models
16
18
from ._configuration import MaintenanceManagementClientConfiguration
26
28
MaintenanceConfigurationsOperations ,
27
29
Operations ,
28
30
PublicMaintenanceConfigurationsOperations ,
31
+ ScheduledEventOperations ,
29
32
UpdatesOperations ,
30
33
)
31
34
37
40
class MaintenanceManagementClient : # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
38
41
"""Azure Maintenance Management Client.
39
42
43
+ :ivar scheduled_event: ScheduledEventOperations operations
44
+ :vartype scheduled_event: azure.mgmt.maintenance.operations.ScheduledEventOperations
40
45
:ivar public_maintenance_configurations: PublicMaintenanceConfigurationsOperations operations
41
46
:vartype public_maintenance_configurations:
42
47
azure.mgmt.maintenance.operations.PublicMaintenanceConfigurationsOperations
@@ -73,12 +78,11 @@ class MaintenanceManagementClient: # pylint: disable=client-accepts-api-version
73
78
:vartype updates: azure.mgmt.maintenance.operations.UpdatesOperations
74
79
:param credential: Credential needed for the client to connect to Azure. Required.
75
80
:type credential: ~azure.core.credentials.TokenCredential
76
- :param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure
77
- subscription. The subscription ID forms part of the URI for every service call. Required.
81
+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
78
82
:type subscription_id: str
79
83
:param base_url: Service URL. Default value is "https://management.azure.com".
80
84
:type base_url: str
81
- :keyword api_version: Api Version. Default value is "2023-09 -01-preview". Note that overriding
85
+ :keyword api_version: Api Version. Default value is "2023-10 -01-preview". Note that overriding
82
86
this default value may result in unsupported behavior.
83
87
:paramtype api_version: str
84
88
"""
@@ -93,12 +97,31 @@ def __init__(
93
97
self ._config = MaintenanceManagementClientConfiguration (
94
98
credential = credential , subscription_id = subscription_id , ** kwargs
95
99
)
96
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
100
+ _policies = kwargs .pop ("policies" , None )
101
+ if _policies is None :
102
+ _policies = [
103
+ policies .RequestIdPolicy (** kwargs ),
104
+ self ._config .headers_policy ,
105
+ self ._config .user_agent_policy ,
106
+ self ._config .proxy_policy ,
107
+ policies .ContentDecodePolicy (** kwargs ),
108
+ ARMAutoResourceProviderRegistrationPolicy (),
109
+ self ._config .redirect_policy ,
110
+ self ._config .retry_policy ,
111
+ self ._config .authentication_policy ,
112
+ self ._config .custom_hook_policy ,
113
+ self ._config .logging_policy ,
114
+ policies .DistributedTracingPolicy (** kwargs ),
115
+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
116
+ self ._config .http_logging_policy ,
117
+ ]
118
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
97
119
98
120
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
99
121
self ._serialize = Serializer (client_models )
100
122
self ._deserialize = Deserializer (client_models )
101
123
self ._serialize .client_side_validation = False
124
+ self .scheduled_event = ScheduledEventOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
102
125
self .public_maintenance_configurations = PublicMaintenanceConfigurationsOperations (
103
126
self ._client , self ._config , self ._serialize , self ._deserialize
104
127
)
@@ -127,7 +150,7 @@ def __init__(
127
150
self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
128
151
self .updates = UpdatesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
129
152
130
- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
153
+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
131
154
"""Runs the network request through the client's chained policies.
132
155
133
156
>>> from azure.core.rest import HttpRequest
@@ -147,7 +170,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
147
170
148
171
request_copy = deepcopy (request )
149
172
request_copy .url = self ._client .format_url (request_copy .url )
150
- return self ._client .send_request (request_copy , ** kwargs )
173
+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
151
174
152
175
def close (self ) -> None :
153
176
self ._client .close ()
0 commit comments