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 BatchManagementClientConfiguration
20- from ._serialization import Deserializer , Serializer
22+ from ._utils . serialization import Deserializer , Serializer
2123from .operations import (
2224 ApplicationOperations ,
2325 ApplicationPackageOperations ,
3234)
3335
3436if TYPE_CHECKING :
35- # pylint: disable=unused-import,ungrouped-imports
3637 from azure .core .credentials import TokenCredential
3738
3839
39- class BatchManagementClient : # pylint: disable=client-accepts-api-version-keyword, too-many-instance-attributes
40+ class BatchManagementClient : # pylint: disable=too-many-instance-attributes
4041 """Batch Client.
4142
4243 :ivar batch_account: BatchAccountOperations operations
@@ -66,7 +67,7 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo
6667 :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
6768 00000000-0000-0000-0000-000000000000). Required.
6869 :type subscription_id: str
69- :param base_url: Service URL. Default value is "https://management.azure.com" .
70+ :param base_url: Service URL. Default value is None .
7071 :type base_url: str
7172 :keyword api_version: Api Version. Default value is "2024-07-01". Note that overriding this
7273 default value may result in unsupported behavior.
@@ -76,15 +77,17 @@ class BatchManagementClient: # pylint: disable=client-accepts-api-version-keywo
7677 """
7778
7879 def __init__ (
79- self ,
80- credential : "TokenCredential" ,
81- subscription_id : str ,
82- base_url : str = "https://management.azure.com" ,
83- ** kwargs : Any
80+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
8481 ) -> None :
82+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
83+ _endpoints = get_arm_endpoints (_cloud )
84+ if not base_url :
85+ base_url = _endpoints ["resource_manager" ]
86+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
8587 self ._config = BatchManagementClientConfiguration (
86- credential = credential , subscription_id = subscription_id , ** kwargs
88+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
8789 )
90+
8891 _policies = kwargs .pop ("policies" , None )
8992 if _policies is None :
9093 _policies = [
@@ -103,7 +106,7 @@ def __init__(
103106 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
104107 self ._config .http_logging_policy ,
105108 ]
106- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
109+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
107110
108111 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
109112 self ._serialize = Serializer (client_models )
0 commit comments