88
99from copy import deepcopy
1010from typing import Any , TYPE_CHECKING
11+ from typing_extensions import Self
1112
13+ from azure .core .pipeline import policies
1214from azure .core .rest import HttpRequest , HttpResponse
1315from azure .mgmt .core import ARMPipelineClient
16+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
1417
1518from . import models as _models
1619from ._configuration import CommunicationServiceManagementClientConfiguration
2124 EmailServicesOperations ,
2225 Operations ,
2326 SenderUsernamesOperations ,
27+ SmtpUsernamesOperations ,
28+ SuppressionListAddressesOperations ,
29+ SuppressionListsOperations ,
2430)
2531
2632if TYPE_CHECKING :
27- # pylint: disable=unused-import,ungrouped-imports
2833 from azure .core .credentials import TokenCredential
2934
3035
31- class CommunicationServiceManagementClient : # pylint: disable=client-accepts-api-version-keyword
36+ class CommunicationServiceManagementClient : # pylint: disable=too-many-instance-attributes
3237 """REST API for Azure Communication Services.
3338
3439 :ivar operations: Operations operations
@@ -42,14 +47,21 @@ class CommunicationServiceManagementClient: # pylint: disable=client-accepts-ap
4247 :vartype email_services: azure.mgmt.communication.operations.EmailServicesOperations
4348 :ivar sender_usernames: SenderUsernamesOperations operations
4449 :vartype sender_usernames: azure.mgmt.communication.operations.SenderUsernamesOperations
50+ :ivar smtp_usernames: SmtpUsernamesOperations operations
51+ :vartype smtp_usernames: azure.mgmt.communication.operations.SmtpUsernamesOperations
52+ :ivar suppression_lists: SuppressionListsOperations operations
53+ :vartype suppression_lists: azure.mgmt.communication.operations.SuppressionListsOperations
54+ :ivar suppression_list_addresses: SuppressionListAddressesOperations operations
55+ :vartype suppression_list_addresses:
56+ azure.mgmt.communication.operations.SuppressionListAddressesOperations
4557 :param credential: Credential needed for the client to connect to Azure. Required.
4658 :type credential: ~azure.core.credentials.TokenCredential
4759 :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4860 :type subscription_id: str
4961 :param base_url: Service URL. Default value is "https://management.azure.com".
5062 :type base_url: str
51- :keyword api_version: Api Version. Default value is "2023-04 -01". Note that overriding this
52- default value may result in unsupported behavior.
63+ :keyword api_version: Api Version. Default value is "2024-09 -01-preview ". Note that overriding
64+ this default value may result in unsupported behavior.
5365 :paramtype api_version: str
5466 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
5567 Retry-After header is present.
@@ -65,7 +77,25 @@ def __init__(
6577 self ._config = CommunicationServiceManagementClientConfiguration (
6678 credential = credential , subscription_id = subscription_id , ** kwargs
6779 )
68- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
80+ _policies = kwargs .pop ("policies" , None )
81+ if _policies is None :
82+ _policies = [
83+ policies .RequestIdPolicy (** kwargs ),
84+ self ._config .headers_policy ,
85+ self ._config .user_agent_policy ,
86+ self ._config .proxy_policy ,
87+ policies .ContentDecodePolicy (** kwargs ),
88+ ARMAutoResourceProviderRegistrationPolicy (),
89+ self ._config .redirect_policy ,
90+ self ._config .retry_policy ,
91+ self ._config .authentication_policy ,
92+ self ._config .custom_hook_policy ,
93+ self ._config .logging_policy ,
94+ policies .DistributedTracingPolicy (** kwargs ),
95+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
96+ self ._config .http_logging_policy ,
97+ ]
98+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
6999
70100 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
71101 self ._serialize = Serializer (client_models )
@@ -80,8 +110,15 @@ def __init__(
80110 self .sender_usernames = SenderUsernamesOperations (
81111 self ._client , self ._config , self ._serialize , self ._deserialize
82112 )
113+ self .smtp_usernames = SmtpUsernamesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
114+ self .suppression_lists = SuppressionListsOperations (
115+ self ._client , self ._config , self ._serialize , self ._deserialize
116+ )
117+ self .suppression_list_addresses = SuppressionListAddressesOperations (
118+ self ._client , self ._config , self ._serialize , self ._deserialize
119+ )
83120
84- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
121+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
85122 """Runs the network request through the client's chained policies.
86123
87124 >>> from azure.core.rest import HttpRequest
@@ -101,12 +138,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
101138
102139 request_copy = deepcopy (request )
103140 request_copy .url = self ._client .format_url (request_copy .url )
104- return self ._client .send_request (request_copy , ** kwargs )
141+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
105142
106143 def close (self ) -> None :
107144 self ._client .close ()
108145
109- def __enter__ (self ) -> "CommunicationServiceManagementClient" :
146+ def __enter__ (self ) -> Self :
110147 self ._client .__enter__ ()
111148 return self
112149
0 commit comments