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 HDInsightManagementClientConfiguration
20
- from ._serialization import Deserializer , Serializer
22
+ from ._utils . serialization import Deserializer , Serializer
21
23
from .operations import (
22
24
ApplicationsOperations ,
23
25
ClustersOperations ,
33
35
)
34
36
35
37
if TYPE_CHECKING :
36
- # pylint: disable=unused-import,ungrouped-imports
37
38
from azure .core .credentials import TokenCredential
38
39
39
40
40
- class HDInsightManagementClient : # pylint: disable=client-accepts-api-version-keyword, too-many-instance-attributes
41
+ class HDInsightManagementClient : # pylint: disable=too-many-instance-attributes
41
42
"""HDInsight Management Client.
42
43
43
44
:ivar applications: ApplicationsOperations operations
@@ -69,25 +70,27 @@ class HDInsightManagementClient: # pylint: disable=client-accepts-api-version-k
69
70
:param subscription_id: The subscription credentials which uniquely identify Microsoft Azure
70
71
subscription. The subscription ID forms part of the URI for every service call. Required.
71
72
:type subscription_id: str
72
- :param base_url: Service URL. Default value is "https://management.azure.com" .
73
+ :param base_url: Service URL. Default value is None .
73
74
:type base_url: str
74
- :keyword api_version: Api Version. Default value is "2024-08-01 -preview". Note that overriding
75
+ :keyword api_version: Api Version. Default value is "2025-01-15 -preview". Note that overriding
75
76
this default value may result in unsupported behavior.
76
77
:paramtype api_version: str
77
78
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
78
79
Retry-After header is present.
79
80
"""
80
81
81
82
def __init__ (
82
- self ,
83
- credential : "TokenCredential" ,
84
- subscription_id : str ,
85
- base_url : str = "https://management.azure.com" ,
86
- ** kwargs : Any
83
+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
87
84
) -> None :
85
+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
86
+ _endpoints = get_arm_endpoints (_cloud )
87
+ if not base_url :
88
+ base_url = _endpoints ["resource_manager" ]
89
+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
88
90
self ._config = HDInsightManagementClientConfiguration (
89
- credential = credential , subscription_id = subscription_id , ** kwargs
91
+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
90
92
)
93
+
91
94
_policies = kwargs .pop ("policies" , None )
92
95
if _policies is None :
93
96
_policies = [
@@ -106,7 +109,7 @@ def __init__(
106
109
policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
107
110
self ._config .http_logging_policy ,
108
111
]
109
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
112
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
110
113
111
114
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
112
115
self ._serialize = Serializer (client_models )
0 commit comments