77# --------------------------------------------------------------------------
88
99from copy import deepcopy
10- from typing import Any , TYPE_CHECKING
10+ from typing import Any , Optional , TYPE_CHECKING , cast
1111from typing_extensions import Self
1212
1313from azure .core .pipeline import policies
1414from azure .core .rest import HttpRequest , HttpResponse
15+ from azure .core .settings import settings
1516from azure .mgmt .core import ARMPipelineClient
1617from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18+ from azure .mgmt .core .tools import get_arm_endpoints
1719
1820from . import models as _models
1921from ._configuration import CognitiveServicesManagementClientConfiguration
20- from ._serialization import Deserializer , Serializer
22+ from ._utils . serialization import Deserializer , Serializer
2123from .operations import (
24+ AccountCapabilityHostsOperations ,
25+ AccountConnectionOperations ,
2226 AccountsOperations ,
2327 CognitiveServicesManagementClientOperationsMixin ,
2428 CommitmentPlansOperations ,
3438 Operations ,
3539 PrivateEndpointConnectionsOperations ,
3640 PrivateLinkResourcesOperations ,
41+ ProjectCapabilityHostsOperations ,
42+ ProjectConnectionOperations ,
43+ ProjectsOperations ,
3744 RaiBlocklistItemsOperations ,
3845 RaiBlocklistsOperations ,
3946 RaiContentFiltersOperations ,
4350)
4451
4552if TYPE_CHECKING :
46- # pylint: disable=unused-import,ungrouped-imports
4753 from azure .core .credentials import TokenCredential
4854
4955
5056class CognitiveServicesManagementClient (
5157 CognitiveServicesManagementClientOperationsMixin
52- ): # pylint: disable=client-accepts-api-version-keyword, too-many-instance-attributes
58+ ): # pylint: disable=too-many-instance-attributes
5359 """Cognitive Services Management Client.
5460
5561 :ivar accounts: AccountsOperations operations
@@ -100,29 +106,45 @@ class CognitiveServicesManagementClient(
100106 :ivar defender_for_ai_settings: DefenderForAISettingsOperations operations
101107 :vartype defender_for_ai_settings:
102108 azure.mgmt.cognitiveservices.operations.DefenderForAISettingsOperations
109+ :ivar projects: ProjectsOperations operations
110+ :vartype projects: azure.mgmt.cognitiveservices.operations.ProjectsOperations
111+ :ivar account_connection: AccountConnectionOperations operations
112+ :vartype account_connection:
113+ azure.mgmt.cognitiveservices.operations.AccountConnectionOperations
114+ :ivar project_connection: ProjectConnectionOperations operations
115+ :vartype project_connection:
116+ azure.mgmt.cognitiveservices.operations.ProjectConnectionOperations
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
103123 :param credential: Credential needed for the client to connect to Azure. Required.
104124 :type credential: ~azure.core.credentials.TokenCredential
105125 :param subscription_id: The ID of the target subscription. Required.
106126 :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 .
108128 :type base_url: str
109- :keyword api_version: Api Version. Default value is "2024-10 -01". Note that overriding this
110- default value may result in unsupported behavior.
129+ :keyword api_version: Api Version. Default value is "2025-04 -01-preview ". Note that overriding
130+ this default value may result in unsupported behavior.
111131 :paramtype api_version: str
112132 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
113133 Retry-After header is present.
114134 """
115135
116136 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
122138 ) -> 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" ])
123144 self ._config = CognitiveServicesManagementClientConfiguration (
124- credential = credential , subscription_id = subscription_id , ** kwargs
145+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
125146 )
147+
126148 _policies = kwargs .pop ("policies" , None )
127149 if _policies is None :
128150 _policies = [
@@ -141,7 +163,7 @@ def __init__(
141163 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
142164 self ._config .http_logging_policy ,
143165 ]
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 )
145167
146168 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
147169 self ._serialize = Serializer (client_models )
@@ -191,6 +213,19 @@ def __init__(
191213 self .defender_for_ai_settings = DefenderForAISettingsOperations (
192214 self ._client , self ._config , self ._serialize , self ._deserialize
193215 )
216+ self .projects = ProjectsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
217+ self .account_connection = AccountConnectionOperations (
218+ self ._client , self ._config , self ._serialize , self ._deserialize
219+ )
220+ self .project_connection = ProjectConnectionOperations (
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+ )
194229
195230 def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
196231 """Runs the network request through the client's chained policies.
0 commit comments