7
7
# --------------------------------------------------------------------------
8
8
9
9
from copy import deepcopy
10
- from typing import Any , TYPE_CHECKING
10
+ from typing import Any , Optional , TYPE_CHECKING , cast
11
11
from typing_extensions import Self
12
12
13
13
from azure .core .pipeline import policies
14
14
from azure .core .rest import HttpRequest , HttpResponse
15
+ from azure .core .settings import settings
15
16
from azure .mgmt .core import ARMPipelineClient
16
17
from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18
+ from azure .mgmt .core .tools import get_arm_endpoints
17
19
18
20
from . import models as _models
19
21
from ._configuration import CognitiveServicesManagementClientConfiguration
20
- from ._serialization import Deserializer , Serializer
22
+ from ._utils . serialization import Deserializer , Serializer
21
23
from .operations import (
24
+ AccountCapabilityHostsOperations ,
25
+ AccountConnectionsOperations ,
22
26
AccountsOperations ,
23
27
CognitiveServicesManagementClientOperationsMixin ,
24
28
CommitmentPlansOperations ,
34
38
Operations ,
35
39
PrivateEndpointConnectionsOperations ,
36
40
PrivateLinkResourcesOperations ,
41
+ ProjectCapabilityHostsOperations ,
42
+ ProjectConnectionsOperations ,
43
+ ProjectsOperations ,
37
44
RaiBlocklistItemsOperations ,
38
45
RaiBlocklistsOperations ,
39
46
RaiContentFiltersOperations ,
43
50
)
44
51
45
52
if TYPE_CHECKING :
46
- # pylint: disable=unused-import,ungrouped-imports
47
53
from azure .core .credentials import TokenCredential
48
54
49
55
50
56
class CognitiveServicesManagementClient (
51
57
CognitiveServicesManagementClientOperationsMixin
52
- ): # pylint: disable=client-accepts-api-version-keyword, too-many-instance-attributes
58
+ ): # pylint: disable=too-many-instance-attributes
53
59
"""Cognitive Services Management Client.
54
60
55
61
:ivar accounts: AccountsOperations operations
@@ -100,29 +106,45 @@ class CognitiveServicesManagementClient(
100
106
:ivar defender_for_ai_settings: DefenderForAISettingsOperations operations
101
107
:vartype defender_for_ai_settings:
102
108
azure.mgmt.cognitiveservices.operations.DefenderForAISettingsOperations
109
+ :ivar projects: ProjectsOperations operations
110
+ :vartype projects: azure.mgmt.cognitiveservices.operations.ProjectsOperations
111
+ :ivar account_connections: AccountConnectionsOperations operations
112
+ :vartype account_connections:
113
+ azure.mgmt.cognitiveservices.operations.AccountConnectionsOperations
114
+ :ivar project_connections: ProjectConnectionsOperations operations
115
+ :vartype project_connections:
116
+ azure.mgmt.cognitiveservices.operations.ProjectConnectionsOperations
117
+ :ivar account_capability_hosts: AccountCapabilityHostsOperations operations
118
+ :vartype account_capability_hosts:
119
+ azure.mgmt.cognitiveservices.operations.AccountCapabilityHostsOperations
120
+ :ivar project_capability_hosts: ProjectCapabilityHostsOperations operations
121
+ :vartype project_capability_hosts:
122
+ azure.mgmt.cognitiveservices.operations.ProjectCapabilityHostsOperations
103
123
:param credential: Credential needed for the client to connect to Azure. Required.
104
124
:type credential: ~azure.core.credentials.TokenCredential
105
- :param subscription_id: The ID of the target subscription. Required.
125
+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
106
126
:type subscription_id: str
107
- :param base_url: Service URL. Default value is "https://management.azure.com" .
127
+ :param base_url: Service URL. Default value is None .
108
128
:type base_url: str
109
- :keyword api_version: Api Version. Default value is "2024-10 -01". Note that overriding this
129
+ :keyword api_version: Api Version. Default value is "2025-06 -01". Note that overriding this
110
130
default value may result in unsupported behavior.
111
131
:paramtype api_version: str
112
132
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
113
133
Retry-After header is present.
114
134
"""
115
135
116
136
def __init__ (
117
- self ,
118
- credential : "TokenCredential" ,
119
- subscription_id : str ,
120
- base_url : str = "https://management.azure.com" ,
121
- ** kwargs : Any
137
+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
122
138
) -> None :
139
+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
140
+ _endpoints = get_arm_endpoints (_cloud )
141
+ if not base_url :
142
+ base_url = _endpoints ["resource_manager" ]
143
+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
123
144
self ._config = CognitiveServicesManagementClientConfiguration (
124
- credential = credential , subscription_id = subscription_id , ** kwargs
145
+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
125
146
)
147
+
126
148
_policies = kwargs .pop ("policies" , None )
127
149
if _policies is None :
128
150
_policies = [
@@ -141,7 +163,7 @@ def __init__(
141
163
policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
142
164
self ._config .http_logging_policy ,
143
165
]
144
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
166
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
145
167
146
168
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
147
169
self ._serialize = Serializer (client_models )
@@ -191,6 +213,19 @@ def __init__(
191
213
self .defender_for_ai_settings = DefenderForAISettingsOperations (
192
214
self ._client , self ._config , self ._serialize , self ._deserialize
193
215
)
216
+ self .projects = ProjectsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
217
+ self .account_connections = AccountConnectionsOperations (
218
+ self ._client , self ._config , self ._serialize , self ._deserialize
219
+ )
220
+ self .project_connections = ProjectConnectionsOperations (
221
+ self ._client , self ._config , self ._serialize , self ._deserialize
222
+ )
223
+ self .account_capability_hosts = AccountCapabilityHostsOperations (
224
+ self ._client , self ._config , self ._serialize , self ._deserialize
225
+ )
226
+ self .project_capability_hosts = ProjectCapabilityHostsOperations (
227
+ self ._client , self ._config , self ._serialize , self ._deserialize
228
+ )
194
229
195
230
def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
196
231
"""Runs the network request through the client's chained policies.
0 commit comments